ruby-changes:61173
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Sun, 10 May 2020 16:51:34 +0900 (JST)
Subject: [ruby-changes:61173] 4fca592e8c (master): delete mk_builtin_binary.rb
https://git.ruby-lang.org/ruby.git/commit/?id=4fca592e8c From 4fca592e8c707c76e8afea2a0b5dd4d17e97cd8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Tue, 5 May 2020 18:00:59 +0900 Subject: delete mk_builtin_binary.rb To generate what is necessary via generic_erb.rb instead. diff --git a/common.mk b/common.mk index 053b9b4..b428a4d 100644 --- a/common.mk +++ b/common.mk @@ -1121,8 +1121,9 @@ preludes: {$(srcdir)}golf_prelude.c https://github.com/ruby/ruby/blob/trunk/common.mk#L1121 $(ECHO) making $@ $(Q) $(BASERUBY) $(tooldir)/mk_builtin_loader.rb $< -builtin_binary.inc: $(PREP) $(BUILTIN_RB_SRCS) $(tooldir)/mk_builtin_binary.rb - $(Q) $(MINIRUBY) $(tooldir)/mk_builtin_binary.rb --cross=$(CROSS_COMPILING) +builtin_binary.inc: $(PREP) $(BUILTIN_RB_SRCS) $(srcdir)/template/builtin_binary.inc.tmpl + $(Q) $(MINIRUBY) $(tooldir)/generic_erb.rb -c -o $@ \ + $(srcdir)/template/builtin_binary.inc.tmpl -- --cross=$(CROSS_COMPILING) $(BUILTIN_RB_INCS): $(top_srcdir)/tool/mk_builtin_loader.rb diff --git a/template/builtin_binary.inc.tmpl b/template/builtin_binary.inc.tmpl new file mode 100644 index 0000000..eb0bded --- /dev/null +++ b/template/builtin_binary.inc.tmpl @@ -0,0 +1,30 @@ https://github.com/ruby/ruby/blob/trunk/template/builtin_binary.inc.tmpl#L1 +// -*- c -*- +% ary = RubyVM.enum_for(:each_builtin).to_a +// DO NOT MODIFY THIS FILE DIRECTLY. +// auto-generated file by tool/generic_erb.rb +// with template/builtin_binary.inc.tmpl +% unless ARGV.include?('--corss=yes') +% ary.each{|feature, iseq| + +static const unsigned char <%= feature %>_bin[] = { +% iseq \ +% . to_binary \ +% . each_byte \ +% . map(&:ord) \ +% . map{ '0x%02x' % _1 } \ +% . each_slice(12) {|a| + <%= a.join(', ') %>, +% } +}; +% } + +static const struct builtin_binary builtin_binary[] = { +% ary.each{|feature, | + { <%= feature.dump %>, <%= feature %>_bin, sizeof(<%= feature %>_bin), }, +% } + { NULL, },<%# dummy entry %> +}; + +#define BUILTIN_BINARY_SIZE <%= ary.size %> +STATIC_ASSERT(n_builtin, numberof(builtin_binary) == BUILTIN_BINARY_SIZE + 1); +% end diff --git a/tool/mk_builtin_binary.rb b/tool/mk_builtin_binary.rb deleted file mode 100644 index 1b3fe50..0000000 --- a/tool/mk_builtin_binary.rb +++ /dev/null @@ -1,44 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/template/builtin_binary.inc.tmpl#L0 -# -# make builtin_binary.inc file. -# - -def dump_bin iseq - bin = iseq.to_binary - bin.each_byte.with_index{|b, index| - print "\n " if (index%20) == 0 - print " 0x#{'%02x' % b.ord}," - } - print "\n" -end - -$stdout = open('builtin_binary.inc', 'wb') - -puts <<H -// -*- c -*- -// DO NOT MODIFY THIS FILE DIRECTLY. -// auto-generated file by #{File.basename(__FILE__)} - -H - -if ARGV.include?('--cross=yes') - # do nothing -else - ary = [] - RubyVM::each_builtin{|feature, iseq| - ary << [feature, iseq] - } - - ary.each{|feature, iseq| - print "\n""static const unsigned char #{feature}_bin[] = {" - dump_bin(iseq) - puts "};" - } - - print "\n""static const struct builtin_binary builtin_binary[] = {\n" - ary.each{|feature, iseq| - puts " {#{feature.dump}, #{feature}_bin, sizeof(#{feature}_bin)}," - } - puts " {NULL}," # dummy sentry - puts "};" - puts "#define BUILTIN_BINARY_SIZE #{ary.size}" -end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/