mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
cfaf3d9a1a
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@13258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
34 lines
557 B
Ruby
34 lines
557 B
Ruby
|
|
prelude, outfile = *ARGV
|
|
|
|
lines = File.readlines(prelude).map{|line|
|
|
line.dump
|
|
}
|
|
|
|
open(outfile, 'w'){|f|
|
|
f.puts <<EOS__, <<'EOS__'
|
|
|
|
#include "ruby/ruby.h"
|
|
#include "vm_core.h"
|
|
|
|
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_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);
|
|
#endif
|
|
}
|
|
EOS__
|
|
}
|
|
|