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,30 @@
1
+ #ifndef nodeinfo_h
2
+ #define nodeinfo_h
3
+
4
+ #include "ruby_internal_node.h"
5
+
6
+ #include "ruby.h"
7
+
8
+ enum Node_Elem_Name
9
+ {
10
+ NEN_NONE,
11
+ #ruby <<END
12
+ require 'read_node_h.rb'
13
+
14
+ NODEINFO.sort.each do |node_elem_name, node_elem_ref|
15
+ puts " NEN_#{node_elem_name.upcase},"
16
+ end
17
+ nil
18
+ END
19
+ };
20
+
21
+ VALUE dump_node_elem(enum Node_Elem_Name nen, NODE * n, VALUE node_hash);
22
+ void load_node_elem(enum Node_Elem_Name nen, VALUE v, NODE * n, VALUE node_hash, VALUE id_hash);
23
+ VALUE node_s_members(VALUE klass);
24
+ void define_node_subclass_methods();
25
+
26
+ #define NODE_OP_ASGN2_ARG NODE_LAST + 1
27
+ #define NUM_NODE_TYPE_DESCRIPS NODE_OP_ASGN2_ARG + 1
28
+
29
+ #endif
30
+
@@ -0,0 +1,78 @@
1
+ require 'yaml'
2
+
3
+ class NodeVersionRange
4
+ def initialize(str)
5
+ if not str or str =~ /^\s*$/ then
6
+ @inclusive_start = true
7
+ @range_start = 0
8
+ @range_end = 1.0 / 0
9
+ @inclusive_end = true
10
+ elsif str =~ / ([\[(]) (.*?), \s* (.*?) ([\])]) /x then
11
+ @inclusive_start = $1 == '['
12
+ @range_start = $2.to_i
13
+ @range_end = $3 == 'oo' ? (1.0 / 0) : $3.to_i
14
+ @inclusive_end = $4 == ']'
15
+ else
16
+ raise "Invalid version range: #{str}"
17
+ end
18
+ end
19
+
20
+ def includes?(version_code)
21
+ if @inclusive_start then
22
+ return false if version_code < @range_start
23
+ else
24
+ return false if version_code <= @range_start
25
+ end
26
+
27
+ if @inclusive_end then
28
+ return false if version_code > @range_end
29
+ else
30
+ return false if version_code >= @range_end
31
+ end
32
+
33
+ return true
34
+ end
35
+ end
36
+
37
+ class Nodes
38
+ NodeInfo = Struct.new(:name, :doc, :members, :version_range)
39
+ MemberInfo = Struct.new(:doc, :type)
40
+
41
+ def initialize(filename = nil)
42
+ if not filename then
43
+ dir = File.dirname(__FILE__)
44
+ filename = File.join(dir, 'nodes.yaml')
45
+ end
46
+ nodes = File.open(filename) { |io| YAML.load(io) }
47
+
48
+ @nodes = {}
49
+ nodes.each do |name, node|
50
+ members = {}
51
+ (node['members'] || {}).each do |member_name, member|
52
+ member ||= {}
53
+ members[member_name] = MemberInfo.new(
54
+ member['doc'],
55
+ member['type'])
56
+ end
57
+ version_range = NodeVersionRange.new(node['version'])
58
+ @nodes[name] = NodeInfo.new(
59
+ name.gsub(/\(.*\)/, ''),
60
+ node['doc'],
61
+ members,
62
+ version_range)
63
+ end
64
+ end
65
+
66
+ def each(&block)
67
+ @nodes.each(&block)
68
+ end
69
+
70
+ def [](name)
71
+ @nodes[name]
72
+ end
73
+
74
+ def include?(name)
75
+ @nodes.include?(name)
76
+ end
77
+ end
78
+
@@ -0,0 +1,34 @@
1
+ $: << '../..'
2
+ require 'ruby_source_dir'
3
+
4
+ NODE_H_LOCATION = "#{RUBY_INCLUDE_DIR}/node.h"
5
+ NODE_H_ALT_LOCATION = "#{RUBY_SOURCE_DIR}/node.h"
6
+
7
+ def open_alt(*files, &block)
8
+ last_exc = nil
9
+ files.each do |file|
10
+ begin
11
+ File.open(file, &block)
12
+ return
13
+ rescue Errno::ENOENT
14
+ last_exc = $!
15
+ end
16
+ end
17
+ raise last_exc
18
+ end
19
+
20
+ NODEINFO = Hash.new
21
+ open_alt(NODE_H_LOCATION, NODE_H_ALT_LOCATION) do |node_h|
22
+ while line = node_h.gets do
23
+ case line
24
+ when /^#define\s+nd_(\w+)\s+(.*)/
25
+ NODEINFO[$1] = $2
26
+ end
27
+ end
28
+ end
29
+
30
+ if __FILE__ == $0 then
31
+ require 'pp'
32
+ pp NODEINFO
33
+ end
34
+
@@ -0,0 +1,31 @@
1
+ #ifndef ruby_internal_node__h_
2
+ #define ruby_internal_node__h_
3
+
4
+ #include <ruby.h>
5
+
6
+ #if defined(HAVE_NODE_H)
7
+ #include "node.h"
8
+ #elif defined(HAVE_RUBY_NODE_H)
9
+ #include "ruby/node.h"
10
+ #endif
11
+
12
+ VALUE wrap_node(NODE * n);
13
+ VALUE wrap_node_as(NODE * n, VALUE klass);
14
+
15
+ NODE * unwrap_node(VALUE r);
16
+
17
+ VALUE node_id(NODE * n);
18
+ NODE * id_to_node(VALUE id);
19
+
20
+ VALUE eval_ruby_node(NODE * node, VALUE self, VALUE cref);
21
+
22
+ void dump_node_or_iseq_to_hash(VALUE n, int node_type, VALUE node_hash);
23
+ VALUE load_node_or_iseq_from_hash(VALUE node_id, VALUE node_hash, VALUE id_hash);
24
+
25
+ void dump_node_to_hash(NODE * n, int node_type, VALUE node_hash);
26
+ NODE * load_node_from_hash(VALUE arr, VALUE orig_node_id, VALUE node_hash, VALUE id_hash);
27
+
28
+ extern VALUE rb_cNodeSubclass[NODE_LAST];
29
+
30
+ #endif
31
+
@@ -0,0 +1,6 @@
1
+ $: << '../..'
2
+ require 'mkmf-ruby-internal'
3
+
4
+ have_header('ruby/node.h') or have_header('node.h')
5
+
6
+ create_ruby_internal_makefile 'internal/noex/noex'
@@ -0,0 +1,44 @@
1
+ #include <ruby.h>
2
+
3
+ #include "internal/node/ruby_internal_node.h"
4
+
5
+ void Init_noex(void)
6
+ {
7
+ /*
8
+ * Document-module: Noex
9
+ *
10
+ * The Noex module contains all the Noex constants from node.h. These
11
+ * constants can be passed to Module#add_method as modifiers to the
12
+ * method being added.
13
+ *
14
+ * [+PUBLIC+] Method is public.
15
+ * [+UNDEF+] Method is undefined.
16
+ * [+PRIVATE+] Method is private.
17
+ * [+PROTECTED+] Method is protected.
18
+ *
19
+ * The following are available in Ruby 1.8 and below:
20
+ * [+CFUNC+] Method is a C function.
21
+ *
22
+ * And these are available in Ruby 1.9 and above:
23
+ * [+NOSUPER+] ???
24
+ * [+MASK+] ???
25
+ */
26
+ VALUE rb_mNoex = rb_define_module("Noex");
27
+ rb_define_const(rb_mNoex, "PUBLIC", INT2NUM(NOEX_PUBLIC));
28
+ rb_define_const(rb_mNoex, "UNDEF", INT2NUM(NOEX_UNDEF));
29
+ rb_define_const(rb_mNoex, "PRIVATE", INT2NUM(NOEX_PRIVATE));
30
+ rb_define_const(rb_mNoex, "PROTECTED", INT2NUM(NOEX_PROTECTED));
31
+
32
+ #ifdef NOEX_CFUNC
33
+ rb_define_const(rb_mNoex, "CFUNC", INT2NUM(NOEX_CFUNC));
34
+ #endif
35
+
36
+ #ifdef NOEX_NOSUPER
37
+ rb_define_const(rb_mNoex, "NOSUPER", INT2NUM(NOEX_NOSUPER));
38
+ #endif
39
+
40
+ #ifdef NOEX_MASK
41
+ rb_define_const(rb_mNoex, "MASK", INT2NUM(NOEX_MASK));
42
+ #endif
43
+ }
44
+
@@ -0,0 +1,4 @@
1
+ $: << '../..'
2
+ require 'mkmf-ruby-internal'
3
+
4
+ create_ruby_internal_makefile 'internal/object/object'
@@ -0,0 +1,75 @@
1
+ #include <ruby.h>
2
+
3
+ /*
4
+ * call-seq:
5
+ * class.real_class => Class
6
+ *
7
+ * Return the object's first immediate ancestor; this may be the
8
+ * object's class, its singleton class, or a module singleton.
9
+ */
10
+ static VALUE real_class(VALUE self)
11
+ {
12
+ if(IMMEDIATE_P(self))
13
+ {
14
+ return CLASS_OF(self);
15
+ }
16
+ else
17
+ {
18
+ return RBASIC(self)->klass;
19
+ }
20
+ }
21
+
22
+ /*
23
+ * call-seq:
24
+ * class.singleton? => true or false
25
+ *
26
+ * Return true if this object is a singleton (that is, it has the
27
+ * FL_SINGLETON flag set).
28
+ */
29
+ static VALUE is_singleton(VALUE self)
30
+ {
31
+ return FL_TEST(self, FL_SINGLETON) ? Qtrue : Qfalse;
32
+ }
33
+
34
+ /*
35
+ * call-seq:
36
+ * class.has_singleton? => true or false
37
+ *
38
+ * Return true if this object has a singleton class.
39
+ */
40
+ static VALUE has_singleton(VALUE self)
41
+ {
42
+ if(FIXNUM_P(self) || SYMBOL_P(self))
43
+ {
44
+ return Qfalse;
45
+ }
46
+ else if(rb_special_const_p(self))
47
+ {
48
+ return Qtrue;
49
+ }
50
+ else
51
+ {
52
+ return FL_TEST(RBASIC(self)->klass, FL_SINGLETON) ? Qtrue : Qfalse;
53
+ }
54
+ }
55
+
56
+ /*
57
+ * call-seq:
58
+ * class.singleton_class => Class
59
+ *
60
+ * Return the object's singleton class. Creats a new singleton class
61
+ * for the object if it does not have one. See RCR#231.
62
+ */
63
+ static VALUE singleton_class(VALUE self)
64
+ {
65
+ return rb_singleton_class(self);
66
+ }
67
+
68
+ void Init_object(void)
69
+ {
70
+ rb_define_method(rb_mKernel, "real_class", real_class, 0);
71
+ rb_define_method(rb_mKernel, "singleton?", is_singleton, 0);
72
+ rb_define_method(rb_mKernel, "has_singleton?", has_singleton, 0);
73
+ rb_define_method(rb_mKernel, "singleton_class", singleton_class, 0);
74
+ }
75
+
@@ -0,0 +1,44 @@
1
+ #ifndef ruby_internal_block__h_
2
+ #define ruby_internal_block__h_
3
+
4
+ #include <ruby.h>
5
+
6
+ #ifndef RUBY_VM
7
+ #include "env.h"
8
+ #endif
9
+
10
+ #ruby <<END
11
+ $: << '../..'
12
+ require 'ruby_source_dir'
13
+ vm_c_location = "#{RUBY_SOURCE_DIR}/vm.c"
14
+ eval_c_location = "#{RUBY_SOURCE_DIR}/eval.c"
15
+
16
+ [ vm_c_location, eval_c_location ].each do |file|
17
+ next if not File.exist?(file)
18
+
19
+ File.open(file) do |eval_c|
20
+ write = false
21
+ stopwrite = false
22
+ while (line = eval_c.gets) != nil do
23
+ case line
24
+ when /^struct (BLOCK)/
25
+ write = true
26
+ stopwrite = false
27
+ when /^\}/
28
+ stopwrite = true
29
+ end
30
+ puts line if write
31
+ if write and stopwrite then
32
+ stopwrite = false
33
+ write = false
34
+ puts ''
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ nil
41
+ END
42
+
43
+ #endif
44
+
@@ -0,0 +1,9 @@
1
+ $: << '../..'
2
+ require 'mkmf-ruby-internal'
3
+
4
+ have_header('iseq.h')
5
+
6
+ have_header('ruby/node.h') or have_header('node.h')
7
+
8
+ create_ruby_internal_makefile 'internal/proc/proc'
9
+
@@ -0,0 +1,331 @@
1
+ #include <ruby.h>
2
+ #include "internal/node/ruby_internal_node.h"
3
+ #include "block.h"
4
+
5
+ #ifdef RUBY_VM
6
+ #include "vm_core.h"
7
+ #endif
8
+
9
+ #ifdef HAVE_ISEQ_H
10
+ #include "iseq.h"
11
+ #endif
12
+
13
+ #ifndef RARRAY_LEN
14
+ #define RARRAY_LEN(a) RARRAY(a)->len
15
+ #endif
16
+
17
+ #ifndef RARRAY_PTR
18
+ #define RARRAY_PTR(a) RARRAY(a)->ptr
19
+ #endif
20
+
21
+ static VALUE rb_cUnboundProc = Qnil;
22
+
23
+ static VALUE rb_mMarshal;
24
+
25
+ static VALUE marshal_dump(VALUE obj, VALUE limit)
26
+ {
27
+ return rb_funcall(rb_mMarshal, rb_intern("dump"), 2, obj, limit);
28
+ }
29
+
30
+ static VALUE marshal_load(VALUE obj)
31
+ {
32
+ return rb_funcall(rb_mMarshal, rb_intern("load"), 1, obj);
33
+ }
34
+
35
+ /*
36
+ * call-seq:
37
+ * proc.body => Node
38
+ *
39
+ * Returns the Proc's body Node.
40
+ *
41
+ * On YARV, this will return the instruction sequence for the proc's
42
+ * block.
43
+ */
44
+ static VALUE proc_body(VALUE self)
45
+ {
46
+ #ifdef RUBY_VM
47
+ rb_proc_t * p;
48
+ GetProcPtr(self, p);
49
+ return p->block.iseq->self;
50
+ #else
51
+ struct BLOCK * b;
52
+ if(rb_safe_level() >= 4)
53
+ {
54
+ /* no access to potentially sensitive data from the sandbox */
55
+ rb_raise(rb_eSecurityError, "Insecure: can't get proc body");
56
+ }
57
+ Data_Get_Struct(self, struct BLOCK, b);
58
+ return wrap_node(b->body);
59
+ #endif
60
+ }
61
+
62
+ #ifndef RUBY_VM
63
+ /*
64
+ * call-seq:
65
+ * proc.var => Node
66
+ *
67
+ * Returns the Proc's argument Node.
68
+ *
69
+ * This method is undefined on YARV.
70
+ */
71
+ static VALUE proc_var(VALUE self)
72
+ {
73
+ struct BLOCK * b;
74
+ if(rb_safe_level() >= 4)
75
+ {
76
+ /* no access to potentially sensitive data from the sandbox */
77
+ rb_raise(rb_eSecurityError, "Insecure: can't get proc var");
78
+ }
79
+ Data_Get_Struct(self, struct BLOCK, b);
80
+ if(b->var == (NODE*)1)
81
+ {
82
+ /* no parameter || */
83
+ return INT2NUM(1);
84
+ }
85
+ else if(b->var == (NODE*)2)
86
+ {
87
+ /* also no params, but I'm not sure how this one gets generated */
88
+ return INT2NUM(2);
89
+ }
90
+ else
91
+ {
92
+ return wrap_node(b->var);
93
+ }
94
+ }
95
+
96
+ #else
97
+
98
+ /* From iseq.c */
99
+ static rb_iseq_t *
100
+ iseq_check(VALUE val)
101
+ {
102
+ rb_iseq_t *iseq;
103
+ if(!rb_obj_is_kind_of(val, rb_cISeq))
104
+ {
105
+ rb_raise(
106
+ rb_eTypeError,
107
+ "Expected VM::InstructionSequence, but got %s",
108
+ rb_class2name(CLASS_OF(val)));
109
+ }
110
+ GetISeqPtr(val, iseq);
111
+ if (!iseq->name) {
112
+ rb_raise(rb_eTypeError, "uninitialized InstructionSequence");
113
+ }
114
+ return iseq;
115
+ }
116
+
117
+ #endif
118
+
119
+ /*
120
+ * call-seq:
121
+ * proc.dump(limit) => String
122
+ *
123
+ * Dump a Proc to a String.
124
+ */
125
+ static VALUE proc_dump(VALUE self, VALUE limit)
126
+ {
127
+ if(rb_safe_level() >= 4)
128
+ {
129
+ /* no access to potentially sensitive data from the sandbox */
130
+ rb_raise(rb_eSecurityError, "Insecure: can't dump proc");
131
+ }
132
+
133
+ {
134
+ #ifdef RUBY_VM
135
+ rb_proc_t * p;
136
+ VALUE iseq;
137
+ rb_iseq_t * iseqdat;
138
+ GetProcPtr(self, p);
139
+ iseq = p->block.iseq->self;
140
+ iseqdat = iseq_check(iseq);
141
+ iseqdat->type = ISEQ_TYPE_TOP; /* TODO: is this right? */
142
+ VALUE str = marshal_dump(iseq, limit);
143
+ return str;
144
+ #else
145
+ struct BLOCK * b;
146
+ VALUE body, var, arr;
147
+
148
+ Data_Get_Struct(self, struct BLOCK, b);
149
+ body = wrap_node(b->body);
150
+ var = wrap_node(b->var);
151
+ arr = rb_assoc_new(body, var);
152
+ return marshal_dump(arr, limit);
153
+ #endif
154
+ }
155
+ }
156
+
157
+ #ifdef RUBY_VM
158
+
159
+ static VALUE create_proc(VALUE klass, VALUE binding, rb_iseq_t * iseq)
160
+ {
161
+ VALUE new_proc;
162
+ rb_proc_t * p;
163
+
164
+ if(binding == Qnil)
165
+ {
166
+ binding = rb_binding_new();
167
+ }
168
+ new_proc = rb_funcall(
169
+ rb_cObject, rb_intern("eval"), 2, rb_str_new2("proc { }"), binding);
170
+ GetProcPtr(new_proc, p);
171
+ p->block.iseq = iseq;
172
+ RBASIC(new_proc)->klass = klass;
173
+ return new_proc;
174
+ }
175
+
176
+ #else
177
+
178
+ static VALUE create_proc(VALUE klass, VALUE binding, NODE * body, NODE * var)
179
+ {
180
+ /* Calling eval will do a security check */
181
+ VALUE new_proc = rb_funcall(
182
+ rb_cObject, rb_intern("eval"), 2, rb_str_new2("proc { }"), binding);
183
+ struct BLOCK * b;
184
+ Data_Get_Struct(new_proc, struct BLOCK, b);
185
+ b->body = body;
186
+ b->var = var;
187
+ RBASIC(new_proc)->klass = klass;
188
+ return new_proc;
189
+ }
190
+
191
+ #endif
192
+
193
+ /*
194
+ * call-seq:
195
+ * Proc.load(str) => UnboundProc
196
+ *
197
+ * Load a Proc from a String. When it is loaded, it will be an
198
+ * UnboundProc, until it is bound to a Binding with UnboundProc#bind.
199
+ */
200
+ static VALUE proc_load(VALUE klass, VALUE str)
201
+ {
202
+ #ifdef RUBY_VM
203
+ VALUE iseq = marshal_load(str);
204
+ return create_proc(rb_cUnboundProc, Qnil, iseq_check(iseq));
205
+ #else
206
+ VALUE arr = marshal_load(str);
207
+ NODE * body, * var;
208
+
209
+ if( rb_safe_level() >= 4
210
+ || (rb_safe_level() >= 1 && OBJ_TAINTED(str)))
211
+ {
212
+ /* no playing with knives in the sandbox */
213
+ rb_raise(rb_eSecurityError, "Insecure: can't load proc");
214
+ }
215
+
216
+ Check_Type(arr, T_ARRAY);
217
+ body = unwrap_node(RARRAY_PTR(arr)[0]);
218
+ var = unwrap_node(RARRAY_PTR(arr)[1]);
219
+ return create_proc(rb_cUnboundProc, Qnil, body, var);
220
+ #endif
221
+ }
222
+
223
+ /*
224
+ * call-seq:
225
+ * proc.unbind => UnboundProc
226
+ *
227
+ * Create an UnboundProc from a Proc.
228
+ */
229
+ static VALUE proc_unbind(VALUE self)
230
+ {
231
+ #ifdef RUBY_VM
232
+ rb_proc_t * p;
233
+ GetProcPtr(self, p);
234
+ return create_proc(rb_cUnboundProc, Qnil, p->block.iseq);
235
+ #else
236
+ struct BLOCK * b;
237
+ Data_Get_Struct(self, struct BLOCK, b);
238
+ /* no need for a security check to unbind a proc -- though without the
239
+ * ability to bind, this doesn't seem very useful.
240
+ */
241
+ return create_proc(rb_cUnboundProc, Qnil, b->body, b->var);
242
+ #endif
243
+ }
244
+
245
+ /*
246
+ * call-seq:
247
+ * proc.push(anotherProc) => self
248
+ *
249
+ * Append the body of anotherProc onto proc.
250
+ */
251
+ static VALUE proc_push(VALUE self, VALUE other)
252
+ {
253
+ #ifdef RUBY_VM
254
+ rb_raise(rb_eRuntimeError, "Proc#push not implemented yet for YARV");
255
+ #else
256
+ struct BLOCK * b1;
257
+ struct BLOCK * b2;
258
+ Data_Get_Struct(self, struct BLOCK, b1);
259
+ Data_Get_Struct(other, struct BLOCK, b2);
260
+ b1->body = NEW_NODE(NODE_BLOCK, b1->body, 0, b2->body);
261
+ return self;
262
+ #endif
263
+ }
264
+
265
+ /*
266
+ * call-seq:
267
+ * unbound_proc.bind(Binding) => Proc
268
+ *
269
+ * Bind an UnboundProc to a Binding. Returns a Proc that has been bound
270
+ * to the given binding.
271
+ */
272
+ static VALUE unboundproc_bind(VALUE self, VALUE binding)
273
+ {
274
+ #ifdef RUBY_VM
275
+ rb_proc_t * p;
276
+ GetProcPtr(self, p);
277
+ return create_proc(rb_cProc, binding, p->block.iseq);
278
+ #else
279
+ struct BLOCK * b;
280
+ Data_Get_Struct(self, struct BLOCK, b);
281
+ /* create_proc will do a security check */
282
+ return create_proc(rb_cProc, binding, b->body, b->var);
283
+ #endif
284
+ }
285
+
286
+ /*
287
+ * call-seq:
288
+ * unbound_proc.call => raises TypeError
289
+ *
290
+ * Raises a TypeError; UnboundProc objects cannot be called.
291
+ */
292
+ static VALUE unboundproc_call(VALUE self, VALUE args)
293
+ {
294
+ rb_raise(rb_eTypeError, "you cannot call unbound proc; bind first");
295
+ }
296
+
297
+ /*
298
+ * call-seq:
299
+ * unbound_proc.binding => raises TypeError
300
+ *
301
+ * Raises a TypeError; UnboundProc objects have no binding.
302
+ */
303
+ static VALUE unboundproc_binding(VALUE self)
304
+ {
305
+ rb_raise(rb_eTypeError, "unbound proc has no binding");
306
+ }
307
+
308
+ void Init_proc(void)
309
+ {
310
+ rb_require("internal/node");
311
+
312
+ rb_mMarshal = rb_const_get(rb_cObject, rb_intern("Marshal"));
313
+
314
+ /* For rdoc: rb_cProc = rb_define_class("Proc", rb_cObject) */
315
+ rb_define_method(rb_cProc, "body", proc_body, 0);
316
+ #ifndef RUBY_VM
317
+ rb_define_method(rb_cProc, "var", proc_var, 0);
318
+ #endif
319
+ rb_define_method(rb_cProc, "unbind", proc_unbind, 0);
320
+ rb_define_method(rb_cProc, "<<", proc_push, 1);
321
+ rb_define_method(rb_cProc, "push", proc_push, 1);
322
+ rb_define_method(rb_cProc, "_dump", proc_dump, 1);
323
+ rb_define_singleton_method(rb_cProc, "_load", proc_load, 1);
324
+
325
+ rb_cUnboundProc = rb_define_class("UnboundProc", rb_cProc);
326
+ rb_define_method(rb_cUnboundProc, "bind", unboundproc_bind, 1);
327
+ rb_define_method(rb_cUnboundProc, "call", unboundproc_call, -2);
328
+ rb_define_method(rb_cUnboundProc, "[]", unboundproc_call, -2);
329
+ rb_define_method(rb_cUnboundProc, "binding", unboundproc_binding, 0);
330
+ }
331
+