summaryrefslogtreecommitdiffstats
path: root/tool/compile_prelude.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-25 01:20:30 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-25 01:20:30 +0000
commit2135f038c6f4661bd8cfb862f77bbf022b45e2d3 (patch)
tree574cbd3dd991622a8f79cadaba3dccf24b1446e4 /tool/compile_prelude.rb
parent062316ca20afc79eac8f99ce9c43193e747f2605 (diff)
downloadruby-2135f038c6f4661bd8cfb862f77bbf022b45e2d3.tar.gz
ruby-2135f038c6f4661bd8cfb862f77bbf022b45e2d3.tar.xz
ruby-2135f038c6f4661bd8cfb862f77bbf022b45e2d3.zip
* common.mk (prelude.o): depends on vm_core.h now.
* common.mk (prelude.c): depends on tool/compile_prelude.rb too. * common.mk (prereq): updates all auto-generated sources. * tool/compile_prelude.rb: separated dynamic and static portions. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/compile_prelude.rb')
-rw-r--r--tool/compile_prelude.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/tool/compile_prelude.rb b/tool/compile_prelude.rb
index cdf686179..1012d1fbc 100644
--- a/tool/compile_prelude.rb
+++ b/tool/compile_prelude.rb
@@ -1,26 +1,29 @@
prelude, outfile = *ARGV
-lines = []
lines = File.readlines(prelude).map{|line|
line.dump
}
open(outfile, 'w'){|f|
-f.puts <<EOS__
+ f.puts <<EOS__, <<'EOS__'
#include "ruby/ruby.h"
#include "vm_core.h"
-static const char *prelude_code =
+static const char prelude_name[] = "#{File.basename(prelude)}";
+static const char prelude_code[] =
#{lines.join("\n")}
;
+EOS__
+
void
Init_prelude(void)
{
rb_iseq_eval(rb_iseq_compile(
- rb_str_new2(prelude_code),
- rb_str_new2("#{File.basename(prelude)}"), INT2FIX(1)));
+ rb_str_new(prelude_code, sizeof(prelude_code) - 1),
+ rb_str_new(prelude_name, sizeof(prelude_name) - 1),
+ INT2FIX(1)));
#if 0
printf("%s\n", prelude_code);