9 test_name_map_func (CHISE_DS *ds, unsigned char *name)
11 printf ("feature : %s\n", name);
16 test_map_func (CHISE_Char_ID cid, CHISE_Feature_Table *db,
17 CHISE_Value *valdatum)
19 unsigned char buf[256];
20 unsigned char name[256];
23 printf ("#x%08X ", cid);
25 if ( chise_char_gets_feature_value
26 (cid, chise_ds_get_feature (ds, "=ucs"),
27 buf, sizeof (buf)) != NULL )
30 printf ("[U-%08X]", ucs);
32 else if ( chise_char_gets_feature_value
33 (cid, chise_ds_get_feature (ds, "=>ucs"),
34 buf, sizeof (buf)) != NULL )
37 printf ("(U-%08X)", ucs);
42 if ( chise_char_gets_feature_value
43 (cid, chise_ds_get_feature (ds, "name"),
44 name, sizeof (name)) != NULL )
47 if (chise_value_size (valdatum) < 256)
49 strncpy (buf, chise_value_data (valdatum),
50 chise_value_size (valdatum));
51 buf[chise_value_size (valdatum)] = '\0';
52 printf ("\t%s\n", buf);
56 chise_value_to_c_string (valdatum));
61 main (int argc, char* argv[])
64 CHISE_CCS ccs_daikanwa;
66 CHISE_Feature ft_ideographic_structure;
67 CHISE_Feature ft_numeric_value;
68 CHISE_Char_ID char_id;
69 unsigned char buf[1024];
71 printf("chise_system_db_dir = %s\n", chise_system_db_dir);
73 /* open a data-source */
74 ds = CHISE_DS_open (CHISE_DS_Berkeley_DB, chise_system_db_dir,
75 0 /* DB_HASH */, 0755 /* rwxr-xr-x */);
78 printf ("Can't open data source\n");
84 * get a character corresponding with Daikanwa number 364
88 char_id = chise_ds_decode_char (ds, "=daikanwa", 364);
90 /* setup a decoding-table */
92 = chise_ds_get_ccs (ds, "=daikanwa");
93 if (ccs_daikanwa == NULL)
95 printf ("Can't open CCS =daikanwa\n");
100 /* get a character from the decoding-table */
101 char_id = chise_ccs_decode (ccs_daikanwa, 364);
104 /* get a feature-value of the character */
105 ft_ideographic_structure
106 = chise_ds_get_feature (ds, "ideographic-structure");
107 if (chise_char_gets_feature_value
108 (char_id, ft_ideographic_structure, buf, sizeof (buf)) != NULL)
109 printf ("#x%X => %s\n", char_id, buf);
111 printf ("#x%X\n", char_id);
113 chise_ds_foreach_char_feature_name (ds, &test_name_map_func);
115 ft_numeric_value = chise_ds_get_feature (ds, "numeric-value");
116 chise_feature_foreach_char_with_value (ft_numeric_value, &test_map_func);
117 chise_feature_foreach_char_with_value
118 (ft_ideographic_structure, &test_map_func);
120 /* close the data-source */