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 status = chise_open_data_source (&ds, CHISE_DS_Berkeley_DB, db_dir);
32 chise_close_data_source (&ds);
38 * get a character corresponding with Daikanwa number 364
41 modemask = 0755; /* rwxr-xr-x */
42 real_subtype = DB_HASH;
43 accessmask = DB_RDONLY;
45 /* setup a decoding-table */
46 status = chise_open_decoding_table (&dt_daikanwa, &ds,
49 accessmask, modemask);
52 chise_close_decoding_table (dt_daikanwa);
53 chise_close_data_source (&ds);
57 /* get a character from the decoding-table */
58 char_id = chise_dt_get_char (dt_daikanwa, 364);
60 /* close the decoding-table */
61 chise_close_decoding_table (dt_daikanwa);
65 * get a ideographic-structure feature of the character
68 /* setup a feature-table */
69 status = chise_open_feature_table (&ft_ideographic_structure, &ds,
70 "ideographic-structure",
71 real_subtype, accessmask, modemask);
74 chise_close_feature_table (ft_ideographic_structure);
75 chise_close_data_source (&ds);
79 /* setup a feature-table */
80 status = chise_open_feature_table (&ft_ascii, &ds,
82 real_subtype, accessmask, modemask);
85 chise_close_feature_table (ft_ascii);
86 chise_close_data_source (&ds);
90 /* get a feature-value of the character */
91 status = chise_ft_get_value (ft_ideographic_structure, char_id, &value);
94 printf ("#x%X => %s\n", char_id, chise_value_to_c_string(&value));
96 printf ("#x%X (%d)\n", char_id, status);
98 chise_ft_iterate (ft_ascii, &test_map_func);
99 chise_ft_iterate (ft_ideographic_structure, &test_map_func);
101 /* close the feature-table */
102 chise_close_feature_table (ft_ideographic_structure);
104 chise_close_feature_table (ft_ascii);
107 /* close the data-source */
108 chise_close_data_source (&ds);