n.c.
[chise/ruby.git] / chise / rbchise.rb
index 789dbe9..6391dc3 100755 (executable)
@@ -1,80 +1,3 @@
 # Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
-# "rbchise.so" ext compatible library by eto 2003-0317
 
-require "bdb"
-require "chise/config"
-
-module CHISE
-  class DataSource
-    NONE = 0
-    Berkeley_DB = 1
-
-    def initialize(type = Berkeley_DB, location = nil)
-      @type, @location = type, location
-      @location = Config.instance.db_dir if @location.nil?
-      @fnames = {}
-      @cnames_names = {}
-      at_exit {
-       @fnames.each {|k, db| db.close }
-       @cnames.each {|k, db| db.close }
-      }
-    end
-
-    def get_feature(feature)
-      @fnames[feature] = open_feature(feature) if @fnames[feature].nil?
-      @fnames[feature] 
-    end
-
-    def decode_char(name, code_point)
-      ccs = get_ccs(name)
-      ccs.decode(code_point)
-    end
-
-    def get_ccs(name)
-      db = open(name, "system-char-id")
-      CCSTable.new(name, db)
-    end
-
-    def open_feature_table(feature)
-      db = open("system-char-id", feature)
-      FeatureTable.new(feature, db)
-    end
-
-    def open(from, to) # real_subtpe, accessmask, modemask
-      name = from+"/"+to
-      return @dbs[name] if @dbs[name]
-      file = @location+"/"+name
-      @dbs[name] = BDB::Hash.open(file, nil, 0)
-    end
-  end
-
-  class AttributeTable # abstract class
-  end
-  
-  class CCSTable < AttributeTable
-    def initialize(ccs, db)
-      @ccs, @db = ccs, db
-    end
-
-    def get_char(code_point)
-      @db.get(code_point)
-    end
-
-    def put_char(code_point, cid)
-      @db.put(code_point, cid)
-    end
-  end
-
-  class FeatureTable < AttributeTable
-    def initialize(feature, db)
-      @feature, @db = feature, db
-    end
-
-    def get_value(char_id)
-      @db.get(char_id)
-    end
-
-    def each
-    end
-  end
-end
+require "chise/libchise"