mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
a3e1b1ce7e
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
62 lines
1.1 KiB
Ruby
62 lines
1.1 KiB
Ruby
#!/usr/bin/env ruby
|
|
#
|
|
#
|
|
|
|
require 'rb/insns2vm.rb'
|
|
insns = insns_def_new
|
|
|
|
{ # docs
|
|
'/doc/yarvarch.ja' => :desc_ja,
|
|
'/doc/yarvarch.en' => :desc_en,
|
|
}.each{|fn, s|
|
|
fn = $srcdir + fn
|
|
p fn
|
|
open(fn, 'w'){|f|
|
|
f.puts(insns.__send__(s))
|
|
}
|
|
}
|
|
|
|
def chg ary
|
|
if ary.empty?
|
|
return ' '
|
|
end
|
|
|
|
ary.map{|e|
|
|
if e[0] == '...'
|
|
'...'
|
|
else
|
|
e.join(' ')
|
|
end
|
|
e[1]
|
|
}.join(', ')
|
|
end
|
|
|
|
open($srcdir + '/doc/insnstbl.html', 'w'){|f|
|
|
tbl = ''
|
|
type = nil
|
|
insns.each_with_index{|insn, i|
|
|
c = insn.comm[:c]
|
|
if type != c
|
|
stype = c
|
|
type = c
|
|
end
|
|
|
|
tbl << "<tr>\n"
|
|
tbl << "<td>#{stype}</td>"
|
|
tbl << "<td>#{i}</td>"
|
|
tbl << "<td>#{insn.name}</td>"
|
|
tbl << "<td>#{chg insn.opes}</td>"
|
|
tbl << "<td>#{chg insn.pops.reverse}</td>"
|
|
tbl << "<td> => </td>"
|
|
tbl << "<td>#{chg insn.rets.reverse}</td>"
|
|
tbl << "</tr>\n"
|
|
}
|
|
f.puts ERB.new(File.read($srcdir + '/template/insnstbl.html')).result(binding)
|
|
}
|
|
|
|
begin
|
|
system('t2n.bat --tmpl doc.tmpl ../doc/yarvarch.ja > ../doc/yarvarch.ja.html')
|
|
system('t2n.bat --tmpl doc.tmpl ../doc/yarvarch.en > ../doc/yarvarch.en.html')
|
|
rescue
|
|
end
|
|
|