From 94b3c1ba8be4bfc7ce992150f3f7b003c74dfbe7 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Sun, 14 Apr 2013 18:32:40 +0900 Subject: [PATCH] (cos_string_p): New function. (concord_object_get_feature_value): Use `cos_read_char' and `cos_read_string' to parse character and string. --- cos.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cos.c b/cos.c index 6fc2f3f..9e09502 100644 --- a/cos.c +++ b/cos.c @@ -181,6 +181,11 @@ cos_release_string (COS_Object obj) return 0; } +int cos_string_p (COS_object obj) +{ + return COS_OBJECT_STRING_P (obj); +} + size_t cos_string_size (COS_String string) { @@ -408,6 +413,9 @@ concord_object_get_feature_value (COS_object object, COS_object feature) CONCORD_Feature fobj; CONCORD_String_Tank val_st; COS_String val_string; + size_t end; + int val_cid; + COS_String val_str; if (COS_OBJECT_CHAR_P (object)) { @@ -432,5 +440,17 @@ concord_object_get_feature_value (COS_object object, COS_object feature) concord_feature_get_name (fobj), cos_string_data (val_string)); + val_cid = cos_read_char (CONCORD_String_data (&val_st), + CONCORD_String_size (&val_st), + 0, &end); + if ( val_cid >= 0 ) + return cos_make_char (val_cid); + + val_str = cos_read_string (CONCORD_String_data (&val_st), + CONCORD_String_size (&val_st), + 0, &end); + if ( val_str != NULL ) + return val_str; + return NULL; } -- 1.7.10.4