From: tomo Date: Thu, 2 Oct 2003 09:58:49 +0000 (+0000) Subject: Update for the latest API. X-Git-Tag: b1-r0_2_0-pre5~1 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=ee079215b68f9a71f6f16da5ec56ee676b0c88ae;p=chise%2Flibchise.git Update for the latest API. --- diff --git a/sample.c b/sample.c index 05093db..179c021 100644 --- a/sample.c +++ b/sample.c @@ -27,18 +27,18 @@ main (int argc, char* argv[]) { CHISE_DS *ds; CHISE_CCS ccs_daikanwa; - CHISE_Feature_Table *ft_ideographic_structure; - CHISE_Feature_Table *ft_ascii; - int modemask; - int accessmask = 0; - DBTYPE real_subtype; + CHISE_Feature ft_ideographic_structure; + CHISE_Feature ft_ascii; + int modemask = 0755; /* rwxr-xr-x */ + DBTYPE real_subtype = DB_HASH; int status; CHISE_Char_ID char_id; CHISE_Value value; unsigned char buf[1024]; /* open a data-source */ - ds = chise_open_data_source (CHISE_DS_Berkeley_DB, db_dir); + ds = chise_open_data_source (CHISE_DS_Berkeley_DB, db_dir, + real_subtype, modemask); if (ds == NULL) { printf ("Can't open data source\n"); @@ -50,14 +50,9 @@ main (int argc, char* argv[]) * get a character corresponding with Daikanwa number 364 */ - modemask = 0755; /* rwxr-xr-x */ - real_subtype = DB_HASH; - accessmask = DB_RDONLY; - /* setup a decoding-table */ ccs_daikanwa - = chise_ds_get_ccs (ds, "=daikanwa", - real_subtype, accessmask, modemask); + = chise_ds_get_ccs (ds, "=daikanwa"); if (ccs_daikanwa == NULL) { printf ("Can't open CCS =daikanwa\n"); @@ -71,16 +66,14 @@ main (int argc, char* argv[]) /* get a feature-value of the character */ ft_ideographic_structure - = chise_ds_get_feature (ds, "ideographic-structure", - real_subtype, accessmask, modemask); + = chise_ds_get_feature (ds, "ideographic-structure"); if (chise_char_gets_feature_value (char_id, ft_ideographic_structure, buf, sizeof (buf)) != NULL) printf ("#x%X => %s\n", char_id, buf); else printf ("#x%X\n", char_id); - ft_ascii = chise_ds_get_feature (ds, "ascii", - real_subtype, accessmask, modemask); + ft_ascii = chise_ds_get_feature (ds, "ascii"); chise_char_feature_value_iterate (ft_ascii, &test_map_func); chise_char_feature_value_iterate (ft_ideographic_structure, &test_map_func);