/* findClass gets a class object, either by finding it already or making it in addition, it makes sure it has a size, by setting the size to zero if it is nil. */ static object findClass(char *name) { object newobj; newobj = globalSymbol(name); if (newobj == nilobj) newobj = newClass(name); if (basicAt(newobj, sizeInClass) == nilobj) { basicAtPut(newobj, sizeInClass, newInteger(0)); } return newobj; }
/* findClass gets a class object, either by finding it already or making it in addition, it makes sure it has a size, by setting the size to zero if it is nil. */ static ObjectHandle findClass(const char* name) { ObjectHandle newObj; newObj = globalSymbol(name); if (newObj == nilobj) { newObj = createAndRegisterNewClass(name); } if (newObj->basicAt(sizeInClass) == nilobj) { newObj->basicAtPut(sizeInClass, newInteger(0)); } return newObj; }
static ObjectHandle findClassWithMeta(const char* name, ObjectHandle metaObj) { ObjectHandle newObj, nameObj, methTable; int size; newObj = globalSymbol(name); if (newObj == nilobj) { size = getInteger(metaObj->basicAt(sizeInClass)); newObj = MemoryManager::Instance()->allocObject(size); newObj->_class = metaObj; /* now make name */ nameObj = createSymbol(name); newObj->basicAtPut(nameInClass, nameObj); methTable = newDictionary(39); newObj->basicAtPut(methodsInClass, methTable); newObj->basicAtPut(sizeInClass, newInteger(size)); /* now put in global symbols table */ nameTableInsert(symbols, strHash(name), nameObj, newObj); } return newObj; }