1 # Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
2 # "rbchise.so" ext compatible library by eto 2003-0317
12 def initialize(type = Berkeley_DB, location = nil)
13 @type, @location = type, location
14 @location = Config.instance.db_dir if @location.nil?
23 def open_decoding_table(ccs)
24 db = open(ccs, "system-char-id")
25 DecodingTable.new(ccs, db)
28 def open_feature_table(feature)
29 db = open("system-char-id", feature)
30 FeatureTable.new(feature, db)
33 def open(from, to) # real_subtpe, accessmask, modemask
35 return @dbs[name] if @dbs[name]
36 file = @location+"/"+name
37 @dbs[name] = BDB::Hash.open(file, nil, 0)
41 class AttributeTable # abstract class
44 class DecodingTable < AttributeTable
45 def initialize(ccs, db)
49 def get_char(code_point)
53 def put_char(code_point, cid)
54 @db.put(code_point, cid)
58 class FeatureTable < AttributeTable
59 def initialize(feature, db)
60 @feature, @db = feature, db
63 def get_value(char_id)