OSDN Git Service

Forgot to update ltjclasses.dtx
[luatex-ja/luatexja.git] / tool / jfm-readable.rb
1 #! /usr/bin/ruby
2 # -*- coding: utf-8 -*-
3
4 # The following script converts Unicode codepoints as 0x???? to real characters.
5
6 # USAGE: ruby __FILE__ ifile [> ofile]
7
8 def print_usage()
9   print "USAGE: ruby ", __FILE__, "ifile [> ofile]\n"
10 end
11
12 if __FILE__ == $0
13   # コマンドライン引数の処理
14   if ARGV.length < 1
15     print_usage()
16     exit
17   end
18   ifile = ARGV[0]
19
20   print "-- -*- coding: utf-8 -*-\n"
21   open(ifile, "r").each_line{|line|
22     line.gsub!(/0x[0-9a-fA-F]*/){|s| s.to_s + "(" + [s.to_i(0)].pack("U*") + ")"}
23     print line
24   }
25 end