ruby-internal 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (310) hide show
  1. data/COPYING +59 -0
  2. data/LGPL +515 -0
  3. data/LICENSE +9 -0
  4. data/README +31 -0
  5. data/Rakefile +20 -0
  6. data/TODO +9 -0
  7. data/example/README +5 -0
  8. data/example/simple_client.rb +12 -0
  9. data/example/simple_server.rb +11 -0
  10. data/example/triangle_client.rb +7 -0
  11. data/example/triangle_server.rb +24 -0
  12. data/ext/cached/ruby-1.8.0/internal/binding/block.h +37 -0
  13. data/ext/cached/ruby-1.8.0/internal/method/method.h +19 -0
  14. data/ext/cached/ruby-1.8.0/internal/module/classpath.c +27 -0
  15. data/ext/cached/ruby-1.8.0/internal/module/classpath.h +14 -0
  16. data/ext/cached/ruby-1.8.0/internal/node/block.h +37 -0
  17. data/ext/cached/ruby-1.8.0/internal/node/global_entry.h +10 -0
  18. data/ext/cached/ruby-1.8.0/internal/node/node_type_descrip.c +155 -0
  19. data/ext/cached/ruby-1.8.0/internal/node/nodeinfo.c +5741 -0
  20. data/ext/cached/ruby-1.8.0/internal/node/nodeinfo.h +69 -0
  21. data/ext/cached/ruby-1.8.0/internal/proc/block.h +37 -0
  22. data/ext/cached/ruby-1.8.0/internal/tag/tag.h +15 -0
  23. data/ext/cached/ruby-1.8.0/internal/vm/instruction/insns_info.c +39 -0
  24. data/ext/cached/ruby-1.8.0/internal/vm/instruction/insns_info.h +21 -0
  25. data/ext/cached/ruby-1.8.0/internal/vm/iseq/insns_info.inc +12 -0
  26. data/ext/cached/ruby-1.8.1/internal/binding/block.h +31 -0
  27. data/ext/cached/ruby-1.8.1/internal/method/method.h +19 -0
  28. data/ext/cached/ruby-1.8.1/internal/module/classpath.c +27 -0
  29. data/ext/cached/ruby-1.8.1/internal/module/classpath.h +14 -0
  30. data/ext/cached/ruby-1.8.1/internal/node/block.h +31 -0
  31. data/ext/cached/ruby-1.8.1/internal/node/global_entry.h +10 -0
  32. data/ext/cached/ruby-1.8.1/internal/node/node_type_descrip.c +154 -0
  33. data/ext/cached/ruby-1.8.1/internal/node/nodeinfo.c +5733 -0
  34. data/ext/cached/ruby-1.8.1/internal/node/nodeinfo.h +69 -0
  35. data/ext/cached/ruby-1.8.1/internal/proc/block.h +31 -0
  36. data/ext/cached/ruby-1.8.1/internal/tag/tag.h +16 -0
  37. data/ext/cached/ruby-1.8.1/internal/vm/instruction/insns_info.c +39 -0
  38. data/ext/cached/ruby-1.8.1/internal/vm/instruction/insns_info.h +21 -0
  39. data/ext/cached/ruby-1.8.1/internal/vm/iseq/insns_info.inc +12 -0
  40. data/ext/cached/ruby-1.8.2/internal/binding/block.h +32 -0
  41. data/ext/cached/ruby-1.8.2/internal/method/method.h +19 -0
  42. data/ext/cached/ruby-1.8.2/internal/module/classpath.c +45 -0
  43. data/ext/cached/ruby-1.8.2/internal/module/classpath.h +17 -0
  44. data/ext/cached/ruby-1.8.2/internal/node/block.h +32 -0
  45. data/ext/cached/ruby-1.8.2/internal/node/global_entry.h +10 -0
  46. data/ext/cached/ruby-1.8.2/internal/node/node_type_descrip.c +154 -0
  47. data/ext/cached/ruby-1.8.2/internal/node/nodeinfo.c +5733 -0
  48. data/ext/cached/ruby-1.8.2/internal/node/nodeinfo.h +69 -0
  49. data/ext/cached/ruby-1.8.2/internal/proc/block.h +32 -0
  50. data/ext/cached/ruby-1.8.2/internal/tag/tag.h +16 -0
  51. data/ext/cached/ruby-1.8.2/internal/vm/instruction/insns_info.c +39 -0
  52. data/ext/cached/ruby-1.8.2/internal/vm/instruction/insns_info.h +21 -0
  53. data/ext/cached/ruby-1.8.2/internal/vm/iseq/insns_info.inc +12 -0
  54. data/ext/cached/ruby-1.8.3/internal/binding/block.h +32 -0
  55. data/ext/cached/ruby-1.8.3/internal/method/method.h +20 -0
  56. data/ext/cached/ruby-1.8.3/internal/module/classpath.c +45 -0
  57. data/ext/cached/ruby-1.8.3/internal/module/classpath.h +17 -0
  58. data/ext/cached/ruby-1.8.3/internal/node/block.h +32 -0
  59. data/ext/cached/ruby-1.8.3/internal/node/global_entry.h +10 -0
  60. data/ext/cached/ruby-1.8.3/internal/node/node_type_descrip.c +154 -0
  61. data/ext/cached/ruby-1.8.3/internal/node/nodeinfo.c +5733 -0
  62. data/ext/cached/ruby-1.8.3/internal/node/nodeinfo.h +69 -0
  63. data/ext/cached/ruby-1.8.3/internal/proc/block.h +32 -0
  64. data/ext/cached/ruby-1.8.3/internal/tag/tag.h +16 -0
  65. data/ext/cached/ruby-1.8.3/internal/vm/instruction/insns_info.c +39 -0
  66. data/ext/cached/ruby-1.8.3/internal/vm/instruction/insns_info.h +21 -0
  67. data/ext/cached/ruby-1.8.3/internal/vm/iseq/insns_info.inc +12 -0
  68. data/ext/cached/ruby-1.8.4/internal/binding/block.h +32 -0
  69. data/ext/cached/ruby-1.8.4/internal/method/method.h +20 -0
  70. data/ext/cached/ruby-1.8.4/internal/module/classpath.c +45 -0
  71. data/ext/cached/ruby-1.8.4/internal/module/classpath.h +17 -0
  72. data/ext/cached/ruby-1.8.4/internal/node/block.h +32 -0
  73. data/ext/cached/ruby-1.8.4/internal/node/global_entry.h +10 -0
  74. data/ext/cached/ruby-1.8.4/internal/node/node_type_descrip.c +154 -0
  75. data/ext/cached/ruby-1.8.4/internal/node/nodeinfo.c +5733 -0
  76. data/ext/cached/ruby-1.8.4/internal/node/nodeinfo.h +69 -0
  77. data/ext/cached/ruby-1.8.4/internal/proc/block.h +32 -0
  78. data/ext/cached/ruby-1.8.4/internal/tag/tag.h +16 -0
  79. data/ext/cached/ruby-1.8.4/internal/vm/instruction/insns_info.c +39 -0
  80. data/ext/cached/ruby-1.8.4/internal/vm/instruction/insns_info.h +21 -0
  81. data/ext/cached/ruby-1.8.4/internal/vm/iseq/insns_info.inc +12 -0
  82. data/ext/cached/ruby-1.8.5/internal/binding/block.h +32 -0
  83. data/ext/cached/ruby-1.8.5/internal/method/method.h +20 -0
  84. data/ext/cached/ruby-1.8.5/internal/module/classpath.c +45 -0
  85. data/ext/cached/ruby-1.8.5/internal/module/classpath.h +17 -0
  86. data/ext/cached/ruby-1.8.5/internal/node/block.h +32 -0
  87. data/ext/cached/ruby-1.8.5/internal/node/global_entry.h +10 -0
  88. data/ext/cached/ruby-1.8.5/internal/node/node_type_descrip.c +154 -0
  89. data/ext/cached/ruby-1.8.5/internal/node/nodeinfo.c +5732 -0
  90. data/ext/cached/ruby-1.8.5/internal/node/nodeinfo.h +67 -0
  91. data/ext/cached/ruby-1.8.5/internal/proc/block.h +32 -0
  92. data/ext/cached/ruby-1.8.5/internal/tag/tag.h +16 -0
  93. data/ext/cached/ruby-1.8.5/internal/vm/instruction/insns_info.c +39 -0
  94. data/ext/cached/ruby-1.8.5/internal/vm/instruction/insns_info.h +21 -0
  95. data/ext/cached/ruby-1.8.5/internal/vm/iseq/insns_info.inc +12 -0
  96. data/ext/cached/ruby-1.8.6/internal/binding/block.h +32 -0
  97. data/ext/cached/ruby-1.8.6/internal/method/method.h +20 -0
  98. data/ext/cached/ruby-1.8.6/internal/module/classpath.c +45 -0
  99. data/ext/cached/ruby-1.8.6/internal/module/classpath.h +17 -0
  100. data/ext/cached/ruby-1.8.6/internal/node/block.h +32 -0
  101. data/ext/cached/ruby-1.8.6/internal/node/global_entry.h +10 -0
  102. data/ext/cached/ruby-1.8.6/internal/node/node_type_descrip.c +154 -0
  103. data/ext/cached/ruby-1.8.6/internal/node/nodeinfo.c +5732 -0
  104. data/ext/cached/ruby-1.8.6/internal/node/nodeinfo.h +67 -0
  105. data/ext/cached/ruby-1.8.6/internal/proc/block.h +32 -0
  106. data/ext/cached/ruby-1.8.6/internal/tag/tag.h +16 -0
  107. data/ext/cached/ruby-1.8.6/internal/vm/instruction/insns_info.c +39 -0
  108. data/ext/cached/ruby-1.8.6/internal/vm/instruction/insns_info.h +21 -0
  109. data/ext/cached/ruby-1.8.6/internal/vm/iseq/insns_info.inc +12 -0
  110. data/ext/cached/ruby-1.8.7/internal/binding/block.h +32 -0
  111. data/ext/cached/ruby-1.8.7/internal/method/method.h +20 -0
  112. data/ext/cached/ruby-1.8.7/internal/module/classpath.c +45 -0
  113. data/ext/cached/ruby-1.8.7/internal/module/classpath.h +17 -0
  114. data/ext/cached/ruby-1.8.7/internal/node/block.h +32 -0
  115. data/ext/cached/ruby-1.8.7/internal/node/global_entry.h +10 -0
  116. data/ext/cached/ruby-1.8.7/internal/node/node_type_descrip.c +154 -0
  117. data/ext/cached/ruby-1.8.7/internal/node/nodeinfo.c +5732 -0
  118. data/ext/cached/ruby-1.8.7/internal/node/nodeinfo.h +67 -0
  119. data/ext/cached/ruby-1.8.7/internal/proc/block.h +32 -0
  120. data/ext/cached/ruby-1.8.7/internal/tag/tag.h +16 -0
  121. data/ext/cached/ruby-1.8.7/internal/vm/instruction/insns_info.c +39 -0
  122. data/ext/cached/ruby-1.8.7/internal/vm/instruction/insns_info.h +21 -0
  123. data/ext/cached/ruby-1.8.7/internal/vm/iseq/insns_info.inc +12 -0
  124. data/ext/cached/ruby-1.9.0/internal/binding/block.h +12 -0
  125. data/ext/cached/ruby-1.9.0/internal/method/method.h +20 -0
  126. data/ext/cached/ruby-1.9.0/internal/module/classpath.c +42 -0
  127. data/ext/cached/ruby-1.9.0/internal/module/classpath.h +17 -0
  128. data/ext/cached/ruby-1.9.0/internal/node/block.h +12 -0
  129. data/ext/cached/ruby-1.9.0/internal/node/global_entry.h +10 -0
  130. data/ext/cached/ruby-1.9.0/internal/node/node_type_descrip.c +149 -0
  131. data/ext/cached/ruby-1.9.0/internal/node/nodeinfo.c +5579 -0
  132. data/ext/cached/ruby-1.9.0/internal/node/nodeinfo.h +70 -0
  133. data/ext/cached/ruby-1.9.0/internal/proc/block.h +12 -0
  134. data/ext/cached/ruby-1.9.0/internal/tag/tag.h +6 -0
  135. data/ext/cached/ruby-1.9.0/internal/vm/instruction/insns_info.c +5936 -0
  136. data/ext/cached/ruby-1.9.0/internal/vm/instruction/insns_info.h +891 -0
  137. data/ext/cached/ruby-1.9.0/internal/vm/iseq/insns_info.inc +700 -0
  138. data/ext/cached/ruby-1.9.0/internal/yarv-headers/debug.h +36 -0
  139. data/ext/cached/ruby-1.9.0/internal/yarv-headers/dln.h +41 -0
  140. data/ext/cached/ruby-1.9.0/internal/yarv-headers/encdb.h +147 -0
  141. data/ext/cached/ruby-1.9.0/internal/yarv-headers/eval_intern.h +221 -0
  142. data/ext/cached/ruby-1.9.0/internal/yarv-headers/gc.h +75 -0
  143. data/ext/cached/ruby-1.9.0/internal/yarv-headers/id.h +83 -0
  144. data/ext/cached/ruby-1.9.0/internal/yarv-headers/iseq.h +94 -0
  145. data/ext/cached/ruby-1.9.0/internal/yarv-headers/node.h +516 -0
  146. data/ext/cached/ruby-1.9.0/internal/yarv-headers/parse.h +303 -0
  147. data/ext/cached/ruby-1.9.0/internal/yarv-headers/regenc.h +207 -0
  148. data/ext/cached/ruby-1.9.0/internal/yarv-headers/regint.h +842 -0
  149. data/ext/cached/ruby-1.9.0/internal/yarv-headers/regparse.h +351 -0
  150. data/ext/cached/ruby-1.9.0/internal/yarv-headers/revision.h +1 -0
  151. data/ext/cached/ruby-1.9.0/internal/yarv-headers/thread_pthread.h +24 -0
  152. data/ext/cached/ruby-1.9.0/internal/yarv-headers/thread_win32.h +33 -0
  153. data/ext/cached/ruby-1.9.0/internal/yarv-headers/transcode_data.h +99 -0
  154. data/ext/cached/ruby-1.9.0/internal/yarv-headers/transdb.h +67 -0
  155. data/ext/cached/ruby-1.9.0/internal/yarv-headers/version.h +57 -0
  156. data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_core.h +663 -0
  157. data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_exec.h +187 -0
  158. data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_insnhelper.h +191 -0
  159. data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_opts.h +51 -0
  160. data/ext/cached/ruby-1.9.1/internal/binding/block.h +12 -0
  161. data/ext/cached/ruby-1.9.1/internal/method/method.h +20 -0
  162. data/ext/cached/ruby-1.9.1/internal/module/classpath.c +42 -0
  163. data/ext/cached/ruby-1.9.1/internal/module/classpath.h +17 -0
  164. data/ext/cached/ruby-1.9.1/internal/node/block.h +12 -0
  165. data/ext/cached/ruby-1.9.1/internal/node/global_entry.h +10 -0
  166. data/ext/cached/ruby-1.9.1/internal/node/node_type_descrip.c +149 -0
  167. data/ext/cached/ruby-1.9.1/internal/node/nodeinfo.c +5579 -0
  168. data/ext/cached/ruby-1.9.1/internal/node/nodeinfo.h +70 -0
  169. data/ext/cached/ruby-1.9.1/internal/proc/block.h +12 -0
  170. data/ext/cached/ruby-1.9.1/internal/tag/tag.h +6 -0
  171. data/ext/cached/ruby-1.9.1/internal/vm/instruction/insns_info.c +5936 -0
  172. data/ext/cached/ruby-1.9.1/internal/vm/instruction/insns_info.h +891 -0
  173. data/ext/cached/ruby-1.9.1/internal/vm/iseq/insns_info.inc +700 -0
  174. data/ext/cached/ruby-1.9.1/internal/yarv-headers/debug.h +36 -0
  175. data/ext/cached/ruby-1.9.1/internal/yarv-headers/dln.h +41 -0
  176. data/ext/cached/ruby-1.9.1/internal/yarv-headers/encdb.h +147 -0
  177. data/ext/cached/ruby-1.9.1/internal/yarv-headers/eval_intern.h +209 -0
  178. data/ext/cached/ruby-1.9.1/internal/yarv-headers/gc.h +75 -0
  179. data/ext/cached/ruby-1.9.1/internal/yarv-headers/id.h +184 -0
  180. data/ext/cached/ruby-1.9.1/internal/yarv-headers/iseq.h +94 -0
  181. data/ext/cached/ruby-1.9.1/internal/yarv-headers/node.h +516 -0
  182. data/ext/cached/ruby-1.9.1/internal/yarv-headers/parse.h +303 -0
  183. data/ext/cached/ruby-1.9.1/internal/yarv-headers/regenc.h +207 -0
  184. data/ext/cached/ruby-1.9.1/internal/yarv-headers/regint.h +842 -0
  185. data/ext/cached/ruby-1.9.1/internal/yarv-headers/regparse.h +351 -0
  186. data/ext/cached/ruby-1.9.1/internal/yarv-headers/revision.h +1 -0
  187. data/ext/cached/ruby-1.9.1/internal/yarv-headers/thread_pthread.h +24 -0
  188. data/ext/cached/ruby-1.9.1/internal/yarv-headers/thread_win32.h +33 -0
  189. data/ext/cached/ruby-1.9.1/internal/yarv-headers/transcode_data.h +99 -0
  190. data/ext/cached/ruby-1.9.1/internal/yarv-headers/transdb.h +85 -0
  191. data/ext/cached/ruby-1.9.1/internal/yarv-headers/version.h +60 -0
  192. data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_core.h +655 -0
  193. data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_exec.h +187 -0
  194. data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_insnhelper.h +194 -0
  195. data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_opts.h +51 -0
  196. data/ext/internal/binding/binding.c +45 -0
  197. data/ext/internal/binding/block.h.rpp +44 -0
  198. data/ext/internal/binding/extconf.rb +6 -0
  199. data/ext/internal/method/extconf.rb +8 -0
  200. data/ext/internal/method/method.c +269 -0
  201. data/ext/internal/method/method.h.rpp +58 -0
  202. data/ext/internal/module/classpath.c.rpp +29 -0
  203. data/ext/internal/module/classpath.h.rpp +36 -0
  204. data/ext/internal/module/extconf.rb +11 -0
  205. data/ext/internal/module/module.c +797 -0
  206. data/ext/internal/module/module.h +7 -0
  207. data/ext/internal/node/block.h.rpp +44 -0
  208. data/ext/internal/node/builtins.h +41 -0
  209. data/ext/internal/node/extconf.rb +66 -0
  210. data/ext/internal/node/global_entry.h.rpp +26 -0
  211. data/ext/internal/node/node.c +1147 -0
  212. data/ext/internal/node/node_type_descrip.c.rpp +72 -0
  213. data/ext/internal/node/node_type_descrip.h +17 -0
  214. data/ext/internal/node/node_type_descrip.rb +39 -0
  215. data/ext/internal/node/nodeinfo.c.rpp +587 -0
  216. data/ext/internal/node/nodeinfo.h.rpp +30 -0
  217. data/ext/internal/node/nodes.rb +78 -0
  218. data/ext/internal/node/read_node_h.rb +34 -0
  219. data/ext/internal/node/ruby_internal_node.h +31 -0
  220. data/ext/internal/noex/extconf.rb +6 -0
  221. data/ext/internal/noex/noex.c +44 -0
  222. data/ext/internal/object/extconf.rb +4 -0
  223. data/ext/internal/object/object.c +75 -0
  224. data/ext/internal/proc/block.h.rpp +44 -0
  225. data/ext/internal/proc/extconf.rb +9 -0
  226. data/ext/internal/proc/proc.c +331 -0
  227. data/ext/internal/tag/extconf.rb +3 -0
  228. data/ext/internal/tag/tag.c +17 -0
  229. data/ext/internal/tag/tag.h.rpp +22 -0
  230. data/ext/internal/thread/extconf.rb +3 -0
  231. data/ext/internal/thread/thread.c +107 -0
  232. data/ext/internal/vm/constants/constants.c +33 -0
  233. data/ext/internal/vm/constants/extconf.rb +3 -0
  234. data/ext/internal/vm/control_frame/control_frame.c +185 -0
  235. data/ext/internal/vm/control_frame/control_frame.h +18 -0
  236. data/ext/internal/vm/control_frame/extconf.rb +3 -0
  237. data/ext/internal/vm/extconf.rb +3 -0
  238. data/ext/internal/vm/inline_cache/extconf.rb +6 -0
  239. data/ext/internal/vm/inline_cache/inline_cache.c +79 -0
  240. data/ext/internal/vm/instruction/extconf.rb +6 -0
  241. data/ext/internal/vm/instruction/insns_info.c.rpp +213 -0
  242. data/ext/internal/vm/instruction/insns_info.h.rpp +53 -0
  243. data/ext/internal/vm/instruction/instruction.c +78 -0
  244. data/ext/internal/vm/instruction/instruction.h +10 -0
  245. data/ext/internal/vm/iseq/extconf.rb +7 -0
  246. data/ext/internal/vm/iseq/insns_info.inc.rpp +30 -0
  247. data/ext/internal/vm/iseq/internal_iseq.h +9 -0
  248. data/ext/internal/vm/iseq/iseq.c +555 -0
  249. data/ext/internal/vm/vm.c +55 -0
  250. data/ext/mkmf-ruby-internal.rb +111 -0
  251. data/ext/ruby_source_dir.rb +24 -0
  252. data/ext/rubypp.rb +97 -0
  253. data/generate_rdoc.rb +33 -0
  254. data/lib/internal/binding.rb +1 -0
  255. data/lib/internal/classtree.rb +55 -0
  256. data/lib/internal/debug.rb +16 -0
  257. data/lib/internal/method.rb +1 -0
  258. data/lib/internal/method/as_code.rb +33 -0
  259. data/lib/internal/method/as_expression.rb +34 -0
  260. data/lib/internal/method/signature.rb +442 -0
  261. data/lib/internal/module.rb +1 -0
  262. data/lib/internal/module/as_code.rb +45 -0
  263. data/lib/internal/node.rb +3 -0
  264. data/lib/internal/node/as_code.rb +233 -0
  265. data/lib/internal/node/as_expression.rb +619 -0
  266. data/lib/internal/node/dump.rb +53 -0
  267. data/lib/internal/node/pp.rb +72 -0
  268. data/lib/internal/node/to_a.rb +52 -0
  269. data/lib/internal/noex.rb +1 -0
  270. data/lib/internal/obfusc.rb +57 -0
  271. data/lib/internal/object.rb +1 -0
  272. data/lib/internal/object/as_code.rb +10 -0
  273. data/lib/internal/proc.rb +1 -0
  274. data/lib/internal/proc/as_code.rb +21 -0
  275. data/lib/internal/proc/as_expression.rb +14 -0
  276. data/lib/internal/proc/signature.rb +184 -0
  277. data/lib/internal/tag.rb +1 -0
  278. data/lib/internal/thread.rb +1 -0
  279. data/lib/internal/vm.rb +1 -0
  280. data/lib/internal/vm/bytedecoder.rb +866 -0
  281. data/lib/internal/vm/constants.rb +1 -0
  282. data/lib/internal/vm/control_frame.rb +1 -0
  283. data/lib/internal/vm/inline_cache.rb +1 -0
  284. data/lib/internal/vm/instruction.rb +1 -0
  285. data/lib/internal/vm/iseq.rb +1 -0
  286. data/lib/internal/vm/iseq/as_code.rb +27 -0
  287. data/lib/internal/vm/iseq/as_expression.rb +26 -0
  288. data/metaconfig +19 -0
  289. data/post-config.rb +1 -0
  290. data/post-install.rb +4 -0
  291. data/post-setup.rb +7 -0
  292. data/pre-config.rb +96 -0
  293. data/pre-install.rb +13 -0
  294. data/pre-setup.rb +8 -0
  295. data/run_tests.rb +26 -0
  296. data/setup.rb +1599 -0
  297. data/test/expression_samples.rb +160 -0
  298. data/test/node_samples.rb +122 -0
  299. data/test/test_as_code.rb +261 -0
  300. data/test/test_as_expression.rb +229 -0
  301. data/test/test_dump_class.rb +187 -0
  302. data/test/test_dump_method.rb +144 -0
  303. data/test/test_dump_proc.rb +118 -0
  304. data/test/test_helpers.rb +61 -0
  305. data/test/test_method.rb +72 -0
  306. data/test/test_methodsig.rb +267 -0
  307. data/test/test_module.rb +49 -0
  308. data/test/test_node.rb +77 -0
  309. data/test/test_proc.rb +47 -0
  310. metadata +377 -0
@@ -0,0 +1,184 @@
1
+ /* DO NOT EDIT THIS FILE DIRECTLY */
2
+ /**********************************************************************
3
+
4
+ id.h -
5
+
6
+ $Author: ko1 $
7
+ created at: Thu Jul 12 04:38:07 2007
8
+
9
+ Copyright (C) 2007 Koichi Sasada
10
+
11
+ **********************************************************************/
12
+
13
+ #ifndef RUBY_ID_H
14
+ #define RUBY_ID_H
15
+
16
+ #define ID_SCOPE_SHIFT 3
17
+ #define ID_SCOPE_MASK 0x07
18
+ #define ID_LOCAL 0x00
19
+ #define ID_INSTANCE 0x01
20
+ #define ID_GLOBAL 0x03
21
+ #define ID_ATTRSET 0x04
22
+ #define ID_CONST 0x05
23
+ #define ID_CLASS 0x06
24
+ #define ID_JUNK 0x07
25
+ #define ID_INTERNAL ID_JUNK
26
+
27
+ #ifdef USE_PARSE_H
28
+ #include "parse.h"
29
+ #endif
30
+
31
+ #define symIFUNC ID2SYM(idIFUNC)
32
+ #define symCFUNC ID2SYM(idCFUNC)
33
+
34
+ enum ruby_method_ids {
35
+ #ifndef tLAST_TOKEN
36
+ tUPLUS = 321,
37
+ tUMINUS = 322,
38
+ tPOW = 323,
39
+ tCMP = 324,
40
+ tEQ = 325,
41
+ tEQQ = 326,
42
+ tNEQ = 327,
43
+ tGEQ = 328,
44
+ tLEQ = 329,
45
+ tANDOP = 330,
46
+ tOROP = 331,
47
+ tMATCH = 332,
48
+ tNMATCH = 333,
49
+ tDOT2 = 334,
50
+ tDOT3 = 335,
51
+ tAREF = 336,
52
+ tASET = 337,
53
+ tLSHFT = 338,
54
+ tRSHFT = 339,
55
+ tLAMBDA = 352,
56
+ idNULL = 365,
57
+ idRespond_to = 366,
58
+ idIFUNC = 367,
59
+ idCFUNC = 368,
60
+ idThrowState = 369,
61
+ id_core_set_method_alias = 370,
62
+ id_core_set_variable_alias = 371,
63
+ id_core_undef_method = 372,
64
+ id_core_define_method = 373,
65
+ id_core_define_singleton_method = 374,
66
+ id_core_set_postexe = 375,
67
+ tLAST_TOKEN = 376,
68
+ #elif tUPLUS != 321
69
+ #error tUPLUS differs
70
+ #elif tUMINUS != 322
71
+ #error tUMINUS differs
72
+ #elif tPOW != 323
73
+ #error tPOW differs
74
+ #elif tCMP != 324
75
+ #error tCMP differs
76
+ #elif tEQ != 325
77
+ #error tEQ differs
78
+ #elif tEQQ != 326
79
+ #error tEQQ differs
80
+ #elif tNEQ != 327
81
+ #error tNEQ differs
82
+ #elif tGEQ != 328
83
+ #error tGEQ differs
84
+ #elif tLEQ != 329
85
+ #error tLEQ differs
86
+ #elif tANDOP != 330
87
+ #error tANDOP differs
88
+ #elif tOROP != 331
89
+ #error tOROP differs
90
+ #elif tMATCH != 332
91
+ #error tMATCH differs
92
+ #elif tNMATCH != 333
93
+ #error tNMATCH differs
94
+ #elif tDOT2 != 334
95
+ #error tDOT2 differs
96
+ #elif tDOT3 != 335
97
+ #error tDOT3 differs
98
+ #elif tAREF != 336
99
+ #error tAREF differs
100
+ #elif tASET != 337
101
+ #error tASET differs
102
+ #elif tLSHFT != 338
103
+ #error tLSHFT differs
104
+ #elif tRSHFT != 339
105
+ #error tRSHFT differs
106
+ #elif tLAMBDA != 352
107
+ #error tLAMBDA differs
108
+ #elif idNULL != 365
109
+ #error idNULL differs
110
+ #elif idRespond_to != 366
111
+ #error idRespond_to differs
112
+ #elif idIFUNC != 367
113
+ #error idIFUNC differs
114
+ #elif idCFUNC != 368
115
+ #error idCFUNC differs
116
+ #elif idThrowState != 369
117
+ #error idThrowState differs
118
+ #elif id_core_set_method_alias != 370
119
+ #error id_core_set_method_alias differs
120
+ #elif id_core_set_variable_alias != 371
121
+ #error id_core_set_variable_alias differs
122
+ #elif id_core_undef_method != 372
123
+ #error id_core_undef_method differs
124
+ #elif id_core_define_method != 373
125
+ #error id_core_define_method differs
126
+ #elif id_core_define_singleton_method != 374
127
+ #error id_core_define_singleton_method differs
128
+ #elif id_core_set_postexe != 375
129
+ #error id_core_set_postexe differs
130
+ #elif tLAST_TOKEN != 376
131
+ #error tLAST_TOKEN differs
132
+ #endif
133
+ idPLUS = '+',
134
+ idMINUS = '-',
135
+ idMULT = '*',
136
+ idDIV = '/',
137
+ idMOD = '%',
138
+ idLT = '<',
139
+ idLTLT = tLSHFT,
140
+ idLE = tLEQ,
141
+ idGT = '>',
142
+ idGE = tGEQ,
143
+ idEq = tEQ,
144
+ idEqq = tEQQ,
145
+ idNeq = tNEQ,
146
+ idNot = '!',
147
+ idBackquote = '`',
148
+ idEqTilde = tMATCH,
149
+ idAREF = tAREF,
150
+ idASET = tASET,
151
+ idLAST_TOKEN = tLAST_TOKEN >> ID_SCOPE_SHIFT,
152
+ tIntern,
153
+ tMethodMissing,
154
+ tLength,
155
+ tGets,
156
+ tSucc,
157
+ tEach,
158
+ tLambda,
159
+ tSend,
160
+ t__send__,
161
+ tInitialize,
162
+ #if SUPPORT_JOKE
163
+ tBitblt,
164
+ tAnswer,
165
+ #endif
166
+ tLAST_ID,
167
+ #define TOKEN2ID(n) id##n = ((t##n<<ID_SCOPE_SHIFT)|ID_LOCAL)
168
+ #if SUPPORT_JOKE
169
+ TOKEN2ID(Bitblt),
170
+ TOKEN2ID(Answer),
171
+ #endif
172
+ TOKEN2ID(Intern),
173
+ TOKEN2ID(MethodMissing),
174
+ TOKEN2ID(Length),
175
+ TOKEN2ID(Gets),
176
+ TOKEN2ID(Succ),
177
+ TOKEN2ID(Each),
178
+ TOKEN2ID(Lambda),
179
+ TOKEN2ID(Send),
180
+ TOKEN2ID(__send__),
181
+ TOKEN2ID(Initialize)
182
+ };
183
+
184
+ #endif /* RUBY_ID_H */
@@ -0,0 +1,94 @@
1
+ /**********************************************************************
2
+
3
+ iseq.h -
4
+
5
+ $Author: ko1 $
6
+ created at: 04/01/01 23:36:57 JST
7
+
8
+ Copyright (C) 2004-2008 Koichi Sasada
9
+
10
+ **********************************************************************/
11
+
12
+ #ifndef RUBY_COMPILE_H
13
+ #define RUBY_COMPILE_H
14
+
15
+ VALUE iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt);
16
+
17
+ #define ISEQ_TYPE_TOP INT2FIX(1)
18
+ #define ISEQ_TYPE_METHOD INT2FIX(2)
19
+ #define ISEQ_TYPE_BLOCK INT2FIX(3)
20
+ #define ISEQ_TYPE_CLASS INT2FIX(4)
21
+ #define ISEQ_TYPE_RESCUE INT2FIX(5)
22
+ #define ISEQ_TYPE_ENSURE INT2FIX(6)
23
+ #define ISEQ_TYPE_EVAL INT2FIX(7)
24
+ #define ISEQ_TYPE_DEFINED_GUARD INT2FIX(8)
25
+
26
+ #define CATCH_TYPE_RESCUE INT2FIX(1)
27
+ #define CATCH_TYPE_ENSURE INT2FIX(2)
28
+ #define CATCH_TYPE_RETRY INT2FIX(3)
29
+ #define CATCH_TYPE_BREAK INT2FIX(4)
30
+ #define CATCH_TYPE_REDO INT2FIX(5)
31
+ #define CATCH_TYPE_NEXT INT2FIX(6)
32
+
33
+ struct iseq_insn_info_entry {
34
+ unsigned short position;
35
+ unsigned short line_no;
36
+ unsigned short sp;
37
+ };
38
+
39
+ struct iseq_catch_table_entry {
40
+ VALUE type;
41
+ VALUE iseq;
42
+ unsigned long start;
43
+ unsigned long end;
44
+ unsigned long cont;
45
+ unsigned long sp;
46
+ };
47
+
48
+ #define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512)
49
+
50
+ struct iseq_compile_data_storage {
51
+ struct iseq_compile_data_storage *next;
52
+ unsigned long pos;
53
+ unsigned long size;
54
+ char *buff;
55
+ };
56
+
57
+ struct iseq_compile_data {
58
+ /* GC is needed */
59
+ VALUE err_info;
60
+ VALUE mark_ary;
61
+ VALUE catch_table_ary; /* Array */
62
+
63
+ /* GC is not needed */
64
+ struct iseq_label_data *start_label;
65
+ struct iseq_label_data *end_label;
66
+ struct iseq_label_data *redo_label;
67
+ VALUE current_block;
68
+ VALUE loopval_popped; /* used by NODE_BREAK */
69
+ VALUE ensure_node;
70
+ VALUE for_iseq;
71
+ struct iseq_compile_data_ensure_node_stack *ensure_node_stack;
72
+ int cached_const;
73
+ struct iseq_compile_data_storage *storage_head;
74
+ struct iseq_compile_data_storage *storage_current;
75
+ int last_line;
76
+ int flip_cnt;
77
+ int label_no;
78
+ int node_level;
79
+ const rb_compile_option_t *option;
80
+ };
81
+
82
+ /* defined? */
83
+ #define DEFINED_IVAR INT2FIX(1)
84
+ #define DEFINED_IVAR2 INT2FIX(2)
85
+ #define DEFINED_GVAR INT2FIX(3)
86
+ #define DEFINED_CVAR INT2FIX(4)
87
+ #define DEFINED_CONST INT2FIX(5)
88
+ #define DEFINED_METHOD INT2FIX(6)
89
+ #define DEFINED_YIELD INT2FIX(7)
90
+ #define DEFINED_REF INT2FIX(8)
91
+ #define DEFINED_ZSUPER INT2FIX(9)
92
+ #define DEFINED_FUNC INT2FIX(10)
93
+
94
+ #endif /* RUBY_COMPILE_H */
@@ -0,0 +1,516 @@
1
+ /**********************************************************************
2
+
3
+ node.h -
4
+
5
+ $Author: ko1 $
6
+ created at: Fri May 28 15:14:02 JST 1993
7
+
8
+ Copyright (C) 1993-2007 Yukihiro Matsumoto
9
+
10
+ **********************************************************************/
11
+
12
+ #ifndef RUBY_NODE_H
13
+ #define RUBY_NODE_H 1
14
+
15
+ #if defined(__cplusplus)
16
+ extern "C" {
17
+ #if 0
18
+ } /* satisfy cc-mode */
19
+ #endif
20
+ #endif
21
+
22
+ enum node_type {
23
+ NODE_METHOD,
24
+ #define NODE_METHOD NODE_METHOD
25
+ NODE_FBODY,
26
+ #define NODE_FBODY NODE_FBODY
27
+ NODE_CFUNC,
28
+ #define NODE_CFUNC NODE_CFUNC
29
+ NODE_SCOPE,
30
+ #define NODE_SCOPE NODE_SCOPE
31
+ NODE_BLOCK,
32
+ #define NODE_BLOCK NODE_BLOCK
33
+ NODE_IF,
34
+ #define NODE_IF NODE_IF
35
+ NODE_CASE,
36
+ #define NODE_CASE NODE_CASE
37
+ NODE_WHEN,
38
+ #define NODE_WHEN NODE_WHEN
39
+ NODE_OPT_N,
40
+ #define NODE_OPT_N NODE_OPT_N
41
+ NODE_WHILE,
42
+ #define NODE_WHILE NODE_WHILE
43
+ NODE_UNTIL,
44
+ #define NODE_UNTIL NODE_UNTIL
45
+ NODE_ITER,
46
+ #define NODE_ITER NODE_ITER
47
+ NODE_FOR,
48
+ #define NODE_FOR NODE_FOR
49
+ NODE_BREAK,
50
+ #define NODE_BREAK NODE_BREAK
51
+ NODE_NEXT,
52
+ #define NODE_NEXT NODE_NEXT
53
+ NODE_REDO,
54
+ #define NODE_REDO NODE_REDO
55
+ NODE_RETRY,
56
+ #define NODE_RETRY NODE_RETRY
57
+ NODE_BEGIN,
58
+ #define NODE_BEGIN NODE_BEGIN
59
+ NODE_RESCUE,
60
+ #define NODE_RESCUE NODE_RESCUE
61
+ NODE_RESBODY,
62
+ #define NODE_RESBODY NODE_RESBODY
63
+ NODE_ENSURE,
64
+ #define NODE_ENSURE NODE_ENSURE
65
+ NODE_AND,
66
+ #define NODE_AND NODE_AND
67
+ NODE_OR,
68
+ #define NODE_OR NODE_OR
69
+ NODE_MASGN,
70
+ #define NODE_MASGN NODE_MASGN
71
+ NODE_LASGN,
72
+ #define NODE_LASGN NODE_LASGN
73
+ NODE_DASGN,
74
+ #define NODE_DASGN NODE_DASGN
75
+ NODE_DASGN_CURR,
76
+ #define NODE_DASGN_CURR NODE_DASGN_CURR
77
+ NODE_GASGN,
78
+ #define NODE_GASGN NODE_GASGN
79
+ NODE_IASGN,
80
+ #define NODE_IASGN NODE_IASGN
81
+ NODE_IASGN2,
82
+ #define NODE_IASGN2 NODE_IASGN2
83
+ NODE_CDECL,
84
+ #define NODE_CDECL NODE_CDECL
85
+ NODE_CVASGN,
86
+ #define NODE_CVASGN NODE_CVASGN
87
+ NODE_CVDECL,
88
+ #define NODE_CVDECL NODE_CVDECL
89
+ NODE_OP_ASGN1,
90
+ #define NODE_OP_ASGN1 NODE_OP_ASGN1
91
+ NODE_OP_ASGN2,
92
+ #define NODE_OP_ASGN2 NODE_OP_ASGN2
93
+ NODE_OP_ASGN_AND,
94
+ #define NODE_OP_ASGN_AND NODE_OP_ASGN_AND
95
+ NODE_OP_ASGN_OR,
96
+ #define NODE_OP_ASGN_OR NODE_OP_ASGN_OR
97
+ NODE_CALL,
98
+ #define NODE_CALL NODE_CALL
99
+ NODE_FCALL,
100
+ #define NODE_FCALL NODE_FCALL
101
+ NODE_VCALL,
102
+ #define NODE_VCALL NODE_VCALL
103
+ NODE_SUPER,
104
+ #define NODE_SUPER NODE_SUPER
105
+ NODE_ZSUPER,
106
+ #define NODE_ZSUPER NODE_ZSUPER
107
+ NODE_ARRAY,
108
+ #define NODE_ARRAY NODE_ARRAY
109
+ NODE_ZARRAY,
110
+ #define NODE_ZARRAY NODE_ZARRAY
111
+ NODE_VALUES,
112
+ #define NODE_VALUES NODE_VALUES
113
+ NODE_HASH,
114
+ #define NODE_HASH NODE_HASH
115
+ NODE_RETURN,
116
+ #define NODE_RETURN NODE_RETURN
117
+ NODE_YIELD,
118
+ #define NODE_YIELD NODE_YIELD
119
+ NODE_LVAR,
120
+ #define NODE_LVAR NODE_LVAR
121
+ NODE_DVAR,
122
+ #define NODE_DVAR NODE_DVAR
123
+ NODE_GVAR,
124
+ #define NODE_GVAR NODE_GVAR
125
+ NODE_IVAR,
126
+ #define NODE_IVAR NODE_IVAR
127
+ NODE_CONST,
128
+ #define NODE_CONST NODE_CONST
129
+ NODE_CVAR,
130
+ #define NODE_CVAR NODE_CVAR
131
+ NODE_NTH_REF,
132
+ #define NODE_NTH_REF NODE_NTH_REF
133
+ NODE_BACK_REF,
134
+ #define NODE_BACK_REF NODE_BACK_REF
135
+ NODE_MATCH,
136
+ #define NODE_MATCH NODE_MATCH
137
+ NODE_MATCH2,
138
+ #define NODE_MATCH2 NODE_MATCH2
139
+ NODE_MATCH3,
140
+ #define NODE_MATCH3 NODE_MATCH3
141
+ NODE_LIT,
142
+ #define NODE_LIT NODE_LIT
143
+ NODE_STR,
144
+ #define NODE_STR NODE_STR
145
+ NODE_DSTR,
146
+ #define NODE_DSTR NODE_DSTR
147
+ NODE_XSTR,
148
+ #define NODE_XSTR NODE_XSTR
149
+ NODE_DXSTR,
150
+ #define NODE_DXSTR NODE_DXSTR
151
+ NODE_EVSTR,
152
+ #define NODE_EVSTR NODE_EVSTR
153
+ NODE_DREGX,
154
+ #define NODE_DREGX NODE_DREGX
155
+ NODE_DREGX_ONCE,
156
+ #define NODE_DREGX_ONCE NODE_DREGX_ONCE
157
+ NODE_ARGS,
158
+ #define NODE_ARGS NODE_ARGS
159
+ NODE_ARGS_AUX,
160
+ #define NODE_ARGS_AUX NODE_ARGS_AUX
161
+ NODE_OPT_ARG,
162
+ #define NODE_OPT_ARG NODE_OPT_ARG
163
+ NODE_POSTARG,
164
+ #define NODE_POSTARG NODE_POSTARG
165
+ NODE_ARGSCAT,
166
+ #define NODE_ARGSCAT NODE_ARGSCAT
167
+ NODE_ARGSPUSH,
168
+ #define NODE_ARGSPUSH NODE_ARGSPUSH
169
+ NODE_SPLAT,
170
+ #define NODE_SPLAT NODE_SPLAT
171
+ NODE_TO_ARY,
172
+ #define NODE_TO_ARY NODE_TO_ARY
173
+ NODE_BLOCK_ARG,
174
+ #define NODE_BLOCK_ARG NODE_BLOCK_ARG
175
+ NODE_BLOCK_PASS,
176
+ #define NODE_BLOCK_PASS NODE_BLOCK_PASS
177
+ NODE_DEFN,
178
+ #define NODE_DEFN NODE_DEFN
179
+ NODE_DEFS,
180
+ #define NODE_DEFS NODE_DEFS
181
+ NODE_ALIAS,
182
+ #define NODE_ALIAS NODE_ALIAS
183
+ NODE_VALIAS,
184
+ #define NODE_VALIAS NODE_VALIAS
185
+ NODE_UNDEF,
186
+ #define NODE_UNDEF NODE_UNDEF
187
+ NODE_CLASS,
188
+ #define NODE_CLASS NODE_CLASS
189
+ NODE_MODULE,
190
+ #define NODE_MODULE NODE_MODULE
191
+ NODE_SCLASS,
192
+ #define NODE_SCLASS NODE_SCLASS
193
+ NODE_COLON2,
194
+ #define NODE_COLON2 NODE_COLON2
195
+ NODE_COLON3,
196
+ #define NODE_COLON3 NODE_COLON3
197
+ NODE_DOT2,
198
+ #define NODE_DOT2 NODE_DOT2
199
+ NODE_DOT3,
200
+ #define NODE_DOT3 NODE_DOT3
201
+ NODE_FLIP2,
202
+ #define NODE_FLIP2 NODE_FLIP2
203
+ NODE_FLIP3,
204
+ #define NODE_FLIP3 NODE_FLIP3
205
+ NODE_ATTRSET,
206
+ #define NODE_ATTRSET NODE_ATTRSET
207
+ NODE_SELF,
208
+ #define NODE_SELF NODE_SELF
209
+ NODE_NIL,
210
+ #define NODE_NIL NODE_NIL
211
+ NODE_TRUE,
212
+ #define NODE_TRUE NODE_TRUE
213
+ NODE_FALSE,
214
+ #define NODE_FALSE NODE_FALSE
215
+ NODE_ERRINFO,
216
+ #define NODE_ERRINFO NODE_ERRINFO
217
+ NODE_DEFINED,
218
+ #define NODE_DEFINED NODE_DEFINED
219
+ NODE_POSTEXE,
220
+ #define NODE_POSTEXE NODE_POSTEXE
221
+ NODE_ALLOCA,
222
+ #define NODE_ALLOCA NODE_ALLOCA
223
+ NODE_BMETHOD,
224
+ #define NODE_BMETHOD NODE_BMETHOD
225
+ NODE_MEMO,
226
+ #define NODE_MEMO NODE_MEMO
227
+ NODE_IFUNC,
228
+ #define NODE_IFUNC NODE_IFUNC
229
+ NODE_DSYM,
230
+ #define NODE_DSYM NODE_DSYM
231
+ NODE_ATTRASGN,
232
+ #define NODE_ATTRASGN NODE_ATTRASGN
233
+ NODE_PRELUDE,
234
+ #define NODE_PRELUDE NODE_PRELUDE
235
+ NODE_LAMBDA,
236
+ #define NODE_LAMBDA NODE_LAMBDA
237
+ NODE_OPTBLOCK,
238
+ #define NODE_OPTBLOCK NODE_OPTBLOCK
239
+ NODE_LAST
240
+ #define NODE_LAST NODE_LAST
241
+ };
242
+
243
+ typedef struct RNode {
244
+ unsigned long flags;
245
+ char *nd_file;
246
+ union {
247
+ struct RNode *node;
248
+ ID id;
249
+ VALUE value;
250
+ VALUE (*cfunc)(ANYARGS);
251
+ ID *tbl;
252
+ } u1;
253
+ union {
254
+ struct RNode *node;
255
+ ID id;
256
+ long argc;
257
+ VALUE value;
258
+ } u2;
259
+ union {
260
+ struct RNode *node;
261
+ ID id;
262
+ long state;
263
+ struct global_entry *entry;
264
+ long cnt;
265
+ VALUE value;
266
+ } u3;
267
+ } NODE;
268
+
269
+ #define RNODE(obj) (R_CAST(RNode)(obj))
270
+
271
+ /* 0..4:T_TYPES, 5:FL_MARK, 6:reserved, 7:NODE_FL_NEWLINE */
272
+ #define NODE_FL_NEWLINE (((VALUE)1)<<7)
273
+
274
+ #define NODE_TYPESHIFT 8
275
+ #define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
276
+
277
+ #define nd_type(n) ((int) (((RNODE(n))->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
278
+ #define nd_set_type(n,t) \
279
+ RNODE(n)->flags=((RNODE(n)->flags&~NODE_TYPEMASK)|(((t)<<NODE_TYPESHIFT)&NODE_TYPEMASK))
280
+
281
+ #define NODE_LSHIFT (NODE_TYPESHIFT+7)
282
+ #define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
283
+ #define nd_line(n) ((VALUE)(((RNODE(n))->flags>>NODE_LSHIFT)&NODE_LMASK))
284
+ #define nd_set_line(n,l) \
285
+ RNODE(n)->flags=((RNODE(n)->flags&~(-1<<NODE_LSHIFT))|(((l)&NODE_LMASK)<<NODE_LSHIFT))
286
+
287
+ #define nd_head u1.node
288
+ #define nd_alen u2.argc
289
+ #define nd_next u3.node
290
+
291
+ #define nd_cond u1.node
292
+ #define nd_body u2.node
293
+ #define nd_else u3.node
294
+
295
+ #define nd_orig u3.value
296
+
297
+ #define nd_resq u2.node
298
+ #define nd_ensr u3.node
299
+
300
+ #define nd_1st u1.node
301
+ #define nd_2nd u2.node
302
+
303
+ #define nd_stts u1.node
304
+
305
+ #define nd_entry u3.entry
306
+ #define nd_vid u1.id
307
+ #define nd_cflag u2.id
308
+ #define nd_cval u3.value
309
+
310
+ #define nd_oid u1.id
311
+ #define nd_cnt u3.cnt
312
+ #define nd_tbl u1.tbl
313
+
314
+ #define nd_var u1.node
315
+ #define nd_iter u3.node
316
+
317
+ #define nd_value u2.node
318
+ #define nd_aid u3.id
319
+
320
+ #define nd_lit u1.value
321
+
322
+ #define nd_frml u2.argc
323
+ #define nd_rest u1.id
324
+ #define nd_opt u1.node
325
+ #define nd_pid u1.id
326
+ #define nd_plen u2.argc
327
+
328
+ #define nd_recv u1.node
329
+ #define nd_mid u2.id
330
+ #define nd_args u3.node
331
+
332
+ #define nd_noex u3.id
333
+ #define nd_defn u3.node
334
+
335
+ #define nd_cfnc u1.cfunc
336
+ #define nd_argc u2.argc
337
+
338
+ #define nd_cpath u1.node
339
+ #define nd_super u3.node
340
+
341
+ #define nd_modl u1.id
342
+ #define nd_clss u1.value
343
+
344
+ #define nd_beg u1.node
345
+ #define nd_end u2.node
346
+ #define nd_state u3.state
347
+ #define nd_rval u2.value
348
+
349
+ #define nd_nth u2.argc
350
+
351
+ #define nd_tag u1.id
352
+ #define nd_tval u2.value
353
+
354
+ #define nd_visi u2.argc
355
+
356
+ #define NEW_NODE(t,a0,a1,a2) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2))
357
+
358
+ #define NEW_METHOD(n,x,v) NEW_NODE(NODE_METHOD,x,n,v)
359
+ #define NEW_FBODY(n,i) NEW_NODE(NODE_FBODY,i,n,0)
360
+ #define NEW_DEFN(i,a,d,p) NEW_NODE(NODE_DEFN,0,i,NEW_SCOPE(a,d))
361
+ #define NEW_DEFS(r,i,a,d) NEW_NODE(NODE_DEFS,r,i,NEW_SCOPE(a,d))
362
+ #define NEW_CFUNC(f,c) NEW_NODE(NODE_CFUNC,f,c,0)
363
+ #define NEW_IFUNC(f,c) NEW_NODE(NODE_IFUNC,f,c,0)
364
+ #define NEW_SCOPE(a,b) NEW_NODE(NODE_SCOPE,local_tbl(),b,a)
365
+ #define NEW_BLOCK(a) NEW_NODE(NODE_BLOCK,a,0,0)
366
+ #define NEW_IF(c,t,e) NEW_NODE(NODE_IF,c,t,e)
367
+ #define NEW_UNLESS(c,t,e) NEW_IF(c,e,t)
368
+ #define NEW_CASE(h,b) NEW_NODE(NODE_CASE,h,b,0)
369
+ #define NEW_WHEN(c,t,e) NEW_NODE(NODE_WHEN,c,t,e)
370
+ #define NEW_OPT_N(b) NEW_NODE(NODE_OPT_N,0,b,0)
371
+ #define NEW_WHILE(c,b,n) NEW_NODE(NODE_WHILE,c,b,n)
372
+ #define NEW_UNTIL(c,b,n) NEW_NODE(NODE_UNTIL,c,b,n)
373
+ #define NEW_FOR(v,i,b) NEW_NODE(NODE_FOR,v,b,i)
374
+ #define NEW_ITER(a,b) NEW_NODE(NODE_ITER,0,NEW_SCOPE(a,b),0)
375
+ #define NEW_LAMBDA(a) NEW_NODE(NODE_LAMBDA,a,0,0)
376
+ #define NEW_BREAK(s) NEW_NODE(NODE_BREAK,s,0,0)
377
+ #define NEW_NEXT(s) NEW_NODE(NODE_NEXT,s,0,0)
378
+ #define NEW_REDO() NEW_NODE(NODE_REDO,0,0,0)
379
+ #define NEW_RETRY() NEW_NODE(NODE_RETRY,0,0,0)
380
+ #define NEW_BEGIN(b) NEW_NODE(NODE_BEGIN,0,b,0)
381
+ #define NEW_RESCUE(b,res,e) NEW_NODE(NODE_RESCUE,b,res,e)
382
+ #define NEW_RESBODY(a,ex,n) NEW_NODE(NODE_RESBODY,n,ex,a)
383
+ #define NEW_ENSURE(b,en) NEW_NODE(NODE_ENSURE,b,0,en)
384
+ #define NEW_RETURN(s) NEW_NODE(NODE_RETURN,s,0,0)
385
+ #define NEW_YIELD(a,s) NEW_NODE(NODE_YIELD,a,0,s)
386
+ #define NEW_LIST(a) NEW_ARRAY(a)
387
+ #define NEW_ARRAY(a) NEW_NODE(NODE_ARRAY,a,1,0)
388
+ #define NEW_ZARRAY() NEW_NODE(NODE_ZARRAY,0,0,0)
389
+ #define NEW_HASH(a) NEW_NODE(NODE_HASH,a,0,0)
390
+ #define NEW_MASGN(l,r) NEW_NODE(NODE_MASGN,l,0,r)
391
+ #define NEW_GASGN(v,val) NEW_NODE(NODE_GASGN,v,val,rb_global_entry(v))
392
+ #define NEW_LASGN(v,val) NEW_NODE(NODE_LASGN,v,val,0)
393
+ #define NEW_DASGN(v,val) NEW_NODE(NODE_DASGN,v,val,0)
394
+ #define NEW_DASGN_CURR(v,val) NEW_NODE(NODE_DASGN_CURR,v,val,0)
395
+ #define NEW_IASGN(v,val) NEW_NODE(NODE_IASGN,v,val,0)
396
+ #define NEW_IASGN2(v,val) NEW_NODE(NODE_IASGN2,v,val,0)
397
+ #define NEW_CDECL(v,val,path) NEW_NODE(NODE_CDECL,v,val,path)
398
+ #define NEW_CVASGN(v,val) NEW_NODE(NODE_CVASGN,v,val,0)
399
+ #define NEW_CVDECL(v,val) NEW_NODE(NODE_CVDECL,v,val,0)
400
+ #define NEW_OP_ASGN1(p,id,a) NEW_NODE(NODE_OP_ASGN1,p,id,a)
401
+ #define NEW_OP_ASGN2(r,i,o,val) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o))
402
+ #define NEW_OP_ASGN22(i,o) NEW_NODE(NODE_OP_ASGN2,i,o,rb_id_attrset(i))
403
+ #define NEW_OP_ASGN_OR(i,val) NEW_NODE(NODE_OP_ASGN_OR,i,val,0)
404
+ #define NEW_OP_ASGN_AND(i,val) NEW_NODE(NODE_OP_ASGN_AND,i,val,0)
405
+ #define NEW_GVAR(v) NEW_NODE(NODE_GVAR,v,0,rb_global_entry(v))
406
+ #define NEW_LVAR(v) NEW_NODE(NODE_LVAR,v,0,0)
407
+ #define NEW_DVAR(v) NEW_NODE(NODE_DVAR,v,0,0)
408
+ #define NEW_IVAR(v) NEW_NODE(NODE_IVAR,v,0,0)
409
+ #define NEW_CONST(v) NEW_NODE(NODE_CONST,v,0,0)
410
+ #define NEW_CVAR(v) NEW_NODE(NODE_CVAR,v,0,0)
411
+ #define NEW_NTH_REF(n) NEW_NODE(NODE_NTH_REF,0,n,0)
412
+ #define NEW_BACK_REF(n) NEW_NODE(NODE_BACK_REF,0,n,0)
413
+ #define NEW_MATCH(c) NEW_NODE(NODE_MATCH,c,0,0)
414
+ #define NEW_MATCH2(n1,n2) NEW_NODE(NODE_MATCH2,n1,n2,0)
415
+ #define NEW_MATCH3(r,n2) NEW_NODE(NODE_MATCH3,r,n2,0)
416
+ #define NEW_LIT(l) NEW_NODE(NODE_LIT,l,0,0)
417
+ #define NEW_STR(s) NEW_NODE(NODE_STR,s,0,0)
418
+ #define NEW_DSTR(s) NEW_NODE(NODE_DSTR,s,1,0)
419
+ #define NEW_XSTR(s) NEW_NODE(NODE_XSTR,s,0,0)
420
+ #define NEW_DXSTR(s) NEW_NODE(NODE_DXSTR,s,0,0)
421
+ #define NEW_DSYM(s) NEW_NODE(NODE_DSYM,s,0,0)
422
+ #define NEW_EVSTR(n) NEW_NODE(NODE_EVSTR,0,(n),0)
423
+ #define NEW_CALL(r,m,a) NEW_NODE(NODE_CALL,r,m,a)
424
+ #define NEW_FCALL(m,a) NEW_NODE(NODE_FCALL,0,m,a)
425
+ #define NEW_VCALL(m) NEW_NODE(NODE_VCALL,0,m,0)
426
+ #define NEW_SUPER(a) NEW_NODE(NODE_SUPER,0,0,a)
427
+ #define NEW_ZSUPER() NEW_NODE(NODE_ZSUPER,0,0,0)
428
+ #define NEW_ARGS(m,o) NEW_NODE(NODE_ARGS,o,m,0)
429
+ #define NEW_ARGS_AUX(r,b) NEW_NODE(NODE_ARGS_AUX,r,b,0)
430
+ #define NEW_OPT_ARG(i,v) NEW_NODE(NODE_OPT_ARG,i,v,0)
431
+ #define NEW_POSTARG(i,v) NEW_NODE(NODE_POSTARG,i,v,0)
432
+ #define NEW_ARGSCAT(a,b) NEW_NODE(NODE_ARGSCAT,a,b,0)
433
+ #define NEW_ARGSPUSH(a,b) NEW_NODE(NODE_ARGSPUSH,a,b,0)
434
+ #define NEW_SPLAT(a) NEW_NODE(NODE_SPLAT,a,0,0)
435
+ #define NEW_TO_ARY(a) NEW_NODE(NODE_TO_ARY,a,0,0)
436
+ #define NEW_BLOCK_ARG(v) NEW_NODE(NODE_BLOCK_ARG,v,0,local_cnt(v))
437
+ #define NEW_BLOCK_PASS(b) NEW_NODE(NODE_BLOCK_PASS,0,b,0)
438
+ #define NEW_ALIAS(n,o) NEW_NODE(NODE_ALIAS,n,o,0)
439
+ #define NEW_VALIAS(n,o) NEW_NODE(NODE_VALIAS,n,o,0)
440
+ #define NEW_UNDEF(i) NEW_NODE(NODE_UNDEF,0,i,0)
441
+ #define NEW_CLASS(n,b,s) NEW_NODE(NODE_CLASS,n,NEW_SCOPE(0,b),(s))
442
+ #define NEW_SCLASS(r,b) NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(0,b),0)
443
+ #define NEW_MODULE(n,b) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(0,b),0)
444
+ #define NEW_COLON2(c,i) NEW_NODE(NODE_COLON2,c,i,0)
445
+ #define NEW_COLON3(i) NEW_NODE(NODE_COLON3,0,i,0)
446
+ #define NEW_DOT2(b,e) NEW_NODE(NODE_DOT2,b,e,0)
447
+ #define NEW_DOT3(b,e) NEW_NODE(NODE_DOT3,b,e,0)
448
+ #define NEW_ATTRSET(a) NEW_NODE(NODE_ATTRSET,a,0,0)
449
+ #define NEW_SELF() NEW_NODE(NODE_SELF,0,0,0)
450
+ #define NEW_NIL() NEW_NODE(NODE_NIL,0,0,0)
451
+ #define NEW_TRUE() NEW_NODE(NODE_TRUE,0,0,0)
452
+ #define NEW_FALSE() NEW_NODE(NODE_FALSE,0,0,0)
453
+ #define NEW_ERRINFO() NEW_NODE(NODE_ERRINFO,0,0,0)
454
+ #define NEW_DEFINED(e) NEW_NODE(NODE_DEFINED,e,0,0)
455
+ #define NEW_PREEXE(b) NEW_SCOPE(b)
456
+ #define NEW_POSTEXE(b) NEW_NODE(NODE_POSTEXE,0,b,0)
457
+ #define NEW_BMETHOD(b) NEW_NODE(NODE_BMETHOD,0,0,b)
458
+ #define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
459
+ #define NEW_PRELUDE(p,b) NEW_NODE(NODE_PRELUDE,p,b,0)
460
+ #define NEW_OPTBLOCK(a) NEW_NODE(NODE_OPTBLOCK,a,0,0)
461
+
462
+ #define NOEX_PUBLIC 0x00
463
+ #define NOEX_NOSUPER 0x01
464
+ #define NOEX_PRIVATE 0x02
465
+ #define NOEX_PROTECTED 0x04
466
+ #define NOEX_MASK 0x06 /* 0110 */
467
+ #define NOEX_BASIC 0x08
468
+
469
+ #define NOEX_UNDEF NOEX_NOSUPER
470
+
471
+ #define NOEX_MODFUNC 0x10
472
+ #define NOEX_SUPER 0x20
473
+ #define NOEX_VCALL 0x40
474
+
475
+ #define NOEX_SAFE(n) (((n) >> 8) & 0x0F)
476
+ #define NOEX_WITH(n, s) ((s << 8) | (n) | (ruby_running ? 0 : NOEX_BASIC))
477
+ #define NOEX_WITH_SAFE(n) NOEX_WITH(n, rb_safe_level())
478
+
479
+ #define CALL_PUBLIC 0
480
+ #define CALL_FCALL 1
481
+ #define CALL_VCALL 2
482
+ #define CALL_SUPER 3
483
+
484
+ #define RUBY_VM_METHOD_NODE NODE_METHOD
485
+
486
+ VALUE rb_parser_new(void);
487
+ VALUE rb_parser_end_seen_p(VALUE);
488
+ VALUE rb_parser_encoding(VALUE);
489
+
490
+ NODE *rb_parser_compile_cstr(volatile VALUE, const char*, const char*, int, int);
491
+ NODE *rb_parser_compile_string(volatile VALUE, const char*, VALUE, int);
492
+ NODE *rb_parser_compile_file(volatile VALUE, const char*, VALUE, int);
493
+
494
+ NODE *rb_compile_cstr(const char*, const char*, int, int);
495
+ NODE *rb_compile_string(const char*, VALUE, int);
496
+ NODE *rb_compile_file(const char*, VALUE, int);
497
+
498
+ void rb_add_method(VALUE, ID, NODE *, int);
499
+ NODE *rb_node_newnode(enum node_type,VALUE,VALUE,VALUE);
500
+
501
+ NODE* rb_method_node(VALUE klass, ID id);
502
+ int rb_node_arity(NODE* node);
503
+
504
+ struct global_entry *rb_global_entry(ID);
505
+ VALUE rb_gvar_get(struct global_entry *);
506
+ VALUE rb_gvar_set(struct global_entry *, VALUE);
507
+ VALUE rb_gvar_defined(struct global_entry *);
508
+
509
+ #if defined(__cplusplus)
510
+ #if 0
511
+ { /* satisfy cc-mode */
512
+ #endif
513
+ } /* extern "C" { */
514
+ #endif
515
+
516
+ #endif /* RUBY_NODE_H */