+#include <stdlib.h>
#include <string.h>
#include <alloca.h>
#include <chise.h>
+CHISE_DS *ds;
static int
test_name_map_func (CHISE_DS *ds, unsigned char *name)
CHISE_Value *valdatum)
{
unsigned char buf[256];
+ unsigned char name[256];
+ int ucs = -1;
+
+ printf ("#x%08X ", cid);
+
+ if ( chise_char_gets_feature_value
+ (cid, chise_ds_get_feature (ds, "=ucs"),
+ buf, sizeof (buf)) != NULL )
+ {
+ ucs = atoi (buf);
+ printf ("[U-%08X]", ucs);
+ }
+ else if ( chise_char_gets_feature_value
+ (cid, chise_ds_get_feature (ds, "=>ucs"),
+ buf, sizeof (buf)) != NULL )
+ {
+ ucs = atoi (buf);
+ printf ("(U-%08X)", ucs);
+ }
+ else
+ printf (" ");
+
+ if ( chise_char_gets_feature_value
+ (cid, chise_ds_get_feature (ds, "name"),
+ name, sizeof (name)) != NULL )
+ printf (" %s", name);
- printf ("(flags = %x)\n", valdatum->flags);
if (chise_value_size (valdatum) < 256)
{
strncpy (buf, chise_value_data (valdatum),
chise_value_size (valdatum));
buf[chise_value_size (valdatum)] = '\0';
- printf ("#x%04X\t(%c)\t%s\n", cid, cid, buf);
+ printf ("\t%s\n", buf);
}
else
- printf ("#x%04X\t(%c)\t%s\n",
- cid, cid, chise_value_to_c_string (valdatum));
+ printf ("\t%s\n",
+ chise_value_to_c_string (valdatum));
return 0;
}
int
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;
+ CHISE_Feature ft_numeric_value;
CHISE_Char_ID char_id;
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);
+ printf("chise_system_db_dir = %s\n", chise_system_db_dir);
/* open a data-source */
- ds = CHISE_DS_open (CHISE_DS_Berkeley_DB, db_dir,
- real_subtype, modemask);
+ ds = CHISE_DS_open (CHISE_DS_Berkeley_DB, chise_system_db_dir,
+ 0 /* DB_HASH */, 0755 /* rwxr-xr-x */);
if (ds == NULL)
{
printf ("Can't open data source\n");
chise_ds_foreach_char_feature_name (ds, &test_name_map_func);
- ft_ascii = chise_ds_get_feature (ds, "ascii");
- chise_feature_foreach_char_with_value (ft_ascii, &test_map_func);
+ ft_numeric_value = chise_ds_get_feature (ds, "numeric-value");
+ chise_feature_foreach_char_with_value (ft_numeric_value, &test_map_func);
chise_feature_foreach_char_with_value
(ft_ideographic_structure, &test_map_func);