3 char db_dir[] = "/usr/local/lib/chise/char-db";
6 test_map_func (CHISE_Feature_Table *db,
7 CHISE_Char_ID cid, CHISE_Value *valdatum)
9 printf ("#x%04X\t(%c)\t%s\n",
10 cid, cid, chise_value_to_c_string (valdatum));
15 main (int argc, char* argv[])
18 CHISE_Decoding_Table *dt_daikanwa;
19 CHISE_Feature_Table *ft_ideographic_structure;
20 CHISE_Feature_Table *ft_ascii;
25 CHISE_Char_ID char_id;
28 /* open a data-source */
29 ds = chise_open_data_source (CHISE_DS_Berkeley_DB, db_dir);
37 * get a character corresponding with Daikanwa number 364
40 modemask = 0755; /* rwxr-xr-x */
41 real_subtype = DB_HASH;
42 accessmask = DB_RDONLY;
44 /* setup a decoding-table */
46 = chise_ds_open_decoding_table (ds, "=daikanwa",
47 real_subtype, accessmask, modemask);
48 if (dt_daikanwa == NULL)
54 /* get a character from the decoding-table */
55 char_id = chise_dt_get_char (dt_daikanwa, 364);
57 /* close the decoding-table */
58 chise_dt_close (dt_daikanwa);
62 * get a ideographic-structure feature of the character
65 /* setup a feature-table */
66 ft_ideographic_structure
67 = chise_ds_open_feature_table (ds, "ideographic-structure",
68 real_subtype, accessmask, modemask);
69 if (ft_ideographic_structure == NULL)
75 /* setup a feature-table */
76 ft_ascii = chise_ds_open_feature_table (ds, "ascii",
77 real_subtype, accessmask, modemask);
84 /* get a feature-value of the character */
85 status = chise_ft_get_value (ft_ideographic_structure, char_id, &value);
88 printf ("#x%X => %s\n", char_id, chise_value_to_c_string(&value));
90 printf ("#x%X (%d)\n", char_id, status);
92 chise_ft_iterate (ft_ascii, &test_map_func);
93 chise_ft_iterate (ft_ideographic_structure, &test_map_func);
95 /* close the feature-table */
96 chise_ft_close (ft_ideographic_structure);
97 chise_ft_close (ft_ascii);
99 /* close the data-source */