aboutsummaryrefslogtreecommitdiffstats
path: root/tool/makedocs.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-12-31 15:02:22 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-12-31 15:02:22 +0000
commita3e1b1ce7ed7e7ffac23015fc2fde56511b30681 (patch)
tree7b725552a9a4ded93849ca2faab1b257f7761790 /tool/makedocs.rb
parent3e7566d8fb5138bb9cd647e5fdefc54fc9803509 (diff)
downloadruby-a3e1b1ce7ed7e7ffac23015fc2fde56511b30681.tar.gz
* Merge YARV
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/makedocs.rb')
-rw-r--r--tool/makedocs.rb62
1 files changed, 62 insertions, 0 deletions
diff --git a/tool/makedocs.rb b/tool/makedocs.rb
new file mode 100644
index 0000000000..56cb21565f
--- /dev/null
+++ b/tool/makedocs.rb
@@ -0,0 +1,62 @@
+#!/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 '&nbsp;'
+ 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> =&gt; </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
+