ruby-internal 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +59 -0
- data/LGPL +515 -0
- data/LICENSE +9 -0
- data/README +31 -0
- data/Rakefile +20 -0
- data/TODO +9 -0
- data/example/README +5 -0
- data/example/simple_client.rb +12 -0
- data/example/simple_server.rb +11 -0
- data/example/triangle_client.rb +7 -0
- data/example/triangle_server.rb +24 -0
- data/ext/cached/ruby-1.8.0/internal/binding/block.h +37 -0
- data/ext/cached/ruby-1.8.0/internal/method/method.h +19 -0
- data/ext/cached/ruby-1.8.0/internal/module/classpath.c +27 -0
- data/ext/cached/ruby-1.8.0/internal/module/classpath.h +14 -0
- data/ext/cached/ruby-1.8.0/internal/node/block.h +37 -0
- data/ext/cached/ruby-1.8.0/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.0/internal/node/node_type_descrip.c +155 -0
- data/ext/cached/ruby-1.8.0/internal/node/nodeinfo.c +5741 -0
- data/ext/cached/ruby-1.8.0/internal/node/nodeinfo.h +69 -0
- data/ext/cached/ruby-1.8.0/internal/proc/block.h +37 -0
- data/ext/cached/ruby-1.8.0/internal/tag/tag.h +15 -0
- data/ext/cached/ruby-1.8.0/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.0/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.0/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.8.1/internal/binding/block.h +31 -0
- data/ext/cached/ruby-1.8.1/internal/method/method.h +19 -0
- data/ext/cached/ruby-1.8.1/internal/module/classpath.c +27 -0
- data/ext/cached/ruby-1.8.1/internal/module/classpath.h +14 -0
- data/ext/cached/ruby-1.8.1/internal/node/block.h +31 -0
- data/ext/cached/ruby-1.8.1/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.1/internal/node/node_type_descrip.c +154 -0
- data/ext/cached/ruby-1.8.1/internal/node/nodeinfo.c +5733 -0
- data/ext/cached/ruby-1.8.1/internal/node/nodeinfo.h +69 -0
- data/ext/cached/ruby-1.8.1/internal/proc/block.h +31 -0
- data/ext/cached/ruby-1.8.1/internal/tag/tag.h +16 -0
- data/ext/cached/ruby-1.8.1/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.1/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.1/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.8.2/internal/binding/block.h +32 -0
- data/ext/cached/ruby-1.8.2/internal/method/method.h +19 -0
- data/ext/cached/ruby-1.8.2/internal/module/classpath.c +45 -0
- data/ext/cached/ruby-1.8.2/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.8.2/internal/node/block.h +32 -0
- data/ext/cached/ruby-1.8.2/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.2/internal/node/node_type_descrip.c +154 -0
- data/ext/cached/ruby-1.8.2/internal/node/nodeinfo.c +5733 -0
- data/ext/cached/ruby-1.8.2/internal/node/nodeinfo.h +69 -0
- data/ext/cached/ruby-1.8.2/internal/proc/block.h +32 -0
- data/ext/cached/ruby-1.8.2/internal/tag/tag.h +16 -0
- data/ext/cached/ruby-1.8.2/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.2/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.2/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.8.3/internal/binding/block.h +32 -0
- data/ext/cached/ruby-1.8.3/internal/method/method.h +20 -0
- data/ext/cached/ruby-1.8.3/internal/module/classpath.c +45 -0
- data/ext/cached/ruby-1.8.3/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.8.3/internal/node/block.h +32 -0
- data/ext/cached/ruby-1.8.3/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.3/internal/node/node_type_descrip.c +154 -0
- data/ext/cached/ruby-1.8.3/internal/node/nodeinfo.c +5733 -0
- data/ext/cached/ruby-1.8.3/internal/node/nodeinfo.h +69 -0
- data/ext/cached/ruby-1.8.3/internal/proc/block.h +32 -0
- data/ext/cached/ruby-1.8.3/internal/tag/tag.h +16 -0
- data/ext/cached/ruby-1.8.3/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.3/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.3/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.8.4/internal/binding/block.h +32 -0
- data/ext/cached/ruby-1.8.4/internal/method/method.h +20 -0
- data/ext/cached/ruby-1.8.4/internal/module/classpath.c +45 -0
- data/ext/cached/ruby-1.8.4/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.8.4/internal/node/block.h +32 -0
- data/ext/cached/ruby-1.8.4/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.4/internal/node/node_type_descrip.c +154 -0
- data/ext/cached/ruby-1.8.4/internal/node/nodeinfo.c +5733 -0
- data/ext/cached/ruby-1.8.4/internal/node/nodeinfo.h +69 -0
- data/ext/cached/ruby-1.8.4/internal/proc/block.h +32 -0
- data/ext/cached/ruby-1.8.4/internal/tag/tag.h +16 -0
- data/ext/cached/ruby-1.8.4/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.4/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.4/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.8.5/internal/binding/block.h +32 -0
- data/ext/cached/ruby-1.8.5/internal/method/method.h +20 -0
- data/ext/cached/ruby-1.8.5/internal/module/classpath.c +45 -0
- data/ext/cached/ruby-1.8.5/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.8.5/internal/node/block.h +32 -0
- data/ext/cached/ruby-1.8.5/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.5/internal/node/node_type_descrip.c +154 -0
- data/ext/cached/ruby-1.8.5/internal/node/nodeinfo.c +5732 -0
- data/ext/cached/ruby-1.8.5/internal/node/nodeinfo.h +67 -0
- data/ext/cached/ruby-1.8.5/internal/proc/block.h +32 -0
- data/ext/cached/ruby-1.8.5/internal/tag/tag.h +16 -0
- data/ext/cached/ruby-1.8.5/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.5/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.5/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.8.6/internal/binding/block.h +32 -0
- data/ext/cached/ruby-1.8.6/internal/method/method.h +20 -0
- data/ext/cached/ruby-1.8.6/internal/module/classpath.c +45 -0
- data/ext/cached/ruby-1.8.6/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.8.6/internal/node/block.h +32 -0
- data/ext/cached/ruby-1.8.6/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.6/internal/node/node_type_descrip.c +154 -0
- data/ext/cached/ruby-1.8.6/internal/node/nodeinfo.c +5732 -0
- data/ext/cached/ruby-1.8.6/internal/node/nodeinfo.h +67 -0
- data/ext/cached/ruby-1.8.6/internal/proc/block.h +32 -0
- data/ext/cached/ruby-1.8.6/internal/tag/tag.h +16 -0
- data/ext/cached/ruby-1.8.6/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.6/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.6/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.8.7/internal/binding/block.h +32 -0
- data/ext/cached/ruby-1.8.7/internal/method/method.h +20 -0
- data/ext/cached/ruby-1.8.7/internal/module/classpath.c +45 -0
- data/ext/cached/ruby-1.8.7/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.8.7/internal/node/block.h +32 -0
- data/ext/cached/ruby-1.8.7/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.7/internal/node/node_type_descrip.c +154 -0
- data/ext/cached/ruby-1.8.7/internal/node/nodeinfo.c +5732 -0
- data/ext/cached/ruby-1.8.7/internal/node/nodeinfo.h +67 -0
- data/ext/cached/ruby-1.8.7/internal/proc/block.h +32 -0
- data/ext/cached/ruby-1.8.7/internal/tag/tag.h +16 -0
- data/ext/cached/ruby-1.8.7/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.7/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.7/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.9.0/internal/binding/block.h +12 -0
- data/ext/cached/ruby-1.9.0/internal/method/method.h +20 -0
- data/ext/cached/ruby-1.9.0/internal/module/classpath.c +42 -0
- data/ext/cached/ruby-1.9.0/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.9.0/internal/node/block.h +12 -0
- data/ext/cached/ruby-1.9.0/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.9.0/internal/node/node_type_descrip.c +149 -0
- data/ext/cached/ruby-1.9.0/internal/node/nodeinfo.c +5579 -0
- data/ext/cached/ruby-1.9.0/internal/node/nodeinfo.h +70 -0
- data/ext/cached/ruby-1.9.0/internal/proc/block.h +12 -0
- data/ext/cached/ruby-1.9.0/internal/tag/tag.h +6 -0
- data/ext/cached/ruby-1.9.0/internal/vm/instruction/insns_info.c +5936 -0
- data/ext/cached/ruby-1.9.0/internal/vm/instruction/insns_info.h +891 -0
- data/ext/cached/ruby-1.9.0/internal/vm/iseq/insns_info.inc +700 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/debug.h +36 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/dln.h +41 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/encdb.h +147 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/eval_intern.h +221 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/gc.h +75 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/id.h +83 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/iseq.h +94 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/node.h +516 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/parse.h +303 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/regenc.h +207 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/regint.h +842 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/regparse.h +351 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/revision.h +1 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/thread_pthread.h +24 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/thread_win32.h +33 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/transcode_data.h +99 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/transdb.h +67 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/version.h +57 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_core.h +663 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_exec.h +187 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_insnhelper.h +191 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_opts.h +51 -0
- data/ext/cached/ruby-1.9.1/internal/binding/block.h +12 -0
- data/ext/cached/ruby-1.9.1/internal/method/method.h +20 -0
- data/ext/cached/ruby-1.9.1/internal/module/classpath.c +42 -0
- data/ext/cached/ruby-1.9.1/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.9.1/internal/node/block.h +12 -0
- data/ext/cached/ruby-1.9.1/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.9.1/internal/node/node_type_descrip.c +149 -0
- data/ext/cached/ruby-1.9.1/internal/node/nodeinfo.c +5579 -0
- data/ext/cached/ruby-1.9.1/internal/node/nodeinfo.h +70 -0
- data/ext/cached/ruby-1.9.1/internal/proc/block.h +12 -0
- data/ext/cached/ruby-1.9.1/internal/tag/tag.h +6 -0
- data/ext/cached/ruby-1.9.1/internal/vm/instruction/insns_info.c +5936 -0
- data/ext/cached/ruby-1.9.1/internal/vm/instruction/insns_info.h +891 -0
- data/ext/cached/ruby-1.9.1/internal/vm/iseq/insns_info.inc +700 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/debug.h +36 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/dln.h +41 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/encdb.h +147 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/eval_intern.h +209 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/gc.h +75 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/id.h +184 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/iseq.h +94 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/node.h +516 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/parse.h +303 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/regenc.h +207 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/regint.h +842 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/regparse.h +351 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/revision.h +1 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/thread_pthread.h +24 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/thread_win32.h +33 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/transcode_data.h +99 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/transdb.h +85 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/version.h +60 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_core.h +655 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_exec.h +187 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_insnhelper.h +194 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_opts.h +51 -0
- data/ext/internal/binding/binding.c +45 -0
- data/ext/internal/binding/block.h.rpp +44 -0
- data/ext/internal/binding/extconf.rb +6 -0
- data/ext/internal/method/extconf.rb +8 -0
- data/ext/internal/method/method.c +269 -0
- data/ext/internal/method/method.h.rpp +58 -0
- data/ext/internal/module/classpath.c.rpp +29 -0
- data/ext/internal/module/classpath.h.rpp +36 -0
- data/ext/internal/module/extconf.rb +11 -0
- data/ext/internal/module/module.c +797 -0
- data/ext/internal/module/module.h +7 -0
- data/ext/internal/node/block.h.rpp +44 -0
- data/ext/internal/node/builtins.h +41 -0
- data/ext/internal/node/extconf.rb +66 -0
- data/ext/internal/node/global_entry.h.rpp +26 -0
- data/ext/internal/node/node.c +1147 -0
- data/ext/internal/node/node_type_descrip.c.rpp +72 -0
- data/ext/internal/node/node_type_descrip.h +17 -0
- data/ext/internal/node/node_type_descrip.rb +39 -0
- data/ext/internal/node/nodeinfo.c.rpp +587 -0
- data/ext/internal/node/nodeinfo.h.rpp +30 -0
- data/ext/internal/node/nodes.rb +78 -0
- data/ext/internal/node/read_node_h.rb +34 -0
- data/ext/internal/node/ruby_internal_node.h +31 -0
- data/ext/internal/noex/extconf.rb +6 -0
- data/ext/internal/noex/noex.c +44 -0
- data/ext/internal/object/extconf.rb +4 -0
- data/ext/internal/object/object.c +75 -0
- data/ext/internal/proc/block.h.rpp +44 -0
- data/ext/internal/proc/extconf.rb +9 -0
- data/ext/internal/proc/proc.c +331 -0
- data/ext/internal/tag/extconf.rb +3 -0
- data/ext/internal/tag/tag.c +17 -0
- data/ext/internal/tag/tag.h.rpp +22 -0
- data/ext/internal/thread/extconf.rb +3 -0
- data/ext/internal/thread/thread.c +107 -0
- data/ext/internal/vm/constants/constants.c +33 -0
- data/ext/internal/vm/constants/extconf.rb +3 -0
- data/ext/internal/vm/control_frame/control_frame.c +185 -0
- data/ext/internal/vm/control_frame/control_frame.h +18 -0
- data/ext/internal/vm/control_frame/extconf.rb +3 -0
- data/ext/internal/vm/extconf.rb +3 -0
- data/ext/internal/vm/inline_cache/extconf.rb +6 -0
- data/ext/internal/vm/inline_cache/inline_cache.c +79 -0
- data/ext/internal/vm/instruction/extconf.rb +6 -0
- data/ext/internal/vm/instruction/insns_info.c.rpp +213 -0
- data/ext/internal/vm/instruction/insns_info.h.rpp +53 -0
- data/ext/internal/vm/instruction/instruction.c +78 -0
- data/ext/internal/vm/instruction/instruction.h +10 -0
- data/ext/internal/vm/iseq/extconf.rb +7 -0
- data/ext/internal/vm/iseq/insns_info.inc.rpp +30 -0
- data/ext/internal/vm/iseq/internal_iseq.h +9 -0
- data/ext/internal/vm/iseq/iseq.c +555 -0
- data/ext/internal/vm/vm.c +55 -0
- data/ext/mkmf-ruby-internal.rb +111 -0
- data/ext/ruby_source_dir.rb +24 -0
- data/ext/rubypp.rb +97 -0
- data/generate_rdoc.rb +33 -0
- data/lib/internal/binding.rb +1 -0
- data/lib/internal/classtree.rb +55 -0
- data/lib/internal/debug.rb +16 -0
- data/lib/internal/method.rb +1 -0
- data/lib/internal/method/as_code.rb +33 -0
- data/lib/internal/method/as_expression.rb +34 -0
- data/lib/internal/method/signature.rb +442 -0
- data/lib/internal/module.rb +1 -0
- data/lib/internal/module/as_code.rb +45 -0
- data/lib/internal/node.rb +3 -0
- data/lib/internal/node/as_code.rb +233 -0
- data/lib/internal/node/as_expression.rb +619 -0
- data/lib/internal/node/dump.rb +53 -0
- data/lib/internal/node/pp.rb +72 -0
- data/lib/internal/node/to_a.rb +52 -0
- data/lib/internal/noex.rb +1 -0
- data/lib/internal/obfusc.rb +57 -0
- data/lib/internal/object.rb +1 -0
- data/lib/internal/object/as_code.rb +10 -0
- data/lib/internal/proc.rb +1 -0
- data/lib/internal/proc/as_code.rb +21 -0
- data/lib/internal/proc/as_expression.rb +14 -0
- data/lib/internal/proc/signature.rb +184 -0
- data/lib/internal/tag.rb +1 -0
- data/lib/internal/thread.rb +1 -0
- data/lib/internal/vm.rb +1 -0
- data/lib/internal/vm/bytedecoder.rb +866 -0
- data/lib/internal/vm/constants.rb +1 -0
- data/lib/internal/vm/control_frame.rb +1 -0
- data/lib/internal/vm/inline_cache.rb +1 -0
- data/lib/internal/vm/instruction.rb +1 -0
- data/lib/internal/vm/iseq.rb +1 -0
- data/lib/internal/vm/iseq/as_code.rb +27 -0
- data/lib/internal/vm/iseq/as_expression.rb +26 -0
- data/metaconfig +19 -0
- data/post-config.rb +1 -0
- data/post-install.rb +4 -0
- data/post-setup.rb +7 -0
- data/pre-config.rb +96 -0
- data/pre-install.rb +13 -0
- data/pre-setup.rb +8 -0
- data/run_tests.rb +26 -0
- data/setup.rb +1599 -0
- data/test/expression_samples.rb +160 -0
- data/test/node_samples.rb +122 -0
- data/test/test_as_code.rb +261 -0
- data/test/test_as_expression.rb +229 -0
- data/test/test_dump_class.rb +187 -0
- data/test/test_dump_method.rb +144 -0
- data/test/test_dump_proc.rb +118 -0
- data/test/test_helpers.rb +61 -0
- data/test/test_method.rb +72 -0
- data/test/test_methodsig.rb +267 -0
- data/test/test_module.rb +49 -0
- data/test/test_node.rb +77 -0
- data/test/test_proc.rb +47 -0
- metadata +377 -0
data/LICENSE
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
Ruby/Internal 0.5
|
2
|
+
Copyright (C) 2008 Paul Brannan <pbrannan@atdesk.com>
|
3
|
+
|
4
|
+
You may distribute this software under the same terms as Ruby (see the file
|
5
|
+
COPYING that was distributed with this library).
|
6
|
+
|
7
|
+
All the files in this distribution are covered under Ruby's license,
|
8
|
+
except install.rb, which is covered under the LGPL.
|
9
|
+
|
data/README
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
This is ruby-internal, a library that provides access to the internals
|
2
|
+
of the ruby interpreter.
|
3
|
+
|
4
|
+
See the file LICENSE for license and copyright information.
|
5
|
+
|
6
|
+
To build and run the tests:
|
7
|
+
ruby setup.rb config
|
8
|
+
ruby setup.rb setup
|
9
|
+
|
10
|
+
Or, if you are on ruby 1.9 (or another version of ruby that doesn't have
|
11
|
+
pre-parsed ruby source included in the distribution), you'll need to
|
12
|
+
pass a special command-line option in the config step so the build
|
13
|
+
scripts can find ruby's source code:
|
14
|
+
ruby setup.rb config --ruby-source-path=/path/to/ruby
|
15
|
+
ruby setup.rb setup
|
16
|
+
|
17
|
+
To install:
|
18
|
+
ruby install.rb install
|
19
|
+
|
20
|
+
See the generated documentation (in the doc/ directory) and the examples
|
21
|
+
(in the directory example/) for usage.
|
22
|
+
|
23
|
+
Some notes about security:
|
24
|
+
|
25
|
+
- Data can always be inspected.
|
26
|
+
- Methods that could potentially cause a crash if used incorrectly are
|
27
|
+
disallowed with $SAFE >= 2.
|
28
|
+
- Methods that could allow access to potentially sensitive data are
|
29
|
+
disallowed with $SAFE >= 4.
|
30
|
+
- Methods that load marshalled data do taint checks with $SAFE >= 1.
|
31
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
task :clean do
|
4
|
+
ruby "setup.rb clean"
|
5
|
+
end
|
6
|
+
|
7
|
+
task :config do
|
8
|
+
ruby "setup.rb config"
|
9
|
+
end
|
10
|
+
|
11
|
+
task :setup do
|
12
|
+
ruby "setup.rb setup"
|
13
|
+
end
|
14
|
+
|
15
|
+
task :install do
|
16
|
+
ruby "setup.rb install"
|
17
|
+
end
|
18
|
+
|
19
|
+
task :default => [ :config, :setup ]
|
20
|
+
|
data/TODO
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
* Clean up the code
|
2
|
+
- Refactor module_load; code to create a subclass and code to attach
|
3
|
+
an arbitrary class as a metaclass should be factored out
|
4
|
+
- Split up unrelated code into separate source files
|
5
|
+
* Write more test cases
|
6
|
+
* Shouldn't be able to dump classes with non-default allocation
|
7
|
+
functions; write a test for this
|
8
|
+
* Test for dumping a metaclass that has a metaclass
|
9
|
+
* Should real_superclass use rb_class_real() when including modules?
|
data/example/README
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'nodewrap'
|
2
|
+
|
3
|
+
module M
|
4
|
+
class Triangle
|
5
|
+
def initialize(a, b, c)
|
6
|
+
@a = a
|
7
|
+
@b = b
|
8
|
+
@c = c
|
9
|
+
end
|
10
|
+
|
11
|
+
def area
|
12
|
+
s = (@a + @b + @c) / 2.0
|
13
|
+
return Math.sqrt(s*(s-@a)*(s-@b)*(s-@c))
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
return "a #{@a}-#{@b}-#{@c} triangle"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
Marshal.dump(M, $stdout)
|
23
|
+
$stdout.flush
|
24
|
+
|
@@ -0,0 +1,37 @@
|
|
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
|
+
struct BLOCKTAG {
|
11
|
+
struct RBasic super;
|
12
|
+
long dst;
|
13
|
+
long flags;
|
14
|
+
};
|
15
|
+
|
16
|
+
struct BLOCK {
|
17
|
+
NODE *var;
|
18
|
+
NODE *body;
|
19
|
+
VALUE self;
|
20
|
+
struct FRAME frame;
|
21
|
+
struct SCOPE *scope;
|
22
|
+
struct BLOCKTAG *tag;
|
23
|
+
VALUE klass;
|
24
|
+
int iter;
|
25
|
+
int vmode;
|
26
|
+
int flags;
|
27
|
+
struct RVarmap *dyna_vars;
|
28
|
+
VALUE orig_thread;
|
29
|
+
VALUE wrapper;
|
30
|
+
VALUE block_obj;
|
31
|
+
struct BLOCK *outer;
|
32
|
+
struct BLOCK *prev;
|
33
|
+
};
|
34
|
+
|
35
|
+
|
36
|
+
#endif
|
37
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#ifndef ruby_internal_method__h_
|
2
|
+
#define ruby_internal_method__h_
|
3
|
+
|
4
|
+
#include <ruby.h>
|
5
|
+
|
6
|
+
#include "internal/node/ruby_internal_node.h"
|
7
|
+
|
8
|
+
struct METHOD {
|
9
|
+
VALUE klass, rklass;
|
10
|
+
VALUE recv;
|
11
|
+
ID id, oid;
|
12
|
+
NODE *body;
|
13
|
+
};
|
14
|
+
|
15
|
+
#define METHOD_OCLASS(m) m->klass
|
16
|
+
#define METHOD_RCLASS(m) m->rklass
|
17
|
+
|
18
|
+
#endif
|
19
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#include "classpath.h"
|
2
|
+
|
3
|
+
VALUE
|
4
|
+
path2class(path)
|
5
|
+
char *path;
|
6
|
+
{
|
7
|
+
VALUE v = rb_path2class(path);
|
8
|
+
|
9
|
+
if (TYPE(v) != T_CLASS) {
|
10
|
+
rb_raise(rb_eArgError, "%s does not refer class", path);
|
11
|
+
}
|
12
|
+
return v;
|
13
|
+
}
|
14
|
+
|
15
|
+
VALUE
|
16
|
+
path2module(path)
|
17
|
+
char *path;
|
18
|
+
{
|
19
|
+
VALUE v = rb_path2class(path);
|
20
|
+
|
21
|
+
if (TYPE(v) != T_MODULE) {
|
22
|
+
rb_raise(rb_eArgError, "%s does not refer module", path);
|
23
|
+
}
|
24
|
+
return v;
|
25
|
+
}
|
26
|
+
|
27
|
+
|
@@ -0,0 +1,37 @@
|
|
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
|
+
struct BLOCKTAG {
|
11
|
+
struct RBasic super;
|
12
|
+
long dst;
|
13
|
+
long flags;
|
14
|
+
};
|
15
|
+
|
16
|
+
struct BLOCK {
|
17
|
+
NODE *var;
|
18
|
+
NODE *body;
|
19
|
+
VALUE self;
|
20
|
+
struct FRAME frame;
|
21
|
+
struct SCOPE *scope;
|
22
|
+
struct BLOCKTAG *tag;
|
23
|
+
VALUE klass;
|
24
|
+
int iter;
|
25
|
+
int vmode;
|
26
|
+
int flags;
|
27
|
+
struct RVarmap *dyna_vars;
|
28
|
+
VALUE orig_thread;
|
29
|
+
VALUE wrapper;
|
30
|
+
VALUE block_obj;
|
31
|
+
struct BLOCK *outer;
|
32
|
+
struct BLOCK *prev;
|
33
|
+
};
|
34
|
+
|
35
|
+
|
36
|
+
#endif
|
37
|
+
|
@@ -0,0 +1,155 @@
|
|
1
|
+
#include "node_type_descrip.h"
|
2
|
+
#include "version.h"
|
3
|
+
|
4
|
+
Node_Type_Descrip node_type_descrips_unsorted[] = {
|
5
|
+
{ NODE_DASGN_CURR, NEN_VALUE, NEN_VID, NEN_NONE, "DASGN_CURR" },
|
6
|
+
{ NODE_UNTIL, NEN_BODY, NEN_COND, NEN_STATE, "UNTIL" },
|
7
|
+
{ NODE_BACK_REF, NEN_NTH, NEN_CNT, NEN_NONE, "BACK_REF" },
|
8
|
+
{ NODE_ARGS, NEN_REST, NEN_OPT, NEN_CNT, "ARGS" },
|
9
|
+
{ NODE_OP_ASGN_AND, NEN_VALUE, NEN_RECV, NEN_NONE, "OP_ASGN_AND" },
|
10
|
+
{ NODE_RETURN, NEN_STTS, NEN_NONE, NEN_NONE, "RETURN" },
|
11
|
+
{ NODE_RESCUE, NEN_HEAD, NEN_ELSE, NEN_RESQ, "RESCUE" },
|
12
|
+
{ NODE_LIT, NEN_LIT, NEN_NONE, NEN_NONE, "LIT" },
|
13
|
+
{ NODE_SELF, NEN_NONE, NEN_NONE, NEN_NONE, "SELF" },
|
14
|
+
{ NODE_IFUNC, NEN_CFNC, NEN_TVAL, NEN_STATE, "IFUNC" },
|
15
|
+
{ NODE_ZSUPER, NEN_NONE, NEN_NONE, NEN_NONE, "ZSUPER" },
|
16
|
+
{ NODE_WHILE, NEN_BODY, NEN_COND, NEN_STATE, "WHILE" },
|
17
|
+
{ NODE_BLOCK, NEN_HEAD, NEN_NEXT, NEN_NONE, "BLOCK" },
|
18
|
+
{ NODE_FCALL, NEN_ARGS, NEN_MID, NEN_NONE, "FCALL" },
|
19
|
+
{ NODE_DREGX_ONCE, NEN_LIT, NEN_CFLAG, NEN_NEXT, "DREGX_ONCE" },
|
20
|
+
{ NODE_ARGSPUSH, NEN_HEAD, NEN_BODY, NEN_NONE, "ARGSPUSH" },
|
21
|
+
{ NODE_OPT_N, NEN_BODY, NEN_NONE, NEN_NONE, "OPT_N" },
|
22
|
+
{ NODE_OP_ASGN2_ARG, NEN_VID, NEN_AID, NEN_MID, "OP_ASGN2_ARG" },
|
23
|
+
{ NODE_COLON2, NEN_HEAD, NEN_MID, NEN_NONE, "COLON2" },
|
24
|
+
{ NODE_FBODY, NEN_HEAD, NEN_ORIG, NEN_MID, "FBODY" },
|
25
|
+
{ NODE_COLON3, NEN_MID, NEN_NONE, NEN_NONE, "COLON3" },
|
26
|
+
{ NODE_ITER, NEN_BODY, NEN_ITER, NEN_VAR, "ITER" },
|
27
|
+
{ NODE_NOT, NEN_BODY, NEN_NONE, NEN_NONE, "NOT" },
|
28
|
+
{ NODE_SUPER, NEN_ARGS, NEN_NONE, NEN_NONE, "SUPER" },
|
29
|
+
{ NODE_FALSE, NEN_NONE, NEN_NONE, NEN_NONE, "FALSE" },
|
30
|
+
{ NODE_CALL, NEN_ARGS, NEN_MID, NEN_RECV, "CALL" },
|
31
|
+
{ NODE_OP_ASGN_OR, NEN_AID, NEN_VALUE, NEN_RECV, "OP_ASGN_OR" },
|
32
|
+
{ NODE_TRUE, NEN_NONE, NEN_NONE, NEN_NONE, "TRUE" },
|
33
|
+
{ NODE_MASGN, NEN_ARGS, NEN_HEAD, NEN_VALUE, "MASGN" },
|
34
|
+
{ NODE_EVSTR, NEN_BODY, NEN_NONE, NEN_NONE, "EVSTR" },
|
35
|
+
{ NODE_MATCH, NEN_LIT, NEN_VALUE, NEN_NONE, "MATCH" },
|
36
|
+
{ NODE_ENSURE, NEN_HEAD, NEN_ENSR, NEN_NONE, "ENSURE" },
|
37
|
+
{ NODE_CDECL, NEN_VALUE, NEN_VID, NEN_NONE, "CDECL" },
|
38
|
+
{ NODE_DXSTR, NEN_LIT, NEN_NEXT, NEN_NONE, "DXSTR" },
|
39
|
+
{ NODE_VCALL, NEN_MID, NEN_NONE, NEN_NONE, "VCALL" },
|
40
|
+
{ NODE_ZARRAY, NEN_NONE, NEN_NONE, NEN_NONE, "ZARRAY" },
|
41
|
+
{ NODE_BLOCK_ARG, NEN_CNT, NEN_NONE, NEN_NONE, "BLOCK_ARG" },
|
42
|
+
{ NODE_AND, NEN_1ST, NEN_2ND, NEN_NONE, "AND" },
|
43
|
+
{ NODE_SCLASS, NEN_BODY, NEN_RECV, NEN_NONE, "SCLASS" },
|
44
|
+
{ NODE_DEFINED, NEN_HEAD, NEN_NONE, NEN_NONE, "DEFINED" },
|
45
|
+
{ NODE_VALIAS, NEN_1ST, NEN_2ND, NEN_NONE, "VALIAS" },
|
46
|
+
{ NODE_REDO, NEN_NONE, NEN_NONE, NEN_NONE, "REDO" },
|
47
|
+
{ NODE_BLOCK_PASS, NEN_BODY, NEN_ITER, NEN_NONE, "BLOCK_PASS" },
|
48
|
+
{ NODE_DREGX, NEN_LIT, NEN_CFLAG, NEN_NEXT, "DREGX" },
|
49
|
+
{ NODE_DEFN, NEN_MID, NEN_DEFN, NEN_NOEX, "DEFN" },
|
50
|
+
{ NODE_SCOPE, NEN_TBL, NEN_RVAL, NEN_NEXT, "SCOPE" },
|
51
|
+
{ NODE_DSYM, NEN_LIT, NEN_NEXT, NEN_NONE, "DSYM" },
|
52
|
+
{ NODE_BMETHOD, NEN_CVAL, NEN_NONE, NEN_NONE, "BMETHOD" },
|
53
|
+
{ NODE_IF, NEN_COND, NEN_BODY, NEN_ELSE, "IF" },
|
54
|
+
{ NODE_WHEN, NEN_HEAD, NEN_BODY, NEN_NEXT, "WHEN" },
|
55
|
+
{ NODE_ARGSCAT, NEN_HEAD, NEN_BODY, NEN_NONE, "ARGSCAT" },
|
56
|
+
{ NODE_HASH, NEN_HEAD, NEN_NONE, NEN_NONE, "HASH" },
|
57
|
+
#ifdef HAVE_NODE_ALLOCA
|
58
|
+
{ NODE_ALLOCA, NEN_CFNC, NEN_VALUE, NEN_CNT, "ALLOCA" },
|
59
|
+
#endif
|
60
|
+
{ NODE_OP_ASGN1, NEN_ARGS, NEN_MID, NEN_RECV, "OP_ASGN1" },
|
61
|
+
{ NODE_CASE, NEN_HEAD, NEN_BODY, NEN_NEXT, "CASE" },
|
62
|
+
{ NODE_CFUNC, NEN_CFNC, NEN_ARGC, NEN_NONE, "CFUNC" },
|
63
|
+
{ NODE_OP_ASGN2, NEN_VALUE, NEN_NEXT, NEN_RECV, "OP_ASGN2" },
|
64
|
+
{ NODE_DEFS, NEN_MID, NEN_DEFN, NEN_RECV, "DEFS" },
|
65
|
+
{ NODE_LASGN, NEN_VALUE, NEN_VID, NEN_CNT, "LASGN" },
|
66
|
+
{ NODE_POSTEXE, NEN_NONE, NEN_NONE, NEN_NONE, "POSTEXE" },
|
67
|
+
{ NODE_STR, NEN_LIT, NEN_NONE, NEN_NONE, "STR" },
|
68
|
+
{ NODE_ATTRSET, NEN_VID, NEN_NONE, NEN_NONE, "ATTRSET" },
|
69
|
+
{ NODE_MEMO, NEN_NONE, NEN_NONE, NEN_NONE, "MEMO" },
|
70
|
+
{ NODE_XSTR, NEN_LIT, NEN_NONE, NEN_NONE, "XSTR" },
|
71
|
+
{ NODE_RESBODY, NEN_HEAD, NEN_ARGS, NEN_BODY, "RESBODY" },
|
72
|
+
{ NODE_ALIAS, NEN_1ST, NEN_2ND, NEN_NONE, "ALIAS" },
|
73
|
+
{ NODE_ARRAY, NEN_HEAD, NEN_ALEN, NEN_NEXT, "ARRAY" },
|
74
|
+
{ NODE_NEXT, NEN_STTS, NEN_NONE, NEN_NONE, "NEXT" },
|
75
|
+
{ NODE_GASGN, NEN_VALUE, NEN_VID, NEN_ENTRY, "GASGN" },
|
76
|
+
{ NODE_CVDECL, NEN_VALUE, NEN_VID, NEN_NONE, "CVDECL" },
|
77
|
+
{ NODE_ATTRASGN, NEN_ARGS, NEN_MID, NEN_RECV, "ATTRASGN" },
|
78
|
+
{ NODE_UNDEF, NEN_MID, NEN_NONE, NEN_NONE, "UNDEF" },
|
79
|
+
{ NODE_BREAK, NEN_STTS, NEN_NONE, NEN_NONE, "BREAK" },
|
80
|
+
{ NODE_NEWLINE, NEN_NEXT, NEN_NONE, NEN_NONE, "NEWLINE" },
|
81
|
+
{ NODE_NTH_REF, NEN_NTH, NEN_CNT, NEN_NONE, "NTH_REF" },
|
82
|
+
{ NODE_DOT2, NEN_BEG, NEN_END, NEN_STATE, "DOT2" },
|
83
|
+
{ NODE_GVAR, NEN_VID, NEN_ENTRY, NEN_NONE, "GVAR" },
|
84
|
+
{ NODE_DOT3, NEN_BEG, NEN_END, NEN_STATE, "DOT3" },
|
85
|
+
{ NODE_CVASGN, NEN_VALUE, NEN_VID, NEN_NONE, "CVASGN" },
|
86
|
+
{ NODE_CREF, NEN_BODY, NEN_NEXT, NEN_CLSS, "CREF" },
|
87
|
+
{ NODE_SPLAT, NEN_HEAD, NEN_NONE, NEN_NONE, "SPLAT" },
|
88
|
+
{ NODE_MODULE, NEN_CPATH, NEN_BODY, NEN_NONE, "MODULE" },
|
89
|
+
{ NODE_FOR, NEN_BODY, NEN_ITER, NEN_VAR, "FOR" },
|
90
|
+
{ NODE_DVAR, NEN_VID, NEN_NONE, NEN_NONE, "DVAR" },
|
91
|
+
{ NODE_DSTR, NEN_LIT, NEN_NEXT, NEN_NONE, "DSTR" },
|
92
|
+
{ NODE_SVALUE, NEN_HEAD, NEN_NONE, NEN_NONE, "SVALUE" },
|
93
|
+
{ NODE_RETRY, NEN_NONE, NEN_NONE, NEN_NONE, "RETRY" },
|
94
|
+
{ NODE_CLASS, NEN_CPATH, NEN_BODY, NEN_SUPER, "CLASS" },
|
95
|
+
{ NODE_DASGN, NEN_VALUE, NEN_VID, NEN_NONE, "DASGN" },
|
96
|
+
{ NODE_NIL, NEN_NONE, NEN_NONE, NEN_NONE, "NIL" },
|
97
|
+
{ NODE_RESTARY2, NEN_HEAD, NEN_NONE, NEN_NONE, "RESTARY2" },
|
98
|
+
{ NODE_IVAR, NEN_VID, NEN_NONE, NEN_NONE, "IVAR" },
|
99
|
+
{ NODE_LVAR, NEN_VID, NEN_CNT, NEN_NONE, "LVAR" },
|
100
|
+
{ NODE_MATCH2, NEN_VALUE, NEN_RECV, NEN_NONE, "MATCH2" },
|
101
|
+
{ NODE_FLIP2, NEN_BEG, NEN_END, NEN_CNT, "FLIP2" },
|
102
|
+
{ NODE_CONST, NEN_VID, NEN_NONE, NEN_NONE, "CONST" },
|
103
|
+
{ NODE_RESTARY, NEN_HEAD, NEN_NONE, NEN_NONE, "RESTARY" },
|
104
|
+
{ NODE_METHOD, NEN_BODY, NEN_NOEX, NEN_NONE, "METHOD" },
|
105
|
+
{ NODE_MATCH3, NEN_VALUE, NEN_RECV, NEN_NONE, "MATCH3" },
|
106
|
+
{ NODE_IASGN, NEN_VALUE, NEN_VID, NEN_NONE, "IASGN" },
|
107
|
+
{ NODE_DMETHOD, NEN_CVAL, NEN_NONE, NEN_NONE, "DMETHOD" },
|
108
|
+
{ NODE_FLIP3, NEN_BEG, NEN_END, NEN_CNT, "FLIP3" },
|
109
|
+
{ NODE_OR, NEN_1ST, NEN_2ND, NEN_NONE, "OR" },
|
110
|
+
{ NODE_CVAR, NEN_VID, NEN_NONE, NEN_NONE, "CVAR" },
|
111
|
+
{ NODE_YIELD, NEN_HEAD, NEN_STATE, NEN_NONE, "YIELD" },
|
112
|
+
{ NODE_BEGIN, NEN_BODY, NEN_NONE, NEN_NONE, "BEGIN" },
|
113
|
+
{ NODE_LAST, NEN_NONE, NEN_NONE, NEN_NONE, "LAST" },
|
114
|
+
};
|
115
|
+
|
116
|
+
static Node_Type_Descrip * node_type_descrips[NUM_NODE_TYPE_DESCRIPS];
|
117
|
+
static int node_type_descrips_initialized = 0;
|
118
|
+
|
119
|
+
static void init_node_type_descrips()
|
120
|
+
{
|
121
|
+
if(!node_type_descrips_initialized)
|
122
|
+
{
|
123
|
+
Node_Type_Descrip * descrip;
|
124
|
+
memset(node_type_descrips, 0, sizeof(node_type_descrips));
|
125
|
+
for(descrip = node_type_descrips_unsorted;
|
126
|
+
descrip->nt != NODE_LAST;
|
127
|
+
++descrip)
|
128
|
+
{
|
129
|
+
if(node_type_descrips[descrip->nt])
|
130
|
+
{
|
131
|
+
rb_raise(rb_eRuntimeError, "duplicate entry for node type %d (%s is also %s)\n", descrip->nt, descrip->name, node_type_descrips[descrip->nt]->name);
|
132
|
+
}
|
133
|
+
else
|
134
|
+
{
|
135
|
+
node_type_descrips[descrip->nt] = descrip;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
node_type_descrips_initialized = 1;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
/* Given a node, find out the types of the three elements it contains */
|
143
|
+
Node_Type_Descrip const * node_type_descrip(enum node_type nt)
|
144
|
+
{
|
145
|
+
init_node_type_descrips();
|
146
|
+
if(node_type_descrips[nt])
|
147
|
+
{
|
148
|
+
return node_type_descrips[nt];
|
149
|
+
}
|
150
|
+
else
|
151
|
+
{
|
152
|
+
rb_raise(rb_eArgError, "Unknown node type %d", nt);
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|