⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 objbin.c

📁 NASA 开发使用的一个专家系统
💻 C
📖 第 1 页 / 共 4 页
字号:
   if (ClassCount != 0L)     {      BloadandRefresh(ClassCount,(unsigned) sizeof(BSAVE_DEFCLASS),UpdateDefclass);      BloadandRefresh(LinkCount,(unsigned) sizeof(DEFCLASS *),UpdateLink);      BloadandRefresh(SlotNameCount,(unsigned) sizeof(BSAVE_SLOT_NAME),UpdateSlotName);      BloadandRefresh(SlotCount,(unsigned) sizeof(BSAVE_SLOT_DESC),UpdateSlot);      if (TemplateSlotCount != 0L)        BloadandRefresh(TemplateSlotCount,(unsigned) sizeof(long),UpdateTemplateSlot);      if (SlotNameMapCount != 0L)        {         space = (UNLN) (sizeof(unsigned) * SlotNameMapCount);         GenRead((VOID *) mapslotArray,space);        }      if (HandlerCount != 0L)        {         BloadandRefresh(HandlerCount,(unsigned) sizeof(BSAVE_HANDLER),UpdateHandler);         space = (UNLN) (sizeof(unsigned) * HandlerCount);         GenRead((VOID *) maphandlerArray,space);        }      UpdatePrimitiveClassesMap();     }  }/***************************************************  NAME         : UpdatePrimitiveClassesMap  DESCRIPTION  : Resets the pointers for the global                 primitive classes map  INPUTS       : None  RETURNS      : Nothing useful  SIDE EFFECTS : PrimitiveClassMap pointers set                 into bload array  NOTES        : Looks at first nine primitive type                 codes in the source file CONSTANT.H ***************************************************/static VOID UpdatePrimitiveClassesMap()  {   register unsigned i;      for (i = 0 ; i < OBJECT_TYPE_CODE ; i++)     PrimitiveClassMap[i] = (DEFCLASS *) &defclassArray[i];  }  /*********************************************************  Refresh update routines for bsaved COOL structures *********************************************************/static VOID UpdateDefclassModule(buf,obji)  VOID *buf;  long obji;  {   BSAVE_DEFCLASS_MODULE *bdptr;      bdptr = (BSAVE_DEFCLASS_MODULE *) buf;   UpdateDefmoduleItemHeader(&bdptr->header,&ModuleArray[obji].header,                             (int) sizeof(DEFCLASS),(VOID *) defclassArray);  }  static VOID UpdateDefclass(buf,obji)  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);  }  static VOID UpdateLink(buf,obji)  VOID *buf;  long obji;  {   long *blink;      blink = (long *) buf;   linkArray[obji] = DefclassPointer(*blink);  }static VOID UpdateSlot(buf,obji)  VOID *buf;  long obji;  {   SLOT_DESC *sp;   BSAVE_SLOT_DESC *bsp;      sp = (SLOT_DESC *) &slotArray[obji];   bsp = (BSAVE_SLOT_DESC *) buf;   sp->dynamicDefault = bsp->dynamicDefault;   sp->noDefault = bsp->noDefault;   sp->shared = bsp->shared;   sp->multiple = bsp->multiple;   sp->composite = bsp->composite;   sp->noInherit = bsp->noInherit;   sp->noWrite = bsp->noWrite;   sp->initializeOnly = bsp->initializeOnly;   sp->reactive = bsp->reactive;   sp->publicVisibility = bsp->publicVisibility;   sp->createReadAccessor = bsp->createReadAccessor;   sp->createWriteAccessor = bsp->createWriteAccessor;   sp->cls = DefclassPointer(bsp->cls);   sp->slotName = SlotNamePointer(bsp->slotName);   sp->overrideMessage = SymbolPointer(bsp->overrideMessage);   IncrementSymbolCount(sp->overrideMessage);   if (bsp->defaultValue != -1L)     {      if (sp->dynamicDefault)        sp->defaultValue = (VOID *) ExpressionPointer(bsp->defaultValue);      else        {         sp->defaultValue = (VOID *) get_struct(dataObject);         EvaluateAndStoreInDataObject((int) sp->multiple,ExpressionPointer(bsp->defaultValue),                                      (DATA_OBJECT *) sp->defaultValue);         ValueInstall((DATA_OBJECT *) sp->defaultValue);        }     }   else     sp->defaultValue = NULL;   sp->constraint = ConstraintPointer(bsp->constraint);   sp->sharedCount = 0;   sp->sharedValue.value = NULL;   sp->bsaveIndex = 0L;   if (sp->shared)     {      sp->sharedValue.desc = sp;      sp->sharedValue.value = NULL;     }  }static VOID UpdateSlotName(buf,obji)  VOID *buf;  long obji;  {   SLOT_NAME *snp;   BSAVE_SLOT_NAME *bsnp;      bsnp = (BSAVE_SLOT_NAME *) buf;   snp = (SLOT_NAME *) &slotNameArray[obji];   snp->id = bsnp->id;   snp->name = SymbolPointer(bsnp->name);   IncrementSymbolCount(snp->name);   snp->putHandlerName = SymbolPointer(bsnp->putHandlerName);   IncrementSymbolCount(snp->putHandlerName);   snp->hashTableIndex = bsnp->hashTableIndex;   snp->nxt = SlotNameTable[snp->hashTableIndex];   SlotNameTable[snp->hashTableIndex] = snp;  }    static VOID UpdateTemplateSlot(buf,obji)  VOID *buf;  long obji;  {   tmpslotArray[obji] = SlotPointer(* (long *) buf);  }static VOID UpdateHandler(buf,obji)  VOID *buf;  long obji;  {   HANDLER *hnd;   BSAVE_HANDLER *bhnd;      hnd = (HANDLER *) &handlerArray[obji];   bhnd = (BSAVE_HANDLER *) buf;   hnd->system = bhnd->system;   hnd->type = bhnd->type;#if (! IMPERATIVE_MESSAGE_HANDLERS)   if (hnd->type == MAROUND)     {      PrintWarningID("OBJBIN",1,CLIPS_FALSE);      PrintCLIPS(WWARNING,"Around message-handlers are not\n");      PrintCLIPS(WWARNING,"  supported in this environment.");     }#endif#if (! AUXILIARY_MESSAGE_HANDLERS)   if ((hnd->type == MBEFORE) || (hnd->type == MAFTER))     {      PrintWarningID("OBJBIN",2,CLIPS_FALSE);      PrintCLIPS(WWARNING,"Before and after message-handlers are not\n");      PrintCLIPS(WWARNING,"  supported in this environment.");     }#endif   hnd->minParams = bhnd->minParams;   hnd->maxParams = bhnd->maxParams;   hnd->localVarCount = bhnd->localVarCount;   hnd->cls = DefclassPointer(bhnd->cls);   hnd->name = SymbolPointer(bhnd->name);   IncrementSymbolCount(hnd->name);   hnd->actions = ExpressionPointer(bhnd->actions);   hnd->ppForm = NULL;   hnd->busy = 0;   hnd->mark = 0;#if DEBUGGING_FUNCTIONS   hnd->trace = WatchHandlers;#endif  }/***************************************************************  NAME         : ClearBloadObjects  DESCRIPTION  : Release all binary-loaded class and handler                   structure arrays (and others)  INPUTS       : None  RETURNS      : Nothing useful  SIDE EFFECTS : Memory cleared  NOTES        : None ***************************************************************/static VOID ClearBloadObjects()  {   register long i;   UNLN space;       space = (unsigned long) (sizeof(DEFCLASS_MODULE) * ModuleCount);   if (space == 0L)     return;   genlongfree((VOID *) ModuleArray,space);   ModuleArray = NULL;   ModuleCount = 0L;   if (ClassCount != 0L)     {      rm((VOID *) ClassIDMap,(int) (sizeof(DEFCLASS *) * MaxClassID));      ClassIDMap = NULL;      MaxClassID = 0;      for (i = 0L ; i < ClassCount ; i++)        {         UnmarkConstructHeader(&defclassArray[i].header);#if DEFMODULE_CONSTRUCT         DecrementBitMapCount(defclassArray[i].scopeMap);#endif         RemoveClassFromTable((DEFCLASS *) &defclassArray[i]);        }      for (i = 0L ; i < SlotCount ; i++)        {         DecrementSymbolCount(slotArray[i].overrideMessage);         if ((slotArray[i].defaultValue != NULL) && (slotArray[i].dynamicDefault == 0))           {            ValueDeinstall((DATA_OBJECT *) slotArray[i].defaultValue);            rtn_struct(dataObject,slotArray[i].defaultValue);           }        }      for (i = 0L ; i < SlotNameCount ; i++)        {         SlotNameTable[slotNameArray[i].hashTableIndex] = NULL;         DecrementSymbolCount(slotNameArray[i].name);         DecrementSymbolCount(slotNameArray[i].putHandlerName);        }              space = (UNLN) (sizeof(DEFCLASS) * ClassCount);      if (space != 0L)        {         genlongfree((VOID *) defclassArray,space);         defclassArray = NULL;         ClassCount = 0L;        }         space = (UNLN) (sizeof(DEFCLASS *) * LinkCount);      if (space != 0L)        {         genlongfree((VOID *) linkArray,space);         linkArray = NULL;         LinkCount = 0L;        }         space = (UNLN) (sizeof(SLOT_DESC) * SlotCount);      if (space != 0L)        {         genlongfree((VOID *) slotArray,space);         slotArray = NULL;         SlotCount = 0L;        }         space = (UNLN) (sizeof(SLOT_NAME) * SlotNameCount);      if (space != 0L)        {         genlongfree((VOID *) slotNameArray,space);         slotNameArray = NULL;         SlotNameCount = 0L;        }         space = (UNLN) (sizeof(SLOT_DESC *) * TemplateSlotCount);      if (space != 0L)        {         genlongfree((VOID *) tmpslotArray,space);         tmpslotArray = NULL;         TemplateSlotCount = 0L;        }              space = (UNLN) (sizeof(unsigned) * SlotNameMapCount);      if (space != 0L)        {         genlongfree((VOID *) mapslotArray,space);         mapslotArray = NULL;         SlotNameMapCount = 0L;        }     }        if (HandlerCount != 0L)     {      for (i = 0L ; i < HandlerCount ; i++)        DecrementSymbolCount(handlerArray[i].name);      space = (UNLN) (sizeof(HANDLER) * HandlerCount);      if (space != 0L)        {         genlongfree((VOID *) handlerArray,space);         handlerArray = NULL;         space = (UNLN) (sizeof(unsigned) * HandlerCount);         genlongfree((VOID *) maphandlerArray,space);         maphandlerArray = NULL;         HandlerCount = 0L;        }     }  }  #endif/***************************************************  NAME         :   DESCRIPTION  :   INPUTS       :   RETURNS      :   SIDE EFFECTS :   NOTES        :  ***************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -