(enum COS_Object_Type): Add COS_Object_Type_Cons.
authorMORIOKA Tomohiko <tomo.git@chise.org>
Tue, 16 Apr 2013 03:57:10 +0000 (12:57 +0900)
committerMORIOKA Tomohiko <tomo.git@chise.org>
Tue, 16 Apr 2013 03:57:10 +0000 (12:57 +0900)
(COS_OBJECT_CONS_P): New macro.
(struct COS_Cons_ent): New structure.
(COS_CAR): New macro.
(COS_CDR): New macro.
(cos_release_cons): New prototype.

cos-i.h

diff --git a/cos-i.h b/cos-i.h
index 1468fd8..73450dc 100644 (file)
--- a/cos-i.h
+++ b/cos-i.h
@@ -101,6 +101,7 @@ enum COS_Object_Type {
   COS_Object_Type_char,
   COS_Object_Type_String,
   COS_Object_Type_Symbol,
+  COS_Object_Type_Cons,
   COS_Object_Type_Container,
   COS_Object_Type_Sexp,
   COS_Object_Type_Binary,
@@ -154,6 +155,9 @@ COS_Object cos_allocate_object_0 (enum COS_Object_Type type,
 #define COS_OBJECT_SYMBOL_P(obj) \
   COS_OBJECT_TYPE_P (obj, Symbol)
 
+#define COS_OBJECT_CONS_P(obj) \
+  COS_OBJECT_TYPE_P (obj, Cons)
+
 #define COS_OBJECT_DS_P(obj) \
   COS_OBJECT_TYPE_P (obj, DS)
 
@@ -212,6 +216,22 @@ COS_Symbol
 cos_symbol_table_intern (COS_Symbol_Table table, COS_object name);
 
 
+struct COS_Cons_ent
+{
+  COS_Object_Header header;
+
+  COS_object car;
+  COS_object cdr;
+};
+
+#define COS_CAR(obj) \
+  (((COS_Cons)(obj))->car)
+#define COS_CDR(obj) \
+  (((COS_Cons)(obj))->cdr)
+
+int cos_release_cons (COS_Object obj);
+
+
 struct COS_Container_ent
 {
   COS_Object_Header header;