X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=chise.c;h=2ac1ebbcb5420365a4ef3c5fdb86cfde7d08bf18;hb=04f25c3dac6e46dc936f54531ff614b5a2b29a49;hp=476a005b6ca776ba608e29f386cf1a598d622598;hpb=f6341af9e9b44d468736016e799bfa6ff7f5a35a;p=chise%2Flibchise.git diff --git a/chise.c b/chise.c index 476a005..2ac1ebb 100644 --- a/chise.c +++ b/chise.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003,2004,2005 MORIOKA Tomohiko +/* Copyright (C) 2003,2004,2005,2011 MORIOKA Tomohiko This file is part of the CHISE Library. The CHISE Library is free software; you can redistribute it and/or @@ -65,7 +65,11 @@ CHISE_DS* CHISE_DS_open (CHISE_DS_Type type, const unsigned char* location, int subtype, int modemask) { +#if 0 CONCORD_DS ds = concord_open_ds (type, location, subtype, modemask); +#else + CONCORD_DS ds = concord_open_env (location); +#endif if (ds == NULL) return NULL; @@ -152,6 +156,46 @@ chise_char_load_feature_value (CHISE_Char_ID cid, return concord_obj_get_feature_value_string (key_buf, feature, valdatum); } +int +chise_char_load_decomposition (CHISE_Char_ID cid, + CHISE_Feature feature, + CHISE_Char_ID* base_char, CHISE_Char_ID* comb_char) +{ + unsigned char key_buf[8]; + CHISE_Value value; + int status; + unsigned char* vp; + unsigned char* vp_ret; + int len; + + chise_format_char_id (cid, key_buf, 8); + if ( status = concord_obj_get_feature_value_string (key_buf, feature, &value) ) + return status; + len = chise_value_size (&value); + if ( len < (1 + 2 + 1 + 2 + 1) ) + return -1; + + vp = chise_value_data (&value); + if ( *vp++ != '(' ) + return -1; + len--; + + if ( ( vp_ret = memchr (vp, ' ', len) ) == NULL ) + return -1; + *base_char = chise_char_id_parse_c_string (vp, vp_ret - vp + 1); + if ( *base_char == -1 ) + return -1; + vp = vp_ret + 1; + len -= vp - chise_value_data (&value); + if ( len <= 1 ) + return -1; + + *comb_char = chise_char_id_parse_c_string (vp, len); + if ( *comb_char == -1 ) + return -1; + return 0; +} + unsigned char* chise_char_gets_feature_value (CHISE_Char_ID cid, CHISE_Feature feature,