require "bdb"
require "chise/config"
require "chise/rbchise"
+require "chise/management"
module CHISE
return @pre + t + @post
end
- def get_dirname(t) File.dirname(get_filename(t)) end
+ def get_dirname(t)
+ File.dirname(get_filename(t))
+ end
def open_dbs()
@dbs = Hash.new
t.sub!(%r|#{@post}$|, "") if @post != ""
keys << t
}
- return keys
+ keys
end
def close_db(t)
@common = db.get_codesys("=jis-x0208")
@newest = db.get_codesys("japanese-jisx0208-1990")
end
+
def get_char(code)
char = @common.get(code)
return char unless char.nil?
end
end
- class DBS_Management # DataBase file management
- OBSOLETE_ATTRIBUTES = "
-cns-radical
-cns-radical?
-kangxi-radical
-daikanwa-radical
-unicode-radical
-
-cns-strokes
-kangxi-strokes
-daikanwa-strokes
-shinjigen-1-radical
-gb-original-radical
-japanese-strokes
-jis-strokes-a
-jis-strokes-b
-jisx0208-strokes
-jis-x0213-strokes
-jisx0213-strokes
-unicode-strokes
-
-totalstrokes
-cns-total-strokes
-jis-total-strokes-b
-
-non-morohashi
-
-=>ucs*
-#=>mojikyo
-#=mojikyo
-->identical
-
-ancient-ideograph-of
-ancient-char-of-shinjigen-1
-original-ideograph-of
-original-char-of-shinjigen-1
-simplified-ideograph-of
-vulgar-ideograph-of
-vulgar-char-of-shinjigen-1
-ideograph=
-ideographic-variants
-variant-of-shinjigen-1
-
-iso-10646-comment
-".split
-
- def initialize
- dir = Config.instance.db_dir
- @odir = dir+"/system-char-id/obsolete" #直打ちしている。
- end
-
- def move_obsolete_files # move obsolete BDB files to obsolete directory
- db = CharDB.instance
- db.close_all
- Dir.mkdir(@odir) unless FileTest.directory? @odir
- OBSOLETE_ATTRIBUTES.each {|attr|
- next if attr =~ /^#/
- filename = db.get_filename(attr)
- move_to_obsolete(filename)
- move_to_obsolete(filename+".txt")
- }
- end
-
- def move_to_obsolete(file)
- cmd = "mv \"#{file}\" #{@odir}"
- # p cmd
- system cmd
- end
-
- end
end