src/object.c
branchnew-lib-errors
changeset 217 7728d6ec3abf
parent 216 a10ba529ae39
child 218 5229a5d098b2
--- a/src/object.c	Wed May 27 23:07:00 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-#include "object.h"
-
-#include <stdlib.h>
-#include <assert.h>
-
-void object_init (struct object *obj, const struct object_type *type)
-{
-    // trip on bugs
-    assert(!obj->type);
-
-    // set type
-    obj->type = type;
-}
-
-bool object_type_check (const struct object_type *obj_type, const struct object_type *type)
-{
-    const struct object_type *t;
-
-    // sanity-check
-    assert(obj_type && type);
-
-    // look for a matching type in the type's inheritance tree
-    for (t = obj_type; t; t = t->parent)
-        if (t == type)
-            break;
-    
-    // t will be (parent == NULL) if we didn't find any matching type
-    return (t != NULL);    
-}
-
-bool object_check (struct object *obj, const struct object_type *type)
-{
-    // sanity check
-    assert(obj && type);
-
-    return object_type_check(obj->type, type);
-}
-
-void* object_cast (struct object *obj, const struct object_type *type)
-{
-    assert(object_type_check(obj->type, type));
-
-    // ok, return as void*
-    return obj;
-}
-
-const void* object_type (struct object *obj, const struct object_type *type)
-{
-    assert(object_type_check(obj->type, type));
-
-    // ok, return as void*
-    return obj->type;
-}