+#include <string.h>
+#include <alloca.h>
#include <chise.h>
-char db_dir[] = "/usr/local/lib/chise/char-db";
-int
+static int
+test_name_map_func (CHISE_DS *ds, unsigned char *name)
+{
+ printf ("feature : %s\n", name);
+ return 0;
+}
+
+static int
test_map_func (CHISE_Char_ID cid, CHISE_Feature_Table *db,
CHISE_Value *valdatum)
{
main (int argc, char* argv[])
{
CHISE_DS *ds;
+#if 0
CHISE_CCS ccs_daikanwa;
+#endif
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];
+ unsigned char *db_dir;
+
+ printf("chise_db_dir = %s\n", chise_db_dir);
+
+ db_dir = (unsigned char*)alloca (strlen (chise_db_dir) + 4);
+ if (db_dir == NULL)
+ {
+ printf ("Can't open data source\n");
+ return -1;
+ }
+ strcpy (db_dir, chise_db_dir);
+ strcat (db_dir, "db/");
+ printf("db_dir = '%s'\n", db_dir);
/* open a data-source */
ds = CHISE_DS_open (CHISE_DS_Berkeley_DB, db_dir,
* get a character corresponding with Daikanwa number 364
*/
+#if 1
+ char_id = chise_ds_decode_char (ds, "=daikanwa", 364);
+#else
/* setup a decoding-table */
ccs_daikanwa
= chise_ds_get_ccs (ds, "=daikanwa");
/* get a character from the decoding-table */
char_id = chise_ccs_decode (ccs_daikanwa, 364);
-
+#endif
/* get a feature-value of the character */
ft_ideographic_structure
else
printf ("#x%X\n", char_id);
+ chise_ds_foreach_char_feature_name (ds, &test_name_map_func);
+
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);
+ chise_feature_foreach_char_with_value (ft_ascii, &test_map_func);
+ chise_feature_foreach_char_with_value
+ (ft_ideographic_structure, &test_map_func);
/* close the data-source */
CHISE_DS_close (ds);
+
+ return 0;
}