n.c.
[chise/ruby.git] / tools / dump-database.rb
index d116f47..5894e92 100755 (executable)
@@ -1,61 +1,7 @@
 #!/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