зеркало из https://github.com/github/ruby.git
* tool/compile_prelude.rb: use erb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
bb1719875c
Коммит
d45cfa45ab
|
@ -1,3 +1,7 @@
|
|||
Fri Dec 21 09:26:48 2007 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* tool/compile_prelude.rb: use erb.
|
||||
|
||||
Fri Dec 21 08:07:35 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* enumerator.c (enumerator_next): should call next_init() if fiber
|
||||
|
|
|
@ -648,7 +648,7 @@ miniprelude.c: $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb
|
|||
$(BASERUBY) -I$(srcdir) $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb $@
|
||||
|
||||
prelude.c: $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb $(srcdir)/gem_prelude.rb $(RBCONFIG)
|
||||
$(MINIRUBY) -I$(srcdir) -rrbconfig $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb $(srcdir)/gem_prelude.rb $@
|
||||
$(MINIRUBY) -I$(srcdir) -I$(srcdir)/lib -rrbconfig $(srcdir)/tool/compile_prelude.rb $(srcdir)/prelude.rb $(srcdir)/gem_prelude.rb $@
|
||||
|
||||
prereq: incs {$(VPATH)}parse.c $(srcdir)/ext/ripper/ripper.c {$(VPATH)}miniprelude.c
|
||||
|
||||
|
|
|
@ -56,36 +56,35 @@ lines_list = preludes.map {|filename|
|
|||
[setup_lines, lines]
|
||||
}
|
||||
|
||||
require 'tool/serb'
|
||||
require 'erb'
|
||||
|
||||
tmp = ''
|
||||
eval(serb(<<'EOS', 'tmp'))
|
||||
tmp = ERB.new(<<'EOS', nil, '%').result(binding)
|
||||
#include "ruby/ruby.h"
|
||||
#include "vm_core.h"
|
||||
|
||||
! preludes.zip(lines_list).each_with_index {|(prelude, (setup_lines, lines)), i|
|
||||
static const char prelude_name<%i%>[] = <%c_esc(File.basename(prelude))%>;
|
||||
static const char prelude_code<%i%>[] =
|
||||
! (setup_lines+lines).each {|line|
|
||||
<%line%>
|
||||
! }
|
||||
% preludes.zip(lines_list).each_with_index {|(prelude, (setup_lines, lines)), i|
|
||||
static const char prelude_name<%=i%>[] = <%=c_esc(File.basename(prelude))%>;
|
||||
static const char prelude_code<%=i%>[] =
|
||||
% (setup_lines+lines).each {|line|
|
||||
<%=line%>
|
||||
% }
|
||||
;
|
||||
! }
|
||||
% }
|
||||
|
||||
void
|
||||
Init_prelude(void)
|
||||
{
|
||||
! lines_list.each_with_index {|(setup_lines, lines), i|
|
||||
% lines_list.each_with_index {|(setup_lines, lines), i|
|
||||
rb_iseq_eval(rb_iseq_compile(
|
||||
rb_str_new(prelude_code<%i%>, sizeof(prelude_code<%i%>) - 1),
|
||||
rb_str_new(prelude_name<%i%>, sizeof(prelude_name<%i%>) - 1),
|
||||
INT2FIX(<%1-setup_lines.length%>)));
|
||||
rb_str_new(prelude_code<%=i%>, sizeof(prelude_code<%=i%>) - 1),
|
||||
rb_str_new(prelude_name<%=i%>, sizeof(prelude_name<%=i%>) - 1),
|
||||
INT2FIX(<%=1-setup_lines.length%>)));
|
||||
|
||||
! }
|
||||
% }
|
||||
#if 0
|
||||
! preludes.length.times {|i|
|
||||
puts(prelude_code<%i%>);
|
||||
! }
|
||||
% preludes.length.times {|i|
|
||||
puts(prelude_code<%=i%>);
|
||||
% }
|
||||
#endif
|
||||
}
|
||||
EOS
|
||||
|
|
Загрузка…
Ссылка в новой задаче