cos_char_id (COS_object obj)
{
if (COS_OBJECT_CHAR_P (obj))
- return ((COS_INT)obj) >> 2;
+ return (((COS_INT)obj) >> 2) & 0x7FFFFFFF;
return -1;
}
{
if (COS_OBJECT_P (obj))
{
- ((COS_Object)obj)->header.reference_count--;
-
if ( ((COS_Object)obj)->header.reference_count <= 0 )
return (*COS_Object_release_function_table
[((COS_Object)obj)->header.type
- COS_FAT_OBJECT_TYPE_MIN])(obj);
+ else
+ ((COS_Object)obj)->header.reference_count--;
}
return 0;
}
int
cos_retain_cons (COS_Object obj)
{
- cos_retain_object (COS_CAR (obj));
- cos_retain_object (COS_CDR (obj));
+ //cos_retain_object (COS_CAR (obj));
+ //cos_retain_object (COS_CDR (obj));
return 0;
}
return NULL;
}
+COS_Cons
+cos_assoc (COS_object key, COS_Cons alist)
+{
+ COS_Cons rest = alist;
+
+ while ( COS_OBJECT_CONS_P (rest) )
+ {
+ COS_Cons cell = cos_car (rest);
+
+ if ( cos_car (cell) == key )
+ return cell;
+
+ rest = cos_cdr (rest);
+ }
+ return NULL;
+}
+
+COS_object
+cos_alist_get (COS_Cons alist, COS_object key)
+{
+ return cos_cdr (cos_assoc (key, alist));
+}
+
int
cos_retain_container (COS_Object obj)