mirror of
https://github.com/CPunch/Cosmo.git
synced 2026-01-02 22:00:17 +00:00
removed 'roots', replaced with a registry table
- removed cosmoM_addRoot - removed cosmoM_removeRoot - renamed cosmoV_register to cosmoV_addGlobals - added cosmoV_addRegistry - added cosmoV_getRegistry - added cosmoV_setProto - added cosmoV_isValueUserType
This commit is contained in:
10
src/cobj.c
10
src/cobj.c
@@ -31,7 +31,6 @@ CObj *cosmoO_allocateBase(CState *state, size_t sz, CObjType type)
|
||||
obj->next = state->objects;
|
||||
state->objects = obj;
|
||||
|
||||
obj->nextRoot = NULL;
|
||||
#ifdef GC_DEBUG
|
||||
printf("allocated %s %p\n", cosmoO_typeStr(obj), obj);
|
||||
#endif
|
||||
@@ -51,9 +50,9 @@ void cosmoO_free(CState *state, CObj *obj)
|
||||
break;
|
||||
}
|
||||
case COBJ_OBJECT: {
|
||||
CObjObject *objTbl = (CObjObject *)obj;
|
||||
cosmoT_clearTable(state, &objTbl->tbl);
|
||||
cosmoM_free(state, CObjObject, objTbl);
|
||||
CObjObject *objObj = (CObjObject *)obj;
|
||||
cosmoT_clearTable(state, &objObj->tbl);
|
||||
cosmoM_free(state, CObjObject, objObj);
|
||||
break;
|
||||
}
|
||||
case COBJ_TABLE: {
|
||||
@@ -492,6 +491,7 @@ void cosmoO_unlock(CObjObject *object)
|
||||
object->isLocked = false;
|
||||
}
|
||||
|
||||
|
||||
bool rawgetIString(CState *state, CObjObject *object, int flag, CValue *val)
|
||||
{
|
||||
if (readFlag(object->istringFlags, flag))
|
||||
@@ -511,6 +511,8 @@ bool cosmoO_getIString(CState *state, CObjObject *object, int flag, CValue *val)
|
||||
CObjObject *obj = object;
|
||||
|
||||
do {
|
||||
printf("getting flag %d from obj: %p\n", flag, obj);
|
||||
fflush(stdout);
|
||||
if (rawgetIString(state, obj, flag, val))
|
||||
return true;
|
||||
} while ((obj = obj->_obj.proto) != NULL); // sets obj to it's proto and compares it to NULL
|
||||
|
||||
Reference in New Issue
Block a user