mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
2f17991bd1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
31 lines
445 B
Ruby
31 lines
445 B
Ruby
|
|
prelude, outfile = *ARGV
|
|
lines = []
|
|
|
|
lines = File.readlines(prelude).map{|line|
|
|
line.dump
|
|
}
|
|
|
|
open(outfile, 'w'){|f|
|
|
f.puts <<EOS__
|
|
|
|
#include "ruby/ruby.h"
|
|
#include "vm_core.h"
|
|
|
|
static const char *prelude_code =
|
|
#{lines.join("\n")}
|
|
;
|
|
void
|
|
Init_prelude(void)
|
|
{
|
|
rb_iseq_eval(rb_iseq_compile(
|
|
rb_str_new2(prelude_code),
|
|
rb_str_new2("#{File.basename(prelude)}"), INT2FIX(1)));
|
|
|
|
#if 0
|
|
printf("%s\n", prelude_code);
|
|
#endif
|
|
}
|
|
EOS__
|
|
}
|
|
|