From: MORIOKA Tomohiko Date: Thu, 18 Apr 2013 02:15:12 +0000 (+0900) Subject: (cos_cons_p): New function. X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fconcord.git;a=commitdiff_plain;h=9d5ac7dd218b16b424b3bc9af323e2f4725978ce (cos_cons_p): New function. (concord_object_get_feature_value): Use `cos_read_object'. --- diff --git a/cos.c b/cos.c index 4a842b8..546078c 100644 --- a/cos.c +++ b/cos.c @@ -67,6 +67,12 @@ cos_make_int (COS_C_Int num) return (COS_object)((COS_INT)(num << 1) | 1); } +int +cos_int_p (COS_object obj) +{ + return COS_OBJECT_INT_P (obj); +} + COS_C_Int cos_int_value (COS_object obj) { @@ -75,12 +81,6 @@ cos_int_value (COS_object obj) return INTPTR_MIN; } -int -cos_int_p (COS_object obj) -{ - return COS_OBJECT_INT_P (obj); -} - COS_object cos_make_char (int code) @@ -89,17 +89,17 @@ cos_make_char (int code) } int -cos_char_id (COS_object obj) +cos_char_p (COS_object obj) { - if (COS_OBJECT_CHAR_P (obj)) - return ((COS_INT)obj) >> 2; - return -1; + return COS_OBJECT_CHAR_P (obj); } int -cos_char_p (COS_object obj) +cos_char_id (COS_object obj) { - return COS_OBJECT_CHAR_P (obj); + if (COS_OBJECT_CHAR_P (obj)) + return ((COS_INT)obj) >> 2; + return -1; } @@ -265,6 +265,12 @@ cos_release_cons (COS_Object obj) return 0; } +int +cos_cons_p (COS_object obj) +{ + return COS_OBJECT_CONS_P (obj); +} + COS_object cos_car (COS_Cons pair) { @@ -547,9 +553,6 @@ concord_object_get_feature_value (COS_object object, COS_object feature) CONCORD_String_Tank val_st; COS_String val_string; size_t end; - int val_cid; - COS_String val_str; - COS_object val_obj; if (COS_OBJECT_CHAR_P (object)) { @@ -574,23 +577,7 @@ concord_object_get_feature_value (COS_object object, COS_object feature) concord_feature_get_name (fobj), cos_string_data (val_string)); - val_obj = cos_read_int (CONCORD_String_data (&val_st), + return cos_read_object (CONCORD_String_data (&val_st), CONCORD_String_size (&val_st), 0, &end); - if ( val_obj != NULL ) - return val_obj; - - 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; }