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

📄 tmpltdef.c

📁 clips源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
static void ReturnDeftemplate(  void *theEnv,  void *vTheConstruct)  {#if (MAC_MCW || IBM_MCW) && (RUN_TIME || BLOAD_ONLY)#pragma unused(theEnv,vTheConstruct)#endif#if (! BLOAD_ONLY) && (! RUN_TIME)   struct deftemplate *theConstruct = (struct deftemplate *) vTheConstruct;   struct templateSlot *slotPtr;   if (theConstruct == NULL) return;   /*====================================================================*/   /* If a template is redefined, then we want to save its debug status. */   /*====================================================================*/#if DEBUGGING_FUNCTIONS   DeftemplateData(theEnv)->DeletedTemplateDebugFlags = 0;   if (theConstruct->watch) BitwiseSet(DeftemplateData(theEnv)->DeletedTemplateDebugFlags,0);#endif   /*===========================================*/   /* Free storage used by the templates slots. */   /*===========================================*/   slotPtr = theConstruct->slotList;   while (slotPtr != NULL)     {      DecrementSymbolCount(theEnv,slotPtr->slotName);      RemoveHashedExpression(theEnv,slotPtr->defaultList);      slotPtr->defaultList = NULL;      RemoveConstraint(theEnv,slotPtr->constraints);      slotPtr->constraints = NULL;      slotPtr = slotPtr->next;     }   ReturnSlots(theEnv,theConstruct->slotList);   /*==================================*/   /* Free storage used by the header. */   /*==================================*/   DeinstallConstructHeader(theEnv,&theConstruct->header);   rtn_struct(theEnv,deftemplate,theConstruct);#endif  }  /**************************************************************//* DestroyDeftemplate: Returns the data structures associated *//*   with a deftemplate construct to the pool of free memory. *//**************************************************************/static void DestroyDeftemplate(  void *theEnv,  void *vTheConstruct)  {#if (MAC_MCW || IBM_MCW) && (RUN_TIME || BLOAD_ONLY)#pragma unused(vTheConstruct)#endif   struct deftemplate *theConstruct = (struct deftemplate *) vTheConstruct;#if (! BLOAD_ONLY) && (! RUN_TIME)   struct templateSlot *slotPtr, *nextSlot;#endif   if (theConstruct == NULL) return;  #if (! BLOAD_ONLY) && (! RUN_TIME)   slotPtr = theConstruct->slotList;   while (slotPtr != NULL)     {      nextSlot = slotPtr->next;      rtn_struct(theEnv,templateSlot,slotPtr);      slotPtr = nextSlot;     }#endif   DestroyFactPatternNetwork(theEnv,theConstruct->patternNetwork);      /*==================================*/   /* Free storage used by the header. */   /*==================================*/#if (! BLOAD_ONLY) && (! RUN_TIME)   DeinstallConstructHeader(theEnv,&theConstruct->header);   rtn_struct(theEnv,deftemplate,theConstruct);#endif  }  /***********************************************//* ReturnSlots: Returns the slot structures of *//*   a deftemplate to free memory.             *//***********************************************/globle void ReturnSlots(  void *theEnv,  struct templateSlot *slotPtr)  {#if (MAC_MCW || IBM_MCW) && (RUN_TIME || BLOAD_ONLY)#pragma unused(theEnv,slotPtr)#endif#if (! BLOAD_ONLY) && (! RUN_TIME)   struct templateSlot *nextSlot;   while (slotPtr != NULL)     {      nextSlot = slotPtr->next;      ReturnExpression(theEnv,slotPtr->defaultList);      RemoveConstraint(theEnv,slotPtr->constraints);      rtn_struct(theEnv,templateSlot,slotPtr);      slotPtr = nextSlot;     }#endif  }/*************************************************//* DecrementDeftemplateBusyCount: Decrements the *//*   busy count of a deftemplate data structure. *//*************************************************/globle void DecrementDeftemplateBusyCount(  void *theEnv,  void *vTheTemplate)  {   struct deftemplate *theTemplate = (struct deftemplate *) vTheTemplate;   if (! ConstructData(theEnv)->ClearInProgress) theTemplate->busyCount--;  }/*************************************************//* IncrementDeftemplateBusyCount: Increments the *//*   busy count of a deftemplate data structure. *//*************************************************/#if IBM_TBC#pragma argsused#endifgloble void IncrementDeftemplateBusyCount(  void *theEnv,  void *vTheTemplate)  {   struct deftemplate *theTemplate = (struct deftemplate *) vTheTemplate;#if MAC_MCW || IBM_MCW || MAC_XCD#pragma unused(theEnv)#endif   theTemplate->busyCount++;  }  /*******************************************************************//* EnvGetNextFactInTemplate: If passed a NULL pointer, returns the *//*   first fact in the template's fact-list. Otherwise returns the *//*   next template fact following the fact passed as an argument.  *//*******************************************************************/#if IBM_TBC#pragma argsused#endifgloble void *EnvGetNextFactInTemplate(  void *theEnv,  void *theTemplate,  void *factPtr)  {#if MAC_MCW || IBM_MCW || MAC_XCD#pragma unused(theEnv)#endif   if (factPtr == NULL)     { return((void *) ((struct deftemplate *) theTemplate)->factList); }   if (((struct fact *) factPtr)->garbage) return(NULL);   return((void *) ((struct fact *) factPtr)->nextTemplateFact);  }#if ! RUN_TIME/*******************************************************************//* CreateDeftemplateScopeMap:    *//*******************************************************************/globle void *CreateDeftemplateScopeMap(  void *theEnv,  struct deftemplate *theDeftemplate)  {   unsigned scopeMapSize;   char *scopeMap;   char *templateName;   struct defmodule *matchModule, *theModule;   int moduleID,count;   void *theBitMap;   templateName = ValueToString(theDeftemplate->header.name);   matchModule = theDeftemplate->header.whichModule->theModule;   scopeMapSize = (sizeof(char) * ((GetNumberOfDefmodules(theEnv) / BITS_PER_BYTE) + 1));   scopeMap = (char *) gm2(theEnv,scopeMapSize);   ClearBitString((void *) scopeMap,scopeMapSize);   SaveCurrentModule(theEnv);   for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL) ;        theModule != NULL ;        theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,(void *) theModule))     {      EnvSetCurrentModule(theEnv,(void *) theModule);      moduleID = (int) theModule->bsaveID;      if (FindImportedConstruct(theEnv,"deftemplate",matchModule,                                templateName,&count,TRUE,NULL) != NULL)        SetBitMap(scopeMap,moduleID);     }   RestoreCurrentModule(theEnv);   theBitMap = AddBitMap(theEnv,scopeMap,scopeMapSize);   IncrementBitMapCount(theBitMap);   rm(theEnv,(void *) scopeMap,scopeMapSize);   return(theBitMap);  }#endif#if RUN_TIME/**************************************************//* RuntimeDeftemplateAction: Action to be applied *//*   to each deftemplate construct when a runtime *//*   initialization occurs.                       *//**************************************************/#if IBM_TBC#pragma argsused#endifstatic void RuntimeDeftemplateAction(  void *theEnv,  struct constructHeader *theConstruct,  void *buffer)  {#if MAC_MCW || IBM_MCW || MAC_XCD#pragma unused(buffer)#endif   struct deftemplate *theDeftemplate = (struct deftemplate *) theConstruct;      SearchForHashedPatternNodes(theEnv,theDeftemplate->patternNetwork);  }/*******************************************************************//* SearchForHashedPatternNodes:    *//*******************************************************************/static void SearchForHashedPatternNodes(   void *theEnv,   struct factPatternNode *theNode)   {    while (theNode != NULL)      {       if ((theNode->lastLevel != NULL) && (theNode->lastLevel->header.selector))        { AddHashedPatternNode(theEnv,theNode->lastLevel,theNode,theNode->networkTest->type,theNode->networkTest->value); }       SearchForHashedPatternNodes(theEnv,theNode->nextLevel);             theNode = theNode->rightNode;      }   }/*******************************************************************//* DeftemplateRunTimeInitialize:    *//*******************************************************************/globle void DeftemplateRunTimeInitialize(  void *theEnv)  {   DoForAllConstructs(theEnv,RuntimeDeftemplateAction,DeftemplateData(theEnv)->DeftemplateModuleIndex,TRUE,NULL);   }#endif#endif /* DEFTEMPLATE_CONSTRUCT */

⌨️ 快捷键说明

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