-\81¡Ruby/CHISE\82Æ\88ê\8f\8f\82É\8eg\82¤\82Æ\82¢\82¢\82©\82à\82µ\82ê\82È\82¢\93¹\8bï\8cQ
-
-\81\9cdbdumball.rb
-char-db\82Ì\92\86\82Ìbdb\8cQ\82Ì\93à\97e\82ð\91S\82Ä.txt\83t\83@\83C\83\8b\82Æ\82µ\82Ädump\82µ\82Ü\82·\81B
-\82±\82¤\82·\82é\82Æ\81Abdb\82Ì\93à\97e\82ª\82Ç\82Ì\82æ\82¤\82É\82È\82Á\82Ä\82¢\82é\82©\82ª\83e\83L\83X\83g\82Å\82í\82©\82Á\82Ä\95Ö\97\98\82Å\82·\81B
-\93¯\82¶directory\82É\8f\91\82«\8fo\82µ\82Ü\82·\82Ì\82Å\81A\8f\91\82«\8d\9e\82Ý\82Ìpermisson\82ª\95K\97v\82È\82Í\82¸\82Å\82·\81B
-
-\81\9cmake_ids_db.rb
-\83e\83L\83X\83g\82É\82æ\82éIDS\83t\83@\83C\83\8b\8cQ\82ð\91S\82Ä\93Ç\82Ý\82±\82Ý\81A
-BDB\82Æ\82µ\82Ächar-db/system-char-id/\89º\82É\83Z\81[\83u\82µ\82È\82¨\82µ\82Ü\82·\81B
-\8e\9f\89ñ\82©\82ç\82Í\92Ê\8fí\82Ì\91®\90«\82Ì\88ê\82Â\82Æ\82µ\82Ä.ids\82ð\8eg\82¦\82é\82æ\82¤\82É\82È\82è\82Ü\82·\81B
-isolated character\82ð\8f\9c\82\82½\82ß\82É\94ñ\8fí\82É\92x\82\82È\82Á\82Ä\82¢\82Ä\81A1\8e\9e\8aÔ\82\82ç\82¢\82©\82©\82è\82Ü\82·\81B
-
-\81\9cmkdbtarball.rb $1 $2
-\97á: ./mkdbtarball.rb /usr/local/lib/xemacs-21.4.10/i686-pc-linux/ /var/tmp
-char-db\82Ìtarball(char-db.tar.gz)\82ð\8dì\82è\82Ü\82·\81B
-$1\82Échar-db\82Ì\82 \82è\82©\82ð\8ew\92è\82µ\82Ü\82·\81B
-\82Ü\82¸$2\82Ì\82Æ\82±\82ë(\8ew\92è\96³\82¯\82ê\82Î/var/tmp)\82Échar-db\82ð\82Ü\82é\82²\82Æ\83R\83s\81[\82µ\81A
-\83t\83@\83C\83\8b\96¼\82Ì\95¶\8e\9a\95Ï\8a·\82ð\8ds\82¢\81Achar-db.tar.gz\82ð\8dì\82è\82Ü\82·\81B
-< > * ? \81¨ ( ) + !
-Windows\82Ì\83t\83@\83C\83\8b\96¼\90§\8cÀ\82Å\81A\8fã\8bL\82Ì\8d¶\91¤\82Ì\95¶\8e\9a\82ª\8eg\82¦\82È\82¢\82½\82ß\81A
-\82»\82ê\82ç\82Ì\95¶\8e\9a\82ð\89E\91¤\82Ì\95¶\8e\9a\82É\92u\82«\82©\82¦\82Ä\82©\82ç\81Atar.gz\82ð\8dì\82è\82Ü\82·\81B
-
-\81\9ctrim_bom.rb
-\95¶\93ª\82É\82 \82éBOM(byte order mark)\82ð\8eæ\82è\8f\9c\82«\82Ü\82·\81B
+* tools for Chise Character DataBase management
+
+** make-chisedb-tarball.rb
+
+ Usage: make-chisedb-tarball.rb <directory of XEmacs CHISE> <tmp dir>
+
+example.
+ % ./make-chisedb-tarball.rb /usr/local/lib/xemacs-21.4.14/i686-pc-linux
+
+This makes a tarball (chise-db.tar.gz) of the Chise Character DataBase
+files. Set a directory that contains "chise-db" directory to the
+first argument. You can input the temp directory to the second arg.
+(default value: /var/tmp)
+
+This tools also rename the characters that contains Windows forbidden
+characters.
+
+ < > * ? \81¨ ( ) + !
+
+** rename-files.rb
+
+Currently, the directory tree of XEmacs CHISE and the requirement of
+libchise is not same. This tool renames the old files trees to the
+new file trees.
+
+** move-obsolete-files.rb
+
+There are some obsolete features. This tool moves the obsolete files
+to a directory.
+
+** dump-database.rb
+
+This tool dumps all data of the database to text files.
+You can see the inside of the database. It's convenient.
+
+** make_ids_db.rb
+
+This tool read the all of IDS test files, parse them and store them to
+BDB files. Then, you can use some ids features as normal features.
+It's very slow. It takes time almost 1 hour.
+
+** trim_bom.rb
+
+This tool remove a BOM (Byte Order Mark) in the head of file.
+
+====
+by Kouichirou Eto, http://eto.com/
+++ /dev/null
-#!/bin/csh -f
-# Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
-
-scp aqua.eto.com:work/chise/ruby/tools/chise-db.tar.gz .
#!/usr/bin/env ruby
# Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
-$LOAD_PATH.unshift("..")
-require "chise/char"
-require "chise/qp"
-
-module CHISE
- class DataBaseManagement
- def dump_all
- #CharDB.instance.dump_all()
- #CodesysDB.instance.dump_all()
-
- cd = ChiseDB.instance
- path = cd.location+"character/feature"
-
- cd.each_feature {|f|
- ft = cd.get_feature(f)
- h = {}
- ft.each {|k, v|
- h[k] = v
- }
-
- f = f.path
- f = f.escape
- f = f.escape_win_filename
- txt = f.to_s+".txt"
- qp f, txt
- t = path+txt
-
- t.open("wb"){|out|
- h.sort.each {|k, v|
- out.printf("%s\t%s\n", k, v)
- }
- }
-
- ft.close
- }
- end
-
- def dump_db(t)
- db = get(t)
- return nil unless db
- file = get_filename(t)
- open("#{file}.txt", "w"){|out|
- # out.binmode.sync = true
- ar = db.to_a
- ar.map! {|k, v| [to_num(k), to_num(v)] }
- ar.sort.each {|k, v|
- out.printf("%s\t%s\n", k, v)
- }
- }
- true
- end
-
-
- end
-end
+require "management"
man = CHISE::DataBaseManagement.new
man.dump_all
$LOAD_PATH.unshift("..")
require "find"
+require "pathname"
+require "fileutils"
require "chise/util"
def usage()
print "Usage: make-chisedb-tarball.rb <directory of XEmacs CHISE> <tmp dir>\n"
- print "% ./make-chisedb-tarball.rb /usr/local/lib/xemacs-21.4.14/i686-pc-linux /var/tmp\n"
+ print "% ./make-chisedb-tarball.rb /usr/local/lib/xemacs-21.4.14/i686-pc-linux /var/tmp\n"
exit
end
def main(argv)
usage if argv.length < 1
dir = argv.shift
- unless FileTest.directory?(dir+"/chise-db")
- print "no chise-db here. #{dir}\n"
+ path = dir.path
+ dbpath = dir+"chise-db"
+ unless dbpath.directory?
+ print "no chise-db here. #{dbpath.to_s}\n"
usage
end
tmpdir = argv.shift
tmpdir = "/var/tmp" if tmpdir.nil?
+ tmppath = tmpdir.path
orgdir = Dir.pwd
- Dir.chdir(tmpdir) # \93K\93\96\82Èdir\82É\88Ú\93®\82µ\82Ä\82©\82ç
- system "cp -a #{dir}/chise-db ." # \82Ü\82¸\82»\82Ìdirectory\82É\96â\93\9a\96³\97p\82Å\91S\95\94\83R\83s\81[\82·\82é\81B
-
- Find.find("."){|f|
- if f =~ /([*?<>])/ # Windows\82É\82¨\82¯\82é\8bÖ\8e~\95¶\8e\9a\82ª\8aÜ\82Ü\82ê\82Ä\82¢\82½\82ç\81A\92u\8a·\82·\82é
- nf = CHISE.unix_to_win(f)
- cmd = "mv '#{f}' '#{nf}'"
- #print cmd, "\n"
- system cmd
- end
- }
- system "tar czf chise-db.tar.gz chise-db"
- system "mv chise-db.tar.gz #{orgdir}"
- system "rm -rf #{tmpdir}/chise-db"
+ tmppath.chdir {
+ system "cp -a #{dir}/chise-db ." # copy all of the chise-db to the dir.
+
+ ".".path.find {|f|
+ if f =~ /([*?<>])/ # escape for Windows forbidden characters.
+ nf = f.escape_win_filename
+ cmd = "mv '#{f}' '#{nf}'"
+ #print cmd, "\n"
+ system cmd
+ end
+ }
+
+ system "tar czf chise-db.tar.gz chise-db"
+ system "mv chise-db.tar.gz #{orgdir}"
+ system "rm -rf #{tmpdir}/chise-db"
+
+ }
end
main(ARGV)
# Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
$LOAD_PATH.unshift("..")
+require "chise/char"
require "pathname"
require "fileutils"
require "chise/config"
module CHISE
class DataBaseManagement
def dump_all
-#CharDB.instance.dump_all()
-#CodesysDB.instance.dump_all()
+ cd = ChiseDB.instance
+ path = cd.location+"character/feature"
+
+ cd.each_feature {|f|
+ ft = cd.get_feature(f)
+ h = {}
+ ft.each {|k, v|
+ h[k] = v
+ }
+
+ f = f.path.escape.escape_win_filename
+ txt = f.to_s+".txt"
+ #qp f.to_s, txt
+ t = path+txt
+
+ t.open("wb"){|out|
+ h.sort.each {|k, v|
+ out.printf("%s\t%s\n", k, v)
+ }
+ }
+
+ ft.close
+ }
+ end
+
+ def dump_db(t)
+ db = get(t)
+ return nil unless db
+ file = get_filename(t)
+ open("#{file}.txt", "w"){|out|
+ # out.binmode.sync = true
+ ar = db.to_a
+ ar.map! {|k, v| [to_num(k), to_num(v)] }
+ ar.sort.each {|k, v|
+ out.printf("%s\t%s\n", k, v)
+ }
+ }
+ true
end
end
--- /dev/null
+#!/bin/csh -f
+# Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
+
+scp aqua.eto.com:work/chise/ruby/tools/chise-db.tar.gz .