From: tomo Date: Tue, 14 Oct 2003 09:47:28 +0000 (+0000) Subject: (chise_ds_foreach_char_feature_name): Read X-Git-Tag: b1-r0_2_0-pre9~3 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cdf45609d6ee9a8983a859cc653c53f4a1b0a0e4;p=chise%2Flibchise.git (chise_ds_foreach_char_feature_name): Read ${db_dir}/character/feature/ instead of ${db_dir}/system-char-id. (chise_feature_setup_db): Modify for `CHISE_Attribute_Table_open'. (chise_ccs_setup_db): Likewise. (CHISE_Attribute_Table_open): Change interface to specify category/key_type/name instead of encoding/feature. --- diff --git a/chise.c b/chise.c index 111a52f..0568eb0 100644 --- a/chise.c +++ b/chise.c @@ -28,7 +28,8 @@ typedef DB CHISE_Attribute_Table; CHISE_Attribute_Table* CHISE_Attribute_Table_open (const unsigned char *db_dir, - const char *encoding, const char *feature, + const char *category, + const char *key_type, const char *name, DBTYPE real_subtype, u_int32_t accessmask, int modemask); @@ -159,12 +160,12 @@ chise_ds_foreach_char_feature_name (CHISE_DS *ds, unsigned char *name)) { unsigned char *dname - = alloca (strlen (ds->location) + sizeof ("/system-char-id") + 1); + = alloca (strlen (ds->location) + sizeof ("/character/feature") + 1); DIR *dir; struct dirent *de; strcpy (dname, ds->location); - strcat (dname, "/system-char-id"); + strcat (dname, "/character/feature"); if ( (dir = opendir (dname)) == NULL) return -1; @@ -334,8 +335,8 @@ chise_feature_setup_db (CHISE_Feature feature, int writable) CHISE_DS *ds = feature->ds; feature->db - = CHISE_Attribute_Table_open (ds->location, - "system-char-id", feature->name, + = CHISE_Attribute_Table_open (ds->location, "character", + "feature", feature->name, ds->subtype, access, ds->modemask); if (feature->db == NULL) return -1; @@ -529,8 +530,8 @@ chise_ccs_setup_db (CHISE_CCS ccs, int writable) CHISE_DS *ds = ccs->ds; ccs->db - = CHISE_Attribute_Table_open (ds->location, - ccs->name, "system-char-id", + = CHISE_Attribute_Table_open (ds->location, "character", + "by_feature", ccs->name, ds->subtype, access, ds->modemask); if (ccs->db == NULL) return -1; @@ -599,13 +600,14 @@ chise_ccs_set_decoded_char (CHISE_CCS ccs, CHISE_Attribute_Table* CHISE_Attribute_Table_open (const unsigned char *db_dir, - const char *encoding, const char *feature, + const char *category, + const char *key_type, const char *name, DBTYPE real_subtype, u_int32_t accessmask, int modemask) { DB* dbase; int status; - int len, flen, i; + int len, name_len, i; int size; char *db_file_name, *sp; struct stat statbuf; @@ -618,8 +620,8 @@ CHISE_Attribute_Table_open (const unsigned char *db_dir, mkdir (db_dir, modemask); len = strlen (db_dir); - flen = strlen (feature); - size = len + strlen (encoding) + flen * 3 + 4; + name_len = strlen (name); + size = len + strlen (category) + strlen (key_type) + name_len * 3 + 5; db_file_name = alloca (size); strcpy (db_file_name, db_dir); if (db_file_name[len - 1] != '/') @@ -627,17 +629,22 @@ CHISE_Attribute_Table_open (const unsigned char *db_dir, db_file_name[len++] = '/'; db_file_name[len] = '\0'; } - strcat (db_file_name, encoding); + strcat (db_file_name, category); if ( (accessmask & DB_CREATE) && stat (db_file_name, &statbuf) ) mkdir (db_file_name, modemask); + strcat (db_file_name, "/"); + strcat (db_file_name, key_type); + if ( (accessmask & DB_CREATE) && stat (db_file_name, &statbuf) ) + mkdir (db_file_name, modemask); strcat (db_file_name, "/"); - /* strcat (db_file_name, feature); */ + + /* strcat (db_file_name, name); */ sp = &db_file_name[strlen (db_file_name)]; - for (i = 0; i < flen; i++) + for (i = 0; i < name_len; i++) { - int c = feature[i]; + int c = name[i]; if ( (c == '/') || (c == '%') ) {