Skip to content

Commit

Permalink
Prettify builtin_binary format
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Nov 8, 2019
1 parent cd706c5 commit 88b9a0f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tool/mk_builtin_binary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -25,12 +26,12 @@ def dump_bin iseq
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)},"
}
Expand Down

0 comments on commit 88b9a0f

Please sign in to comment.