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

📄 engine.c

📁 clips源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
  }/***********************************************//* HaltCommand: Causes rule execution to halt. *//***********************************************/globle void HaltCommand(  void *theEnv)  {   EnvArgCountCheck(theEnv,"halt",EXACTLY,0);   EnvHalt(theEnv);  }/*****************************//* EnvHalt: C access routine *//*   for the halt command.   *//*****************************/globle void EnvHalt(  void *theEnv)  {   EngineData(theEnv)->HaltRules = TRUE;  }#if DEBUGGING_FUNCTIONS/*********************************//* EnvSetBreak: C access routine *//*   for the set-break command.  *//*********************************/#if IBM_TBC#pragma argsused#endifgloble void EnvSetBreak(  void *theEnv,  void *theRule)  {#if MAC_MCW || IBM_MCW || MAC_XCD#pragma unused(theEnv)#endif   struct defrule *thePtr;   for (thePtr = (struct defrule *) theRule;        thePtr != NULL;        thePtr = thePtr->disjunct)     { thePtr->afterBreakpoint = 1; }  }/************************************//* EnvRemoveBreak: C access routine *//*   for the remove-break command.  *//************************************/#if IBM_TBC#pragma argsused#endifgloble intBool EnvRemoveBreak(  void *theEnv,  void *theRule)  {#if MAC_MCW || IBM_MCW || MAC_XCD#pragma unused(theEnv)#endif   struct defrule *thePtr;   int rv = FALSE;   for (thePtr = (struct defrule *) theRule;        thePtr != NULL;        thePtr = thePtr->disjunct)     {      if (thePtr->afterBreakpoint == 1)        {         thePtr->afterBreakpoint = 0;         rv = TRUE;        }     }   return(rv);  }/**************************************************//* RemoveAllBreakpoints: Removes all breakpoints. *//**************************************************/globle void RemoveAllBreakpoints(  void *theEnv)  {   void *theRule;   void *theDefmodule = NULL;   while ((theDefmodule = EnvGetNextDefmodule(theEnv,theDefmodule)) != NULL)     {      theRule = NULL;      while ((theRule = EnvGetNextDefrule(theEnv,theRule)) != NULL)        { EnvRemoveBreak(theEnv,theRule); }     }  }/***********************************//* EnvShowBreaks: C access routine *//*   for the show-breaks command.  *//***********************************/globle void EnvShowBreaks(  void *theEnv,  char *logicalName,  void *vTheModule)  {   ListItemsDriver(theEnv,logicalName,(struct defmodule *) vTheModule,                   NULL,NULL,                   EnvGetNextDefrule,(char *(*)(void *)) GetConstructNameString,                   NULL,EnvDefruleHasBreakpoint);   }/**********************************************//* EnvDefruleHasBreakpoint: Indicates whether *//*   the specified rule has a breakpoint set. *//**********************************************/#if IBM_TBC#pragma argsused#endifgloble intBool EnvDefruleHasBreakpoint(  void *theEnv,  void *theRule)  {#if MAC_MCW || IBM_MCW || MAC_XCD#pragma unused(theEnv)#endif   return(((struct defrule *) theRule)->afterBreakpoint);  }/*****************************************//* SetBreakCommand: H/L access routine   *//*   for the set-break command.          *//*****************************************/globle void SetBreakCommand(  void *theEnv)  {   DATA_OBJECT argPtr;   char *argument;   void *defrulePtr;   if (EnvArgCountCheck(theEnv,"set-break",EXACTLY,1) == -1) return;   if (EnvArgTypeCheck(theEnv,"set-break",1,SYMBOL,&argPtr) == FALSE) return;   argument = DOToString(argPtr);   if ((defrulePtr = EnvFindDefrule(theEnv,argument)) == NULL)     {      CantFindItemErrorMessage(theEnv,"defrule",argument);      return;     }   EnvSetBreak(theEnv,defrulePtr);  }/********************************************//* RemoveBreakCommand: H/L access routine   *//*   for the remove-break command.          *//********************************************/globle void RemoveBreakCommand(  void *theEnv)  {   DATA_OBJECT argPtr;   char *argument;   int nargs;   void *defrulePtr;   if ((nargs = EnvArgCountCheck(theEnv,"remove-break",NO_MORE_THAN,1)) == -1)     { return; }   if (nargs == 0)     {      RemoveAllBreakpoints(theEnv);      return;     }   if (EnvArgTypeCheck(theEnv,"remove-break",1,SYMBOL,&argPtr) == FALSE) return;   argument = DOToString(argPtr);   if ((defrulePtr = EnvFindDefrule(theEnv,argument)) == NULL)     {      CantFindItemErrorMessage(theEnv,"defrule",argument);      return;     }   if (EnvRemoveBreak(theEnv,defrulePtr) == FALSE)     {      EnvPrintRouter(theEnv,WERROR,"Rule ");      EnvPrintRouter(theEnv,WERROR,argument);      EnvPrintRouter(theEnv,WERROR," does not have a breakpoint set.\n");     }  }/*******************************************//* ShowBreaksCommand: H/L access routine   *//*   for the show-breaks command.          *//*******************************************/globle void ShowBreaksCommand(  void *theEnv)  {   int numArgs, error;   struct defmodule *theModule;   if ((numArgs = EnvArgCountCheck(theEnv,"show-breaks",NO_MORE_THAN,1)) == -1) return;   if (numArgs == 1)     {      theModule = GetModuleName(theEnv,"show-breaks",1,&error);      if (error) return;     }   else     { theModule = ((struct defmodule *) EnvGetCurrentModule(theEnv)); }   EnvShowBreaks(theEnv,WDISPLAY,theModule);  }/***********************************************//* ListFocusStackCommand: H/L access routine   *//*   for the list-focus-stack command.         *//***********************************************/globle void ListFocusStackCommand(  void *theEnv)  {   if (EnvArgCountCheck(theEnv,"list-focus-stack",EXACTLY,0) == -1) return;   EnvListFocusStack(theEnv,WDISPLAY);  }/***************************************//* EnvListFocusStack: C access routine *//*   for the list-focus-stack command. *//***************************************/globle void EnvListFocusStack(  void *theEnv,  char *logicalName)  {   struct focus *theFocus;   for (theFocus = EngineData(theEnv)->CurrentFocus;        theFocus != NULL;        theFocus = theFocus->next)     {      EnvPrintRouter(theEnv,logicalName,EnvGetDefmoduleName(theEnv,theFocus->theModule));      EnvPrintRouter(theEnv,logicalName,"\n");     }  }#endif/***********************************************//* GetFocusStackFunction: H/L access routine   *//*   for the get-focus-stack function.         *//***********************************************/globle void GetFocusStackFunction(  void *theEnv,  DATA_OBJECT_PTR returnValue)  {   if (EnvArgCountCheck(theEnv,"get-focus-stack",EXACTLY,0) == -1) return;   EnvGetFocusStack(theEnv,returnValue);  }/***************************************//* EnvGetFocusStack: C access routine  *//*   for the get-focus-stack function. *//***************************************/globle void EnvGetFocusStack(  void *theEnv,  DATA_OBJECT_PTR returnValue)  {   struct focus *theFocus;   struct multifield *theList;   unsigned long count = 0;   /*===========================================*/   /* If there is no current focus, then return */   /* a multifield value of length zero.        */   /*===========================================*/   if (EngineData(theEnv)->CurrentFocus == NULL)     {      SetpType(returnValue,MULTIFIELD);      SetpDOBegin(returnValue,1);      SetpDOEnd(returnValue,0);      SetpValue(returnValue,(void *) EnvCreateMultifield(theEnv,0L));      return;     }   /*=====================================================*/   /* Determine the number of modules on the focus stack. */   /*=====================================================*/   for (theFocus = EngineData(theEnv)->CurrentFocus; theFocus != NULL; theFocus = theFocus->next)     { count++; }   /*=============================================*/   /* Create a multifield of the appropriate size */   /* in which to store the module names.         */   /*=============================================*/   SetpType(returnValue,MULTIFIELD);   SetpDOBegin(returnValue,1);   SetpDOEnd(returnValue,(long) count);   theList = (struct multifield *) EnvCreateMultifield(theEnv,count);   SetpValue(returnValue,(void *) theList);   /*=================================================*/   /* Store the module names in the multifield value. */   /*=================================================*/   for (theFocus = EngineData(theEnv)->CurrentFocus, count = 1;        theFocus != NULL;        theFocus = theFocus->next, count++)     {      SetMFType(theList,count,SYMBOL);      SetMFValue(theList,count,theFocus->theModule->name);     }  }/******************************************//* PopFocusFunction: H/L access routine   *//*   for the pop-focus function.          *//******************************************/globle void *PopFocusFunction(  void *theEnv)  {   struct defmodule *theModule;   EnvArgCountCheck(theEnv,"pop-focus",EXACTLY,0);   theModule = (struct defmodule *) EnvPopFocus(theEnv);   if (theModule == NULL) return((SYMBOL_HN *) EnvFalseSymbol(theEnv));   return(theModule->name);  }/******************************************//* GetFocusFunction: H/L access routine   *//*   for the get-focus function.          *//******************************************/globle void *GetFocusFunction(  void *theEnv)  {   struct defmodule *rv;   EnvArgCountCheck(theEnv,"get-focus",EXACTLY,0);   rv = (struct defmodule *) EnvGetFocus(theEnv);   if (rv == NULL) return((SYMBOL_HN *) EnvFalseSymbol(theEnv));   return(rv->name);  }/*********************************//* EnvGetFocus: C access routine *//*   for the get-focus function. *//*********************************/globle void *EnvGetFocus(  void *theEnv)  {   if (EngineData(theEnv)->CurrentFocus == NULL) return(NULL);   return((void *) EngineData(theEnv)->CurrentFocus->theModule);  }/**************************************//* FocusCommand: H/L access routine   *//*   for the focus function.          *//**************************************/globle int FocusCommand(  void *theEnv)  {   DATA_OBJECT argPtr;   char *argument;   struct defmodule *theModule;   int argCount, i;   /*=====================================================*/   /* Check for the correct number and type of arguments. */   /*=====================================================*/   if ((argCount = EnvArgCountCheck(theEnv,"focus",AT_LEAST,1)) == -1)     { return(FALSE); }   /*===========================================*/   /* Focus on the specified defrule module(s). */   /*===========================================*/   for (i = argCount; i > 0; i--)     {      if (EnvArgTypeCheck(theEnv,"focus",i,SYMBOL,&argPtr) == FALSE)        { return(FALSE); }      argument = DOToString(argPtr);      theModule = (struct defmodule *) EnvFindDefmodule(theEnv,argument);      if (theModule == NULL)        {         CantFindItemErrorMessage(theEnv,"defmodule",argument);         return(FALSE);        }      EnvFocus(theEnv,(void *) theModule);     }   /*===================================================*/   /* Return TRUE to indicate success of focus command. */   /*===================================================*/   return(TRUE);  }/***********************************************************************//* EnvGetFocusChanged: Returns the value of the variable FocusChanged. *//***********************************************************************/globle int EnvGetFocusChanged(  void *theEnv)  {   return(EngineData(theEnv)->FocusChanged);  }/********************************************************************//* EnvSetFocusChanged: Sets the value of the variable FocusChanged. *//********************************************************************/globle void EnvSetFocusChanged(  void *theEnv,  int value)  {   EngineData(theEnv)->FocusChanged = value;  }/*********************************************//* EnvSetHaltRules: Sets the HaltRules flag. *//*********************************************/globle void EnvSetHaltRules(  void *theEnv,  intBool value)  {    EngineData(theEnv)->HaltRules = value;   }/****************************************************//* EnvGetHaltRules: Returns the HaltExecution flag. *//****************************************************/globle intBool EnvGetHaltRules(  void *theEnv)  {   return(EngineData(theEnv)->HaltRules);  }#endif /* DEFRULE_CONSTRUCT */

⌨️ 快捷键说明

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