diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-11-09 00:20:42 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-11-09 00:21:44 +0900 |
commit | 88b9a0f7fe664098177f4d2f10aed08c4a42b03e (patch) | |
tree | 1177b6667c5b69438289b915becd989884d0dc29 /tool | |
parent | cd706c52168222e3badab82c24df22008d264ca9 (diff) | |
download | ruby-88b9a0f7fe664098177f4d2f10aed08c4a42b03e.tar.gz |
Prettify builtin_binary format
Diffstat (limited to 'tool')
-rw-r--r-- | tool/mk_builtin_binary.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tool/mk_builtin_binary.rb b/tool/mk_builtin_binary.rb index eaa560fa26..416c6ef17e 100644 --- a/tool/mk_builtin_binary.rb +++ b/tool/mk_builtin_binary.rb @@ -5,9 +5,10 @@ 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 " if (index%20) == 0 + print " 0x#{'%02x' % b.ord}," } + print "\n" end ary = [] @@ -25,12 +26,12 @@ puts <<H H ary.each{|feature, iseq| - puts "static const unsigned char #{feature}_bin[] = {" + print "\n""static const unsigned char #{feature}_bin[] = {" dump_bin(iseq) puts "};" } -puts "static const struct builtin_binary builtin_binary[] = {" +print "\n""static const struct builtin_binary builtin_binary[] = {\n" ary.each{|feature, iseq| puts " {#{feature.dump}, #{feature}_bin, sizeof(#{feature}_bin)}," } |