[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[eev] infoindex/shorten.rb
From: |
rubikitch |
Subject: |
[eev] infoindex/shorten.rb |
Date: |
Mon, 11 Jul 2005 17:00:36 -0000 |
I made a script to make sexps generated by infoindex.rb better-looking.
#
# (eev-bounded)
ruby1.8 infoindex.rb ratpoison.info | ruby1.8 shorten.rb -e ratpoison.e -l
ratpoison.el
ruby1.8 infoindex.rb screen.info* | ruby1.8 shorten.rb -e screen.e -l screen.el
#
# (find-fline "/tmp/ratpoison.e")
# (find-fline "/tmp/ratpoison.el")
# (find-fline "/tmp/screen.e")
# (find-fline "/tmp/screen.el")
;;
;; (eeb-eval)
(load-file "/tmp/screen.el")
(load-file "/tmp/ratpoison.el")
;;
#!/usr/bin/env ruby
require 'optparse'
class Shorten
def initialize(input)
@es = ""
@el = ""
sexps = []
cmds = []
cmd_sexp_ary = []
infoname = ""
input.read.split(/\n/).each do |line|
sexp = line.scan(/^# (.+)$/).to_s
cmd = sexp.scan(/Command: ([^ \"]+)/).to_s
if cmds.include? cmd
next
else
cmd_sexp_ary << [cmd, sexp]
infoname = sexp.scan(/\((\S+)\)/).to_s
cmds << cmd
end
end
@el = "(setq #{infoname}-cmd2link\n '(\n"
cmd_sexp_ary.each do |cmd, sexp|
@el << " (#{cmd.dump} #{sexp[1..-2]})\n"
@es << "# (find-#{infoname}cmd #{cmd.dump})\n"
end
@el << " ))\n\n"
@el << "(defun find-#{infoname}cmd (cmd)
(eval (ee-aref #{infoname}-cmd2link cmd)))
"
end
def output_el(io)
io.print @el
end
def output_es(io)
io.print @es
end
end
if __FILE__==$0
output_el = nil
output_es = nil
ARGV.options {|o|
o.on("-l ELFILE") {|v| output_el = v}
o.on("-e ESFILE") {|v| output_es = v}
o.parse!
}
obj = Shorten.new(ARGF)
open(output_el, "w"){|el| obj.output_el(el)}
open(output_es, "w"){|es| obj.output_es(es)}
end
--
rubikitch
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [eev] infoindex/shorten.rb,
rubikitch <=