}
-struct CHISE_Decoding_Table
+struct CHISE_Feature_Table
{
CHISE_DS *ds;
CHISE_Attribute_Table *db;
};
-CHISE_Decoding_Table*
-chise_ds_open_decoding_table (CHISE_DS *ds, const char *ccs,
- 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)
{
- CHISE_Decoding_Table* table;
+ CHISE_Feature_Table* table;
if (ds == NULL)
return NULL;
- table = (CHISE_Decoding_Table*)malloc (sizeof (CHISE_Decoding_Table));
+ table = (CHISE_Feature_Table*)malloc (sizeof (CHISE_Feature_Table));
if (table == NULL)
return NULL;
table->ds = ds;
table->db = chise_open_attribute_table (ds->location,
- ccs, "system-char-id",
+ "system-char-id", feature,
real_subtype,
accessmask, modemask);
if (table->db == NULL)
}
int
-chise_dt_close (CHISE_Decoding_Table *table)
+chise_ft_close (CHISE_Feature_Table *table)
{
int status;
return status;
}
-CHISE_Char_ID
-chise_dt_get_char (CHISE_Decoding_Table *table, int code_point)
+int
+chise_ft_get_value (CHISE_Feature_Table *table,
+ CHISE_Char_ID cid, CHISE_Value *valdatum)
{
- CHISE_Value valdatum;
- int status = 0;
- char key_buf[16];
-
- sprintf(key_buf, "%d", code_point);
- status = chise_get_attribute_table (table->db, key_buf, &valdatum);
- if (!status)
- {
- unsigned char *str
- = (unsigned char *)chise_value_data (&valdatum);
- int len = strnlen (str, chise_value_size (&valdatum));
+ unsigned char key_buf[8];
- return chise_char_id_parse_c_string (str, len);
- }
- return -1;
+ chise_format_char_id (cid, key_buf, 8);
+ return chise_get_attribute_table (table->db,
+ key_buf, valdatum);
}
-int
-chise_dt_put_char (CHISE_Decoding_Table *table,
- int code_point, CHISE_Char_ID cid)
+void
+chise_ft_iterate (CHISE_Feature_Table *table,
+ int (*func) (CHISE_Feature_Table *table,
+ CHISE_Char_ID cid, CHISE_Value *valdatum))
{
- CHISE_Value valdatum;
- char key_buf[16], val_buf[8];
+ DBT keydatum, valdatum;
+ DBC *dbcp;
+ int status;
- sprintf(key_buf, "%d", code_point);
- chise_format_char_id (cid, val_buf, 8);
- return chise_put_attribute_table (table->db, key_buf, val_buf);
+ xzero (keydatum);
+ xzero (valdatum);
+
+ status = table->db->cursor (table->db, NULL, &dbcp, 0);
+ for (status = dbcp->c_get (dbcp, &keydatum, &valdatum, DB_FIRST);
+ status == 0;
+ status = dbcp->c_get (dbcp, &keydatum, &valdatum, DB_NEXT))
+ {
+ unsigned char *key_str = (unsigned char *)keydatum.data;
+ int key_len = strnlen (key_str, keydatum.size);
+ CHISE_Char_ID key = chise_char_id_parse_c_string (key_str, key_len);
+ int ret;
+
+ if (ret = func (table, key, &valdatum))
+ break;
+ }
+ dbcp->c_close (dbcp);
}
-struct CHISE_Feature_Table
+struct CHISE_Decoding_Table
{
CHISE_DS *ds;
CHISE_Attribute_Table *db;
};
-CHISE_Feature_Table*
-chise_ds_open_feature_table (CHISE_DS *ds, const char *feature,
- 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)
{
- CHISE_Feature_Table* table;
+ CHISE_Decoding_Table* table;
if (ds == NULL)
return NULL;
- table = (CHISE_Feature_Table*)malloc (sizeof (CHISE_Feature_Table));
+ table = (CHISE_Decoding_Table*)malloc (sizeof (CHISE_Decoding_Table));
if (table == NULL)
return NULL;
table->ds = ds;
table->db = chise_open_attribute_table (ds->location,
- "system-char-id", feature,
+ ccs, "system-char-id",
real_subtype,
accessmask, modemask);
if (table->db == NULL)
}
int
-chise_ft_close (CHISE_Feature_Table *table)
+chise_dt_close (CHISE_Decoding_Table *table)
{
int status;
return status;
}
-int
-chise_ft_get_value (CHISE_Feature_Table *table,
- CHISE_Char_ID cid, CHISE_Value *valdatum)
+CHISE_Char_ID
+chise_dt_get_char (CHISE_Decoding_Table *table, int code_point)
{
- unsigned char key_buf[8];
+ CHISE_Value valdatum;
+ int status = 0;
+ char key_buf[16];
- chise_format_char_id (cid, key_buf, 8);
- return chise_get_attribute_table (table->db,
- key_buf, valdatum);
+ sprintf(key_buf, "%d", code_point);
+ status = chise_get_attribute_table (table->db, key_buf, &valdatum);
+ if (!status)
+ {
+ unsigned char *str
+ = (unsigned char *)chise_value_data (&valdatum);
+ int len = strnlen (str, chise_value_size (&valdatum));
+
+ return chise_char_id_parse_c_string (str, len);
+ }
+ return -1;
}
-void
-chise_ft_iterate (CHISE_Feature_Table *table,
- int (*func) (CHISE_Feature_Table *table,
- CHISE_Char_ID cid, CHISE_Value *valdatum))
+int
+chise_dt_put_char (CHISE_Decoding_Table *table,
+ int code_point, CHISE_Char_ID cid)
{
- DBT keydatum, valdatum;
- DBC *dbcp;
- int status;
-
- xzero (keydatum);
- xzero (valdatum);
-
- status = table->db->cursor (table->db, NULL, &dbcp, 0);
- for (status = dbcp->c_get (dbcp, &keydatum, &valdatum, DB_FIRST);
- status == 0;
- status = dbcp->c_get (dbcp, &keydatum, &valdatum, DB_NEXT))
- {
- unsigned char *key_str = (unsigned char *)keydatum.data;
- int key_len = strnlen (key_str, keydatum.size);
- CHISE_Char_ID key = chise_char_id_parse_c_string (key_str, key_len);
- int ret;
+ CHISE_Value valdatum;
+ char key_buf[16], val_buf[8];
- if (ret = func (table, key, &valdatum))
- break;
- }
- dbcp->c_close (dbcp);
+ sprintf(key_buf, "%d", code_point);
+ chise_format_char_id (cid, val_buf, 8);
+ return chise_put_attribute_table (table->db, key_buf, val_buf);
}
+
CHISE_Attribute_Table*
chise_open_attribute_table (const unsigned char *db_dir,
const char *encoding, const char *feature,
}
-typedef struct CHISE_Decoding_Table CHISE_Decoding_Table;
-
-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);
-
-CHISE_Char_ID chise_dt_get_char (CHISE_Decoding_Table *table, int code_point);
-
-int chise_dt_put_char (CHISE_Decoding_Table *table,
- int code_point, CHISE_Char_ID cid);
-
-
typedef struct CHISE_Feature_Table CHISE_Feature_Table;
CHISE_Feature_Table*
CHISE_Char_ID cid, CHISE_Value *valdatum));
+typedef struct CHISE_Decoding_Table CHISE_Decoding_Table;
+
+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);
+
+CHISE_Char_ID chise_dt_get_char (CHISE_Decoding_Table *table, int code_point);
+
+int chise_dt_put_char (CHISE_Decoding_Table *table,
+ int code_point, CHISE_Char_ID cid);
+
+
CHISE_Char_ID chise_decode_char (CHISE_DS *ds, char *ccs, int code_point);
int chise_get_feature (CHISE_DS *ds, CHISE_Char_ID cid,