--- /dev/null
+2006-05-06 Kouichirou Eto <2006 eto.com>
+
+ * idsdb.rb: Adapt to libchise API.
+ * ids.rb: Ditto.
+ * config.rb: Ditto.
+ * chisedb.rb: Ditto.
+
+2006-05-06 Kouichirou Eto <2006 eto.com>
+
+ * Add ChangeLog
setup_ds
@feature_db = {}
@ccs_db = {}
- @byids_db = {}
+ # @byids_db = {}
+ @ccsstr_db = {}
end
attr_reader :ds, :location
ccsdb.decode(code_point)
end
- def get_by_ids_db(n)
+ def nuget_by_ids_db(n)
@byids_db[n] = ByIDS_DB.new(self, n) if @byids_db[n].nil?
@byids_db[n]
end
+ def get_ccs_str(n)
+ @ccsstr_db[n] = CCS_STR.new(self, n) if @ccsstr_db[n].nil?
+# @ccsstr_db[n] = CCS_STR_DB.new(self, n) if @ccsstr_db[n].nil?
+ @ccsstr_db[n]
+ end
+
private
include EachEntryModule
end
end
end
- class ByIDS_DB
+ class CCS_STR_DB
include ParseValueModule
include ChiseValue
include TableAccessModule
}
end
- def decode(ids)
+ def get_by_str(str)
setup_db
return nil if @db.nil?
- parse_c_string(@db.get(ids))
+ parse_c_string(@db.get(str))
end
- def set_decoded_char(ids, cid)
+ def set_by_str(str, cid)
setup_db(true)
raise "@db is nil." if @db.nil?
- @db.put(ids, format_char_id(cid))
+ @db.put(str, format_char_id(cid))
end
def each_char
}
end
end
+
end
module CHISE
# on Winodws
- #DB_DIR = "c:/chise/chise-db" # /character/feature/=ucs
- #IDS_DIR = "c:/chise/ids" # /IDS-JIS-X0208-1990.txt
+ DB_DIR = "c:/chise/chise-db" # /character/feature/=ucs
+ IDS_DIR = "c:/chise/ids" # /IDS-JIS-X0208-1990.txt
# on Unix
- DB_DIR = "/usr/local/lib/xemacs-21.4.14/i686-pc-linux/chise-db"
- IDS_DIR = "/home/eto/work/chise/ids"
+ #DB_DIR = "/usr/local/lib/xemacs-21.4.14/i686-pc-linux/chise-db"
+ #IDS_DIR = "/home/eto/work/chise/ids"
def windows?()
rp = RUBY_PLATFORM
def compose(dbname="ids")
ids = self.aggregate
cd = ChiseDB.instance
- byidsdb = cd.get_by_ids_db(dbname)
- cid = byidsdb.decode(ids)
+ #byids = cd.get_by_ids_db(dbname)
+ byids = cd.get_ccs(dbname)
+ #cid = byids.decode(ids)
+ cid = byids.get_by_str(ids)
return "" if cid.nil? # TO CHECK: why "", not nil?
composed = Character.get(cid).to_s
return "" if composed.nil?
def make_by_ids_db_org
h = {}
- byids = @cd.get_by_ids_db("ids-org")
+ byids = @cd.get_ccs_str("ids-org")
@cd.get_feature("ids-org").each_char {|cid, ids|
char = Character.get(cid)
- byids.set_decoded_char(ids, cid)
+ byids.set_by_str(ids, cid)
h[ids] = cid
}
qp h.length
end
def make_by_ids_db
- byids = @cd.get_by_ids_db("ids")
+ byids = @cd.get_ccs("ids")
@cd.get_feature("ids").each_char {|cid, ids|
char = Character.get(cid)
- byids.set_decoded_char(ids, cid)
+ byids.set_by_str(ids, cid)
}
byids.dump
end
class Pathname
def escape
- s = self.basename.to_s.gsub(/([\/%]+)/n){
+ s = self.to_s.gsub(/([\/%]+)/n){
"%" + $1.unpack("H2" * $1.size).join("%").upcase
}
- Pathname.new(self.dirname+s)
+ Pathname.new(s)
end
def unescape # copied from cgi.rb
#man.store_ids_as_text # 172.024 : 177.618 86470
#man.store_ids_de_er # 47.99 : 38.926 81899
#man.check_integrity_of_ids_tree # 58.185 : 48.015 79417
- #man.make_by_ids_db_org # 29.572 : 24.511 75562
+ man.make_by_ids_db_org # 29.572 : 24.511 75562
#man.store_ids_aggregated # 66.609 : 51.832 79417
#man.store_ids_subparts # 1638.966 : 959.413 79417
#man.store_ids_contained # 773.808 : 696.374
def test_ids_tree_by_character
assert_equal(3, "⿳".char.idc_argument_number)
- assert_equal("⿳士冖匕", "壱".ids)
- assert_equal(3, "壱".ids.to_a[0].char.idc_argument_number)
+# assert_equal("⿳士冖匕", "壱".ids)
+# assert_equal(3, "壱".ids.to_a[0].char.idc_argument_number)
assert_nil(CHISE::IDS_Tree.new("⿳士冖匕").check_integrity)
assert_raise(RuntimeError, "unmatch leaves") { check_tree("⿳士冖") }
assert_raise(RuntimeError, "extra nodes") { check_tree("⿳士冖匕匕") }