update.
[chise/libchise.git] / chise.h
diff --git a/chise.h b/chise.h
index 87cea05..8bd4d05 100644 (file)
--- a/chise.h
+++ b/chise.h
@@ -1,4 +1,5 @@
 #ifndef _CHISE_H
+#define _CHISE_H
 
 #include <db.h>
 #include <errno.h>
@@ -12,13 +13,12 @@ typedef enum CHISE_DS_Type
 typedef struct CHISE_DS
 {
   CHISE_DS_Type type;
-  char *location;
+  unsigned char *location;
 } CHISE_DS;
 
-int chise_open_data_source (CHISE_DS *ds, CHISE_DS_Type type,
-                           char *location);
+CHISE_DS* chise_open_data_source (CHISE_DS_Type type, char *location);
 
-int chise_close_data_source (CHISE_DS *ds);
+int chise_ds_close (CHISE_DS *ds);
 
 
 typedef int CHISE_Char_ID;
@@ -45,36 +45,43 @@ chise_value_to_c_string (const CHISE_Value *s)
 }
 
 
-typedef DB CHISE_Attribute_Table;
+typedef struct CHISE_Attribute_Table
+{
+  CHISE_DS *ds;
+  DB *db;
+} CHISE_Attribute_Table;
 
 
 typedef CHISE_Attribute_Table CHISE_Decoding_Table;
 
-int chise_open_decoding_table (CHISE_Decoding_Table **db,
-                              CHISE_DS *ds, const char *ccs,
-                              DBTYPE real_subtype,
-                              u_int32_t accessmask, int modemask);
+CHISE_Decoding_Table*
+chise_ds_open_decoding_table (CHISE_DS *ds, const char *ccs,
+                             DBTYPE real_subtype,
+                             u_int32_t accessmask, int modemask);
+
+int chise_dt_close (CHISE_Decoding_Table *table);
 
-int chise_close_decoding_table (CHISE_Decoding_Table *db);
+CHISE_Char_ID chise_dt_get_char (CHISE_Decoding_Table *table, int code_point);
 
-CHISE_Char_ID chise_dt_get_char (CHISE_Decoding_Table *db, int code_point);
+int chise_dt_put_char (CHISE_Decoding_Table *table,
+                      int code_point, CHISE_Char_ID cid);
 
 
 typedef CHISE_Attribute_Table CHISE_Feature_Table;
 
-int chise_open_feature_table (CHISE_Feature_Table **db,
-                             CHISE_DS *ds, const char *feature,
-                             DBTYPE real_subtype,
-                             u_int32_t accessmask, int modemask);
+CHISE_Feature_Table*
+chise_ds_open_feature_table (CHISE_DS *ds, const char *feature,
+                            DBTYPE real_subtype,
+                            u_int32_t accessmask, int modemask);
 
-int chise_close_feature_table (CHISE_Feature_Table *db);
+int chise_ft_close (CHISE_Feature_Table *table);
 
-int chise_ft_get_value (CHISE_Feature_Table *db,
+int chise_ft_get_value (CHISE_Feature_Table *table,
                        CHISE_Char_ID cid, CHISE_Value *valdatum);
 
 void
-chise_ft_iterate (CHISE_Feature_Table *dbp,
-                 int (*func) (CHISE_Feature_Table *db,
+chise_ft_iterate (CHISE_Feature_Table *table,
+                 int (*func) (CHISE_Feature_Table *table,
                               CHISE_Char_ID cid, CHISE_Value *valdatum));
 
 
@@ -84,15 +91,15 @@ int chise_get_feature (CHISE_DS *ds, CHISE_Char_ID cid,
                       char *key, CHISE_Value *valdatum);
 
 
-int chise_open_attribute_table (CHISE_Attribute_Table **db,
-                               const char *db_dir,
-                               const char *encoding, const char *feature,
-                               DBTYPE real_subtype,
-                               u_int32_t accessmask, int modemask);
+CHISE_Attribute_Table*
+chise_open_attribute_table (CHISE_DS *ds,
+                           const char *encoding, const char *feature,
+                           DBTYPE real_subtype,
+                           u_int32_t accessmask, int modemask);
 
-int chise_close_attribute_table (CHISE_Attribute_Table *db);
+int chise_close_attribute_table (CHISE_Attribute_Table *at);
 
-int chise_get_attribute_table (CHISE_Attribute_Table *db,
+int chise_get_attribute_table (CHISE_Attribute_Table *at,
                               char *key, CHISE_Value *valdatum);
 
 #endif /* !_CHISE_H */