static void UpdateDefclass( void *buf, long obji) { BSAVE_DEFCLASS *bcls; DEFCLASS *cls; bcls = (BSAVE_DEFCLASS *) buf; cls = (DEFCLASS *) &defclassArray[obji]; UpdateConstructHeader(&bcls->header,&cls->header, (int) sizeof(DEFCLASS_MODULE),(void *) ModuleArray, (int) sizeof(DEFCLASS),(void *) defclassArray); cls->abstract = bcls->abstract; cls->reactive = bcls->reactive; cls->system = bcls->system; cls->id = bcls->id; ClassIDMap[cls->id] = cls; #if DEBUGGING_FUNCTIONS cls->traceInstances = WatchInstances; cls->traceSlots = WatchSlots; #endif cls->slotCount = bcls->slotCount; cls->instanceSlotCount = bcls->instanceSlotCount; cls->localInstanceSlotCount = bcls->localInstanceSlotCount; cls->maxSlotNameID = bcls->maxSlotNameID; cls->handlerCount = bcls->handlerCount; cls->directSuperclasses.classCount =bcls->directSuperclasses.classCount; cls->directSuperclasses.classArray = LinkPointer(bcls->directSuperclasses.classArray); cls->directSubclasses.classCount =bcls->directSubclasses.classCount; cls->directSubclasses.classArray = LinkPointer(bcls->directSubclasses.classArray); cls->allSuperclasses.classCount =bcls->allSuperclasses.classCount; cls->allSuperclasses.classArray = LinkPointer(bcls->allSuperclasses.classArray); cls->slots = SlotPointer(bcls->slots); cls->instanceTemplate = TemplateSlotPointer(bcls->instanceTemplate); cls->slotNameMap = OrderedSlotPointer(bcls->slotNameMap); cls->instanceList = NULL; cls->handlers = HandlerPointer(bcls->handlers); cls->handlerOrderMap = OrderedHandlerPointer(bcls->handlers); cls->installed = 1; cls->busy = 0; cls->instanceList = NULL; cls->instanceListBottom = NULL; #if DEFMODULE_CONSTRUCT cls->scopeMap = BitMapPointer(bcls->scopeMap); IncrementBitMapCount(cls->scopeMap); #else cls->scopeMap = NULL; #endif PutClassInTable(cls); }
/***************************************************************************** NAME : AddClass DESCRIPTION : Determines the precedence list of the new class. If it is valid, the routine checks to see if the class already exists. If it does not, all the subclass links are made from the class's direct superclasses, and the class is inserted in the hash table. If it does, all sublclasses are deleted. An error will occur if any instances of the class (direct or indirect) exist. If all checks out, the old definition is replaced by the new. INPUTS : The new class description RETURNS : Nothing useful SIDE EFFECTS : The class is deleted if there is an error. NOTES : No change in the class graph state will occur if there were any errors. Assumes class is not busy!!! *****************************************************************************/ static void AddClass( void *theEnv, DEFCLASS *cls) { DEFCLASS *ctmp; #if DEBUGGING_FUNCTIONS int oldTraceInstances = FALSE, oldTraceSlots = FALSE; #endif /* =============================================== If class does not already exist, insert and form progeny links with all direct superclasses =============================================== */ cls->hashTableIndex = HashClass(GetDefclassNamePointer((void *) cls)); ctmp = (DEFCLASS *) EnvFindDefclass(theEnv,EnvGetDefclassName(theEnv,(void *) cls)); if (ctmp != NULL) { #if DEBUGGING_FUNCTIONS oldTraceInstances = ctmp->traceInstances; oldTraceSlots = ctmp->traceSlots; #endif DeleteClassUAG(theEnv,ctmp); } PutClassInTable(theEnv,cls); BuildSubclassLinks(theEnv,cls); InstallClass(theEnv,cls,TRUE); AddConstructToModule((struct constructHeader *) cls); FormInstanceTemplate(theEnv,cls); FormSlotNameMap(theEnv,cls); AssignClassID(theEnv,cls); #if DEBUGGING_FUNCTIONS if (cls->abstract) { cls->traceInstances = FALSE; cls->traceSlots = FALSE; } else { if (oldTraceInstances) cls->traceInstances = TRUE; if (oldTraceSlots) cls->traceSlots = TRUE; } #endif #if DEBUGGING_FUNCTIONS if (EnvGetConserveMemory(theEnv) == FALSE) SetDefclassPPForm((void *) cls,CopyPPBuffer(theEnv)); #endif #if DEFMODULE_CONSTRUCT /* ========================================= Create a bitmap indicating whether this class is in scope or not for every module ========================================= */ cls->scopeMap = (BITMAP_HN *) CreateClassScopeMap(theEnv,cls); #endif /* ============================================== Define get- and put- handlers for public slots ============================================== */ CreatePublicSlotMessageHandlers(theEnv,cls); }