您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ EnvGetCurrentModule函数代码示例

51自学网 2021-06-01 20:38:38
  C++
这篇教程C++ EnvGetCurrentModule函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中EnvGetCurrentModule函数的典型用法代码示例。如果您正苦于以下问题:C++ EnvGetCurrentModule函数的具体用法?C++ EnvGetCurrentModule怎么用?C++ EnvGetCurrentModule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了EnvGetCurrentModule函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: RefreshAgendaCommand

globle void RefreshAgendaCommand(    void *theEnv){    int numArgs, error;    struct defmodule *theModule;    /*==============================================*/    /* This function can have at most one argument. */    /*==============================================*/    if ((numArgs = EnvArgCountCheck(theEnv,(char*)"refresh-agenda",NO_MORE_THAN,1)) == -1) return;    /*===============================================================*/    /* If a module name is specified, then the agenda of that module */    /* is refreshed. Otherwise, the agenda of the current module is  */    /* refreshed.                                                    */    /*===============================================================*/    if (numArgs == 1)    {        theModule = GetModuleName(theEnv,(char*)"refresh-agenda",1,&error);        if (error) return;    }    else    {        theModule = ((struct defmodule *) EnvGetCurrentModule(theEnv));    }    /*===============================================*/    /* Refresh the agenda of the appropriate module. */    /*===============================================*/    EnvRefreshAgenda(theEnv,theModule);}
开发者ID:DrItanium,项目名称:AdventureEngine,代码行数:34,


示例2: class

/*******************************************************************  NAME         : EnvFindDefclass  DESCRIPTION  : Looks up a specified class in the class hash table                 (Only looks in current or specified module)  INPUTS       : The name-string of the class (including module)  RETURNS      : The address of the found class, NULL otherwise  SIDE EFFECTS : None  NOTES        : None ******************************************************************/globle void *EnvFindDefclass( // TBD Needs to look in imported  void *theEnv,  const char *classAndModuleName)  {   SYMBOL_HN *classSymbol = NULL;   DEFCLASS *cls;   struct defmodule *theModule = NULL;   const char *className;   SaveCurrentModule(theEnv);   className = ExtractModuleAndConstructName(theEnv,classAndModuleName);   if (className != NULL)     {      classSymbol = FindSymbolHN(theEnv,ExtractModuleAndConstructName(theEnv,classAndModuleName));      theModule = ((struct defmodule *) EnvGetCurrentModule(theEnv));     }   RestoreCurrentModule(theEnv);   if (classSymbol == NULL)     return(NULL);   cls = DefclassData(theEnv)->ClassTable[HashClass(classSymbol)];   while (cls != NULL)     {      if (cls->header.name == classSymbol)        {         if (cls->system || (cls->header.whichModule->theModule == theModule))           return(cls->installed ? (void *) cls : NULL);        }      cls = cls->nxtHash;     }   return(NULL);  }
开发者ID:Khenji55,项目名称:Computacion_UCLM,代码行数:41,


示例3: anywhere

/***************************************************  NAME         : LookupDefclassByMdlOrScope  DESCRIPTION  : Finds a class anywhere (if module                 is specified) or in current or                 imported modules  INPUTS       : The class name  RETURNS      : The class (NULL if not found)  SIDE EFFECTS : Error message printed on                  ambiguous references  NOTES        : Assumes no two classes of the same                 name are ever in the same scope ***************************************************/globle DEFCLASS *LookupDefclassByMdlOrScope(  void *theEnv,  const char *classAndModuleName)  {   DEFCLASS *cls;   const char *className;   SYMBOL_HN *classSymbol;   struct defmodule *theModule;   if (FindModuleSeparator(classAndModuleName) == FALSE)     return(LookupDefclassInScope(theEnv,classAndModuleName));   SaveCurrentModule(theEnv);   className = ExtractModuleAndConstructName(theEnv,classAndModuleName);   theModule = ((struct defmodule *) EnvGetCurrentModule(theEnv));   RestoreCurrentModule(theEnv);   if(className == NULL)     return(NULL);   if ((classSymbol = FindSymbolHN(theEnv,className)) == NULL)     return(NULL);   cls = DefclassData(theEnv)->ClassTable[HashClass(classSymbol)];   while (cls != NULL)     {      if ((cls->header.name == classSymbol) &&          (cls->header.whichModule->theModule == theModule))        return(cls->installed ? cls : NULL);      cls = cls->nxtHash;     }   return(NULL);  }
开发者ID:Khenji55,项目名称:Computacion_UCLM,代码行数:42,


示例4: UpdateDefclassesScope

/***************************************************  NAME         : UpdateDefclassesScope  DESCRIPTION  : This function updates the scope                 bitmaps for existing classes when                 a new module is defined  INPUTS       : None  RETURNS      : Nothing  SIDE EFFECTS : Class scope bitmaps are updated  NOTES        : None ***************************************************/static void UpdateDefclassesScope(    void *theEnv){    register unsigned i;    DEFCLASS *theDefclass;    int newModuleID,count;    char *newScopeMap;    unsigned newScopeMapSize;    char *className;    struct defmodule *matchModule;    newModuleID = (int) ((struct defmodule *) EnvGetCurrentModule(theEnv))->bsaveID;    newScopeMapSize = (sizeof(char) * ((GetNumberOfDefmodules(theEnv) / BITS_PER_BYTE) + 1));    newScopeMap = (char *) gm2(theEnv,newScopeMapSize);    for (i = 0 ; i < CLASS_TABLE_HASH_SIZE ; i++)        for (theDefclass = DefclassData(theEnv)->ClassTable[i] ;                theDefclass != NULL ;                theDefclass = theDefclass->nxtHash)        {            matchModule = theDefclass->header.whichModule->theModule;            className = ValueToString(theDefclass->header.name);            ClearBitString((void *) newScopeMap,newScopeMapSize);            GenCopyMemory(char,theDefclass->scopeMap->size,                          newScopeMap,ValueToBitMap(theDefclass->scopeMap));            DecrementBitMapCount(theEnv,theDefclass->scopeMap);            if (theDefclass->system)                SetBitMap(newScopeMap,newModuleID);            else if (FindImportedConstruct(theEnv,(char*)"defclass",matchModule,                                           className,&count,TRUE,NULL) != NULL)                SetBitMap(newScopeMap,newModuleID);            theDefclass->scopeMap = (BITMAP_HN *) EnvAddBitMap(theEnv,(void *) newScopeMap,newScopeMapSize);            IncrementBitMapCount(theDefclass->scopeMap);        }    rm(theEnv,(void *) newScopeMap,newScopeMapSize);}
开发者ID:DrItanium,项目名称:AdventureEngine,代码行数:45,


示例5: ClearDefrulesReady

static int ClearDefrulesReady(  void *theEnv)  {   if (EngineData(theEnv)->ExecutingRule != NULL) return(FALSE);      EnvClearFocusStack(theEnv);   if (EnvGetCurrentModule(theEnv) == NULL) return(FALSE);   DefruleData(theEnv)->CurrentEntityTimeTag = 0L;   return(TRUE);  }
开发者ID:pandaxcl,项目名称:CLIPS-unicode,代码行数:12,


示例6: PrintChangedAgenda

/*******************************************************************************          Name:        PrintChangedAgenda          Description: Update the agenda window          Arguments:   None          Returns:      *******************************************************************************/int PrintChangedAgenda()  {   void *theEnv = GetCurrentEnvironment();   void *rule_ptr;   char buffer[MAX_CHAR_IN_BUF];   char *name, labelBuffer[MAX_CHAR_IN_BUF];   Window AgendaWin;   Display *theDisplay;   struct defmodule* theModule = (struct defmodule *) EnvGetCurrentModule(theEnv);   /*======================================================*/   /* Change the name of the window to the current module. */   /*======================================================*/      AgendaWin = XtWindow(agenda);   theDisplay = XtDisplay(agenda);   if (theModule  != NULL)     {      name = EnvGetDefmoduleName(theEnv,theModule);      strcpy(labelBuffer,"Agenda Window(");      strcat(labelBuffer,name);      strcat(labelBuffer,")");     }    else     {      strcpy(labelBuffer,"Agenda Window");     }      XStoreName(theDisplay,AgendaWin,labelBuffer);      /*============================*/   /* Wipe out the old contents. */   /*============================*/   XtSetArg(TheArgs[0], XtNstring, "");   XtSetValues(agenda_text, TheArgs, 1);   XawAsciiSourceFreeString(XawTextGetSource(agenda_text));   /*============================*/   /* Print the new agenda list. */   /*============================*/   rule_ptr = EnvGetNextActivation(theEnv,NULL);   while (rule_ptr != NULL)     {      EnvGetActivationPPForm(theEnv,buffer,MAX_CHAR_IN_BUF - 1,rule_ptr);      EnvPrintRouter(theEnv,"xagenda",buffer);      EnvPrintRouter(theEnv,"xagenda", "/n");      rule_ptr = EnvGetNextActivation(theEnv,rule_ptr);     }       return 0;  }
开发者ID:RenRenJuan,项目名称:DACLIPS,代码行数:59,


示例7: PrintGenericName

/******************************************************  NAME         : PrintGenericName  DESCRIPTION  : Prints the name of a gneric function                 (including the module name if the                  generic is not in the current module)  INPUTS       : 1) The logical name of the output                 2) The generic functions  RETURNS      : Nothing useful  SIDE EFFECTS : Generic name printed  NOTES        : None ******************************************************/globle void PrintGenericName(  void *theEnv,  char *logName,  DEFGENERIC *gfunc)  {   if (gfunc->header.whichModule->theModule != ((struct defmodule *) EnvGetCurrentModule(theEnv)))     {      EnvPrintRouter(theEnv,logName,EnvGetDefmoduleName(theEnv,(void *)                        gfunc->header.whichModule->theModule));      EnvPrintRouter(theEnv,logName,(char*)"::");     }   EnvPrintRouter(theEnv,logName,ValueToString((void *) gfunc->header.name));  }
开发者ID:DrItanium,项目名称:AdventureEngine,代码行数:24,


示例8: EnvArgCountCheck

globle void *GetCurrentModuleCommand(  void *theEnv)  {   struct defmodule *theModule;   EnvArgCountCheck(theEnv,"get-current-module",EXACTLY,0);   theModule = (struct defmodule *) EnvGetCurrentModule(theEnv);   if (theModule == NULL) return((SYMBOL_HN *) EnvFalseSymbol(theEnv));   return((SYMBOL_HN *) EnvAddSymbol(theEnv,ValueToString(theModule->name)));  }
开发者ID:bigsmiles,项目名称:eventCLIPS,代码行数:13,


示例9: ClearDefrulesReady

static bool ClearDefrulesReady(  void *theEnv)  {   if (EngineData(theEnv)->ExecutingRule != NULL) return(false);   if (EngineData(theEnv)->JoinOperationInProgress) return(false);   EnvClearFocusStack(theEnv);   if (EnvGetCurrentModule(theEnv) == NULL) return(false);   DefruleData(theEnv)->CurrentEntityTimeTag = 1L;   return(true);  }
开发者ID:guitarpoet,项目名称:php-clips,代码行数:14,


示例10: GetFactListFunction

globle void GetFactListFunction(  void *theEnv,  DATA_OBJECT_PTR returnValue)  {   struct defmodule *theModule;   DATA_OBJECT result;   int numArgs;   /*===========================================*/   /* Determine if a module name was specified. */   /*===========================================*/   if ((numArgs = EnvArgCountCheck(theEnv,"get-fact-list",NO_MORE_THAN,1)) == -1)     {      EnvSetMultifieldErrorValue(theEnv,returnValue);      return;     }   if (numArgs == 1)     {      EnvRtnUnknown(theEnv,1,&result);      if (GetType(result) != SYMBOL)        {         EnvSetMultifieldErrorValue(theEnv,returnValue);         ExpectedTypeError1(theEnv,"get-fact-list",1,"defmodule name");         return;        }      if ((theModule = (struct defmodule *) EnvFindDefmodule(theEnv,DOToString(result))) == NULL)        {         if (strcmp("*",DOToString(result)) != 0)           {            EnvSetMultifieldErrorValue(theEnv,returnValue);            ExpectedTypeError1(theEnv,"get-fact-list",1,"defmodule name");            return;           }         theModule = NULL;        }     }   else     { theModule = ((struct defmodule *) EnvGetCurrentModule(theEnv)); }   /*=====================*/   /* Get the constructs. */   /*=====================*/   EnvGetFactList(theEnv,returnValue,theModule);  }
开发者ID:noxdafox,项目名称:clips,代码行数:50,


示例11: PrintChangedGlobals

/*******************************************************************************          Name:        PrintChangedGlobals          Description: Update the global window          Arguments:   None          Returns:*******************************************************************************/int PrintChangedGlobals()  {   void *theEnv = GetCurrentEnvironment();   void *dgPtr;   int n;   char *buffer;   char *name,labelBuffer[MAX_CHAR_IN_BUF];   Window GlobalWin;   Display *theDisplay;   struct defmodule* theModule = (struct defmodule *) EnvGetCurrentModule(theEnv);   /* Change the name of the window to the current module */   GlobalWin = XtWindow(globals);   theDisplay = XtDisplay(globals);   if (theModule  != NULL)     {      name = EnvGetDefmoduleName(theEnv,theModule);      strcpy(labelBuffer,"Globals Window(");      strcat(labelBuffer,name);      strcat(labelBuffer,")");     }    else     {      strcpy(labelBuffer,"Globals Window");     }    XStoreName(theDisplay,GlobalWin,labelBuffer);   /* Clear the old contents */   n = 0;   XtSetArg(TheArgs[n],XtNstring,"");n++;   XtSetValues(globals_text,TheArgs,n);   XawAsciiSourceFreeString(XawTextGetSource(globals_text));   /* Print the new defglobal list */   dgPtr = EnvGetNextDefglobal(theEnv,NULL);   while (dgPtr != NULL)     {      buffer = (char *) EnvGetDefglobalPPForm(theEnv,(struct constructHeader *) dgPtr);      EnvPrintRouter(theEnv,"xglobals",buffer);      EnvPrintRouter(theEnv,"xglobals","/n");      dgPtr = EnvGetNextDefglobal(theEnv,dgPtr);     }      return 0;  }
开发者ID:RenRenJuan,项目名称:DACLIPS,代码行数:55,


示例12: UpdateStatusWndTitle

static void UpdateStatusWndTitle(  HWND hwnd)  {     void *theEnv = GlobalEnv;   struct statusWindowData *theData;   struct defmodule *theModule = (struct defmodule *) EnvGetCurrentModule(theEnv);   char buffer[255];          theData = (struct statusWindowData *) GetWindowLongPtr(hwnd,GWLP_USERDATA);      if (theData == NULL) return;       sprintf(buffer,"%s (%s)",theData->baseName,EnvGetDefmoduleName(theEnv,theModule));   SetWindowText(hwnd,buffer);  }
开发者ID:Viriana,项目名称:SISE,代码行数:15,


示例13: PrintChangedFacts

/*******************************************************************************          Name:        PrintChangedFacts          Description: Update the fact window          Arguments:   None          Returns:      *******************************************************************************/int PrintChangedFacts()  {   void *theEnv = GetCurrentEnvironment();  void *fact_ptr;  char buffer[MAX_CHAR_IN_BUF];  char *name,labelBuffer[MAX_CHAR_IN_BUF];  Window FactWin;  Display *theDisplay;  struct defmodule* theModule = (struct defmodule *) EnvGetCurrentModule(theEnv); /* Change the name of the window to the current module */  FactWin = XtWindow(facts);  theDisplay = XtDisplay(facts);  if(theModule  != NULL)     {       name = EnvGetDefmoduleName(theEnv,theModule);       strcpy(labelBuffer,"Fact Window(");       strcat(labelBuffer,name);       strcat(labelBuffer,")");     }    else     {       strcpy(labelBuffer,"Fact Window");     }  XStoreName(theDisplay,FactWin,labelBuffer);  /* Clear the old contents */  XtSetArg(TheArgs[0], XtNstring, "");  XtSetValues(facts_text, TheArgs, 1);  XawAsciiSourceFreeString(XawTextGetSource(facts_text));  /* Print the new fact list */  fact_ptr = EnvGetNextFact(theEnv,NULL);  while (fact_ptr != NULL)    {    EnvGetFactPPForm(theEnv,buffer,MAX_CHAR_IN_BUF - 1,fact_ptr);    EnvPrintRouter(theEnv,"xfacts",buffer);    EnvPrintRouter(theEnv,"xfacts", "/n");    fact_ptr = EnvGetNextFact(theEnv,fact_ptr);    }  return 0;  }
开发者ID:RenRenJuan,项目名称:DACLIPS,代码行数:53,


示例14: PrintChangedInstances

/*******************************************************************************          Name:        PrintChangedInstances          Description: Update the instances window          Arguments:   None          Returns:*******************************************************************************/int PrintChangedInstances()  {   void *theEnv = GetCurrentEnvironment();   int n = 0;   void *instancePtr;   char buffer[MAX_CHAR_IN_BUF];   char *name, labelBuffer[MAX_CHAR_IN_BUF];   Window InstanceWin;   Display *theDisplay;   struct defmodule* theModule = (struct defmodule *) EnvGetCurrentModule(theEnv);   /* Change the name of the window to the current module */   InstanceWin = XtWindow(instances);   theDisplay = XtDisplay(instances);   if (theModule != NULL)     {      name = EnvGetDefmoduleName(theEnv,theModule);      strcpy(labelBuffer,"Instances Window(");      strcat(labelBuffer,name);      strcat(labelBuffer,")");     }   else     {      strcpy(labelBuffer,"Instances Window");     }   XStoreName(theDisplay,InstanceWin,labelBuffer);   /* Clear the old contents */   XtSetArg(TheArgs[n],XtNstring,"");n++;   XtSetValues(instances_text,TheArgs,n);   XawAsciiSourceFreeString(XawTextGetSource(instances_text));   /* Print the new instance list */   instancePtr = (void *) EnvGetNextInstance(theEnv,NULL);   while (instancePtr != NULL)     {      EnvGetInstancePPForm(theEnv,buffer,MAX_CHAR_IN_BUF - 1,instancePtr);      EnvPrintRouter(theEnv,"xinstances",buffer);      EnvPrintRouter(theEnv,"xinstances","/n");      instancePtr = (void *) EnvGetNextInstance(theEnv,instancePtr);     }     return 0;  }
开发者ID:RenRenJuan,项目名称:DACLIPS,代码行数:52,


示例15: printed

/******************************************************  NAME         : PrintClassName  DESCRIPTION  : Displays a class's name  INPUTS       : 1) Logical name of output                 2) The class                 3) Flag indicating whether to                    print carriage-return at end  RETURNS      : Nothing useful  SIDE EFFECTS : Class name printed (and module name                 too if class is not in current module)  NOTES        : None ******************************************************/globle void PrintClassName(  void *theEnv,  char *logicalName,  DEFCLASS *theDefclass,  intBool linefeedFlag)  {   if ((theDefclass->header.whichModule->theModule != ((struct defmodule *) EnvGetCurrentModule(theEnv))) &&       (theDefclass->system == 0))     {      EnvPrintRouter(theEnv,logicalName,                 EnvGetDefmoduleName(theEnv,theDefclass->header.whichModule->theModule));      EnvPrintRouter(theEnv,logicalName,"::");     }   EnvPrintRouter(theEnv,logicalName,ValueToString(theDefclass->header.name));   if (linefeedFlag)     EnvPrintRouter(theEnv,logicalName,"/n");  }
开发者ID:femto,项目名称:rbclips,代码行数:29,


示例16: EnvGetCurrentModule

globle void *SetCurrentModuleCommand(  void *theEnv)  {   DATA_OBJECT argPtr;   char *argument;   struct defmodule *theModule;   SYMBOL_HN *defaultReturn;   /*=====================================================*/   /* Check for the correct number and type of arguments. */   /*=====================================================*/   theModule = ((struct defmodule *) EnvGetCurrentModule(theEnv));   if (theModule == NULL) return((SYMBOL_HN *) EnvFalseSymbol(theEnv));   defaultReturn = (SYMBOL_HN *) EnvAddSymbol(theEnv,ValueToString(((struct defmodule *) EnvGetCurrentModule(theEnv))->name));   if (EnvArgCountCheck(theEnv,"set-current-module",EXACTLY,1) == -1)     { return(defaultReturn); }   if (EnvArgTypeCheck(theEnv,"set-current-module",1,SYMBOL,&argPtr) == FALSE)     { return(defaultReturn); }   argument = DOToString(argPtr);   /*================================================*/   /* Set the current module to the specified value. */   /*================================================*/   theModule = (struct defmodule *) EnvFindDefmodule(theEnv,argument);   if (theModule == NULL)     {      CantFindItemErrorMessage(theEnv,"defmodule",argument);      return(defaultReturn);     }   EnvSetCurrentModule(theEnv,(void *) theModule);   /*================================*/   /* Return the new current module. */   /*================================*/   return((SYMBOL_HN *) defaultReturn);  }
开发者ID:bigsmiles,项目名称:eventCLIPS,代码行数:45,


示例17: ShowBreaksCommand

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);  }
开发者ID:femto,项目名称:rbclips,代码行数:18,


示例18: FindImportedConstruct

globle struct lhsParseNode *CreateInitialFactPattern(  void *theEnv)  {   struct lhsParseNode *topNode;   struct deftemplate *theDeftemplate;   int count;      /*==================================*/   /* If the initial-fact deftemplate  */   /* doesn't exist, then create it.   */   /*==================================*/   theDeftemplate = (struct deftemplate *)                    FindImportedConstruct(theEnv,"deftemplate",NULL,"initial-fact",                                          &count,TRUE,NULL);   if (theDeftemplate == NULL)     {      PrintWarningID(theEnv,"FACTLHS",1,FALSE);      EnvPrintRouter(theEnv,WWARNING,"Creating implied initial-fact deftemplate in module ");      EnvPrintRouter(theEnv,WWARNING,EnvGetDefmoduleName(theEnv,EnvGetCurrentModule(theEnv)));      EnvPrintRouter(theEnv,WWARNING,"./n");      EnvPrintRouter(theEnv,WWARNING,"  You probably want to import this deftemplate from the MAIN module./n");      CreateImpliedDeftemplate(theEnv,(SYMBOL_HN *) EnvAddSymbol(theEnv,"initial-fact"),FALSE);     }   /*====================================*/   /* Create the (initial-fact) pattern. */   /*====================================*/   topNode = GetLHSParseNode(theEnv);   topNode->type = SF_WILDCARD;   topNode->index = 0;   topNode->slotNumber = 1;   topNode->bottom = GetLHSParseNode(theEnv);   topNode->bottom->type = SYMBOL;   topNode->bottom->value = (void *) EnvAddSymbol(theEnv,"initial-fact");   /*=====================*/   /* Return the pattern. */   /*=====================*/   return(topNode);  }
开发者ID:Anusaaraka,项目名称:anusaaraka,代码行数:44,


示例19: module

/***************************************************  NAME         : DefclassInScope  DESCRIPTION  : Determines if a defclass is in                 scope of the given module  INPUTS       : 1) The defclass                 2) The module (NULL for current                    module)  RETURNS      : TRUE if in scope,                 FALSE otherwise  SIDE EFFECTS : None  NOTES        : None ***************************************************/globle intBool DefclassInScope(  void *theEnv,  DEFCLASS *theDefclass,  struct defmodule *theModule)  {#if DEFMODULE_CONSTRUCT   int moduleID;   char *scopeMap;   scopeMap = (char *) ValueToBitMap(theDefclass->scopeMap);   if (theModule == NULL)     theModule = ((struct defmodule *) EnvGetCurrentModule(theEnv));   moduleID = (int) theModule->bsaveID;   return(TestBitMap(scopeMap,moduleID) ? TRUE : FALSE);#else#if MAC_XCD#pragma unused(theEnv,theDefclass,theModule)#endif   return(TRUE);#endif  }
开发者ID:Khenji55,项目名称:Computacion_UCLM,代码行数:33,


示例20: GetVariableDefinition

static intBool GetVariableDefinition(  void *theEnv,  char *readSource,  int *defglobalError,  int tokenRead,  struct token *theToken)  {   SYMBOL_HN *variableName;   struct expr *assignPtr;   DATA_OBJECT assignValue;   /*========================================*/   /* Get next token, which should either be */   /* a closing parenthesis or a variable.   */   /*========================================*/   if (! tokenRead) GetToken(theEnv,readSource,theToken);   if (theToken->type == RPAREN) return(FALSE);   if (theToken->type == SF_VARIABLE)     {      SyntaxErrorMessage(theEnv,"defglobal");      *defglobalError = TRUE;      return(FALSE);     }   else if (theToken->type != GBL_VARIABLE)     {      SyntaxErrorMessage(theEnv,"defglobal");      *defglobalError = TRUE;      return(FALSE);     }   variableName = (SYMBOL_HN *) theToken->value;   SavePPBuffer(theEnv," ");   /*================================*/   /* Print out compilation message. */   /*================================*/#if DEBUGGING_FUNCTIONS   if ((EnvGetWatchItem(theEnv,"compilations") == ON) && GetPrintWhileLoading(theEnv))     {      if (QFindDefglobal(theEnv,variableName) != NULL)         {         PrintWarningID(theEnv,"CSTRCPSR",1,TRUE);         EnvPrintRouter(theEnv,WDIALOG,"Redefining defglobal: ");        }      else EnvPrintRouter(theEnv,WDIALOG,"Defining defglobal: ");      EnvPrintRouter(theEnv,WDIALOG,ValueToString(variableName));      EnvPrintRouter(theEnv,WDIALOG,"/n");     }   else#endif     { if (GetPrintWhileLoading(theEnv)) EnvPrintRouter(theEnv,WDIALOG,":"); }   /*==================================================================*/   /* Check for import/export conflicts from the construct definition. */   /*==================================================================*/#if DEFMODULE_CONSTRUCT   if (FindImportExportConflict(theEnv,"defglobal",((struct defmodule *) EnvGetCurrentModule(theEnv)),ValueToString(variableName)))     {      ImportExportConflictMessage(theEnv,"defglobal",ValueToString(variableName),NULL,NULL);      *defglobalError = TRUE;      return(FALSE);     }#endif   /*==============================*/   /* The next token must be an =. */   /*==============================*/   GetToken(theEnv,readSource,theToken);   if (strcmp(theToken->printForm,"=") != 0)     {      SyntaxErrorMessage(theEnv,"defglobal");      *defglobalError = TRUE;      return(FALSE);     }   SavePPBuffer(theEnv," ");   /*======================================================*/   /* Parse the expression to be assigned to the variable. */   /*======================================================*/   assignPtr = ParseAtomOrExpression(theEnv,readSource,NULL);   if (assignPtr == NULL)     {      *defglobalError = TRUE;      return(FALSE);     }   /*==========================*/   /* Evaluate the expression. */   /*==========================*/   if (! ConstructData(theEnv)->CheckSyntaxMode)     {//.........这里部分代码省略.........
开发者ID:femto,项目名称:rbclips,代码行数:101,


示例21: EnvGetCurrentModule

static void *SearchImportedConstructModules(  void *theEnv,  EXEC_STATUS,  struct symbolHashNode *constructType,  struct defmodule *matchModule,  struct moduleItem *theModuleItem,  struct symbolHashNode *findName,  int *count,  int searchCurrent,  struct defmodule *notYetDefinedInModule)  {   struct defmodule *theModule;   struct portItem *theImportList, *theExportList;   void *rv, *arv = NULL;   int searchModule, exported;   struct defmodule *currentModule;   /*=========================================*/   /* Start the search in the current module. */   /* If the current module has already been  */   /* visited, then return.                   */   /*=========================================*/   currentModule = ((struct defmodule *) EnvGetCurrentModule(theEnv,execStatus));   if (currentModule->visitedFlag) return(NULL);   /*=======================================================*/   /* The searchCurrent flag indicates whether the current  */   /* module should be included in the search. In addition, */   /* if matchModule is non-NULL, the current module will   */   /* only be searched if it is the specific module from    */   /* which we want the construct imported.                 */   /*=======================================================*/   if ((searchCurrent) &&       ((matchModule == NULL) || (currentModule == matchModule)))     {      /*===============================================*/      /* Look for the construct in the current module. */      /*===============================================*/      rv = (*theModuleItem->findFunction)(theEnv,execStatus,ValueToString(findName));      /*========================================================*/      /* If we're in the process of defining the construct in   */      /* the module we're searching then go ahead and increment */      /* the count indicating the number of modules in which    */      /* the construct was found.                               */      /*========================================================*/      if (notYetDefinedInModule == currentModule)        {         (*count)++;         arv = rv;        }      /*=========================================================*/      /* Otherwise, if the construct is in the specified module, */      /* increment the count only if the construct actually      */      /* belongs to the module. [Some constructs, like the COOL  */      /* system classes, can be found in any module, but they    */      /* actually belong to the MAIN module.]                    */      /*=========================================================*/      else if (rv != NULL)        {         if (((struct constructHeader *) rv)->whichModule->theModule == currentModule)           { (*count)++; }         arv = rv;        }     }   /*=====================================*/   /* Mark the current module as visited. */   /*=====================================*/   currentModule->visitedFlag = TRUE;   /*===================================*/   /* Search through all of the modules */   /* imported by the current module.   */   /*===================================*/   theModule = ((struct defmodule *) EnvGetCurrentModule(theEnv,execStatus));   theImportList = theModule->importList;   while (theImportList != NULL)     {      /*===================================================*/      /* Determine if the module should be searched (based */      /* upon whether the entire module, all constructs of */      /* a specific type, or specifically named constructs */      /* are imported).                                    */      /*===================================================*/      searchModule = FALSE;      if ((theImportList->constructType == NULL) ||          (theImportList->constructType == constructType))        {         if ((theImportList->constructName == NULL) ||//.........这里部分代码省略.........
开发者ID:atrniv,项目名称:CLIPS,代码行数:101,


示例22: int

globle SYMBOL_HN *GetConstructNameAndComment(  void *theEnv,  char *readSource,  struct token *inputToken,  char *constructName,  void *(*findFunction)(void *,char *),  int (*deleteFunction)(void *,void *),  char *constructSymbol,  int fullMessageCR,  int getComment,  int moduleNameAllowed)  {#if (MAC_MCW || WIN_MCW || MAC_XCD) && (! DEBUGGING_FUNCTIONS)#pragma unused(fullMessageCR)#endif   SYMBOL_HN *name, *moduleName;   int redefining = FALSE;   void *theConstruct;   unsigned separatorPosition;   struct defmodule *theModule;   /*==========================*/   /* Next token should be the */   /* name of the construct.   */   /*==========================*/   GetToken(theEnv,readSource,inputToken);   if (inputToken->type != SYMBOL)     {      PrintErrorID(theEnv,"CSTRCPSR",2,TRUE);      EnvPrintRouter(theEnv,WERROR,"Missing name for ");      EnvPrintRouter(theEnv,WERROR,constructName);      EnvPrintRouter(theEnv,WERROR," construct/n");      return(NULL);     }   name = (SYMBOL_HN *) inputToken->value;   /*===============================*/   /* Determine the current module. */   /*===============================*/   separatorPosition = FindModuleSeparator(ValueToString(name));   if (separatorPosition)     {      if (moduleNameAllowed == FALSE)        {         SyntaxErrorMessage(theEnv,"module specifier");         return(NULL);        }      moduleName = ExtractModuleName(theEnv,separatorPosition,ValueToString(name));      if (moduleName == NULL)        {         SyntaxErrorMessage(theEnv,"construct name");         return(NULL);        }      theModule = (struct defmodule *) EnvFindDefmodule(theEnv,ValueToString(moduleName));      if (theModule == NULL)        {         CantFindItemErrorMessage(theEnv,"defmodule",ValueToString(moduleName));         return(NULL);        }      EnvSetCurrentModule(theEnv,(void *) theModule);      name = ExtractConstructName(theEnv,separatorPosition,ValueToString(name));      if (name == NULL)        {         SyntaxErrorMessage(theEnv,"construct name");         return(NULL);        }     }   /*=====================================================*/   /* If the module was not specified, record the current */   /* module name as part of the pretty-print form.       */   /*=====================================================*/   else     {      theModule = ((struct defmodule *) EnvGetCurrentModule(theEnv));      if (moduleNameAllowed)        {         PPBackup(theEnv);         SavePPBuffer(theEnv,EnvGetDefmoduleName(theEnv,theModule));         SavePPBuffer(theEnv,"::");         SavePPBuffer(theEnv,ValueToString(name));        }     }   /*==================================================================*/   /* Check for import/export conflicts from the construct definition. */   /*==================================================================*/#if DEFMODULE_CONSTRUCT   if (FindImportExportConflict(theEnv,constructName,theModule,ValueToString(name)))     {      ImportExportConflictMessage(theEnv,constructName,ValueToString(name),NULL,NULL);      return(NULL);//.........这里部分代码省略.........
开发者ID:Anusaaraka,项目名称:anusaaraka,代码行数:101,


示例23: WatchMethod

/**********************************************************************  NAME         : WatchMethod  DESCRIPTION  : Prints out a trace of the beginning or end                   of the execution of a generic function                   method  INPUTS       : A string to indicate beginning or end of execution  RETURNS      : Nothing useful  SIDE EFFECTS : None  NOTES        : Uses the globals CurrentGeneric, CurrentMethod,                   ProcParamArraySize and ProcParamArray for                   other trace info **********************************************************************/static void WatchMethod(  void *theEnv,  const char *tstring)  {   EnvPrintRouter(theEnv,WTRACE,"MTH ");   EnvPrintRouter(theEnv,WTRACE,tstring);   EnvPrintRouter(theEnv,WTRACE," ");   if (DefgenericData(theEnv)->CurrentGeneric->header.whichModule->theModule != ((struct defmodule *) EnvGetCurrentModule(theEnv)))     {      EnvPrintRouter(theEnv,WTRACE,EnvGetDefmoduleName(theEnv,(void *)                        DefgenericData(theEnv)->CurrentGeneric->header.whichModule->theModule));      EnvPrintRouter(theEnv,WTRACE,"::");     }   EnvPrintRouter(theEnv,WTRACE,ValueToString((void *) DefgenericData(theEnv)->CurrentGeneric->header.name));   EnvPrintRouter(theEnv,WTRACE,":#");   if (DefgenericData(theEnv)->CurrentMethod->system)     EnvPrintRouter(theEnv,WTRACE,"SYS");   PrintLongInteger(theEnv,WTRACE,(long long) DefgenericData(theEnv)->CurrentMethod->index);   EnvPrintRouter(theEnv,WTRACE," ");   EnvPrintRouter(theEnv,WTRACE," ED:");   PrintLongInteger(theEnv,WTRACE,(long long) EvaluationData(theEnv)->CurrentEvaluationDepth);   PrintProcParamArray(theEnv,WTRACE);  }
开发者ID:guitarpoet,项目名称:php-clips,代码行数:35,


示例24: EnvRun

//.........这里部分代码省略.........     }   /*=====================================================*/   /* Make sure run functions are executed at least once. */   /*=====================================================*/   if (rulesFired == 0)     {      for (theRunFunction = EngineData(theEnv)->ListOfRunFunctions;           theRunFunction != NULL;           theRunFunction = theRunFunction->next)        {          if (theRunFunction->environmentAware)           { (*theRunFunction->func)(theEnv); }         else                       { ((void (*)(void))(*theRunFunction->func))(); }        }     }   /*======================================================*/   /* If rule execution was halted because the rule firing */   /* limit was reached, then print a message.             */   /*======================================================*/   if (runLimit == rulesFired)     { EnvPrintRouter(theEnv,WDIALOG,"rule firing limit reached/n"); }   /*==============================*/   /* Restore execution variables. */   /*==============================*/   EngineData(theEnv)->ExecutingRule = NULL;   EngineData(theEnv)->HaltRules = FALSE;   /*=================================================*/   /* Print out statistics if they are being watched. */   /*=================================================*/#if DEBUGGING_FUNCTIONS   if (EngineData(theEnv)->WatchStatistics)     {      char printSpace[60];      endTime = gentime();      PrintLongInteger(theEnv,WDIALOG,rulesFired);      EnvPrintRouter(theEnv,WDIALOG," rules fired");#if (! GENERIC)      if (startTime != endTime)        {         EnvPrintRouter(theEnv,WDIALOG,"        Run time is ");         PrintFloat(theEnv,WDIALOG,endTime - startTime);         EnvPrintRouter(theEnv,WDIALOG," seconds./n");         PrintFloat(theEnv,WDIALOG,(double) rulesFired / (endTime - startTime));         EnvPrintRouter(theEnv,WDIALOG," rules per second./n");        }      else        { EnvPrintRouter(theEnv,WDIALOG,"/n"); }#endif#if DEFTEMPLATE_CONSTRUCT      sprintf(printSpace,"%ld mean number of facts (%ld maximum)./n",                          (long) (((double) sumFacts / (rulesFired + 1)) + 0.5),                          maxFacts);      EnvPrintRouter(theEnv,WDIALOG,printSpace);#endif#if OBJECT_SYSTEM      sprintf(printSpace,"%ld mean number of instances (%ld maximum)./n",                          (long) (((double) sumInstances / (rulesFired + 1)) + 0.5),                          maxInstances);      EnvPrintRouter(theEnv,WDIALOG,printSpace);#endif      sprintf(printSpace,"%ld mean number of activations (%ld maximum)./n",                          (long) (((double) sumActivations / (rulesFired + 1)) + 0.5),                          maxActivations);      EnvPrintRouter(theEnv,WDIALOG,printSpace);     }#endif   /*==========================================*/   /* The current module should be the current */   /* focus when the run finishes.             */   /*==========================================*/   if (EngineData(theEnv)->CurrentFocus != NULL)     {      if (EngineData(theEnv)->CurrentFocus->theModule != ((struct defmodule *) EnvGetCurrentModule(theEnv)))        { EnvSetCurrentModule(theEnv,(void *) EngineData(theEnv)->CurrentFocus->theModule); }     }   /*===================================*/   /* Return the number of rules fired. */   /*===================================*/   EngineData(theEnv)->AlreadyRunning = FALSE;   return(rulesFired);  }
开发者ID:femto,项目名称:rbclips,代码行数:101,


示例25: GetConstructNameAndComment

/************************************************************  NAME         : ValidDeffunctionName  DESCRIPTION  : Determines if a new deffunction of the given                 name can be defined in the current module  INPUTS       : The new deffunction name  RETURNS      : TRUE if OK, FALSE otherwise  SIDE EFFECTS : Error message printed if not OK  NOTES        : GetConstructNameAndComment() (called before                 this function) ensures that the deffunction                 name does not conflict with one from                 another module ************************************************************/static BOOLEAN ValidDeffunctionName(  void *theEnv,  char *theDeffunctionName)  {   struct constructHeader *theDeffunction;#if DEFGENERIC_CONSTRUCT   struct defmodule *theModule;   struct constructHeader *theDefgeneric;#endif   /* ============================================      A deffunction cannot be named the same as a      construct type, e.g, defclass, defrule, etc.      ============================================ */   if (FindConstruct(theEnv,theDeffunctionName) != NULL)     {      PrintErrorID(theEnv,"DFFNXPSR",1,FALSE);      EnvPrintRouter(theEnv,WERROR,"Deffunctions are not allowed to replace constructs./n");      return(FALSE);     }   /* ============================================      A deffunction cannot be named the same as a      pre-defined system function, e.g, watch,      list-defrules, etc.      ============================================ */   if (FindFunction(theEnv,theDeffunctionName) != NULL)     {      PrintErrorID(theEnv,"DFFNXPSR",2,FALSE);      EnvPrintRouter(theEnv,WERROR,"Deffunctions are not allowed to replace external functions./n");      return(FALSE);     }#if DEFGENERIC_CONSTRUCT   /* ============================================      A deffunction cannot be named the same as a      generic function (either in this module or      imported from another)      ============================================ */   theDefgeneric =     (struct constructHeader *) LookupDefgenericInScope(theEnv,theDeffunctionName);   if (theDefgeneric != NULL)     {      theModule = GetConstructModuleItem(theDefgeneric)->theModule;      if (theModule != ((struct defmodule *) EnvGetCurrentModule(theEnv)))        {         PrintErrorID(theEnv,"DFFNXPSR",5,FALSE);         EnvPrintRouter(theEnv,WERROR,"Defgeneric ");         EnvPrintRouter(theEnv,WERROR,EnvGetDefgenericName(theEnv,(void *) theDefgeneric));         EnvPrintRouter(theEnv,WERROR," imported from module ");         EnvPrintRouter(theEnv,WERROR,EnvGetDefmoduleName(theEnv,(void *) theModule));         EnvPrintRouter(theEnv,WERROR," conflicts with this deffunction./n");         return(FALSE);        }      else        {         PrintErrorID(theEnv,"DFFNXPSR",3,FALSE);         EnvPrintRouter(theEnv,WERROR,"Deffunctions are not allowed to replace generic functions./n");        }      return(FALSE);     }#endif   theDeffunction = (struct constructHeader *) EnvFindDeffunction(theEnv,theDeffunctionName);   if (theDeffunction != NULL)     {      /* ===========================================         And a deffunction in the current module can         only be redefined if it is not executing.         =========================================== */      if (((DEFFUNCTION *) theDeffunction)->executing)        {         PrintErrorID(theEnv,"DFNXPSR",4,FALSE);         EnvPrintRouter(theEnv,WERROR,"Deffunction ");         EnvPrintRouter(theEnv,WERROR,EnvGetDeffunctionName(theEnv,(void *) theDeffunction));         EnvPrintRouter(theEnv,WERROR," may not be redefined while it is executing./n");         return(FALSE);        }     }   return(TRUE);  }
开发者ID:aliverobotics,项目名称:Pumas-SmallSize,代码行数:93,


示例26: IllegalModuleSpecifierMessage

globle struct lhsParseNode *FactPatternParse(  void *theEnv,  char *readSource,  struct token *theToken)  {   struct deftemplate *theDeftemplate;   int count;   /*=========================================*/   /* A module separator can not be included  */   /* as part of the pattern's relation name. */   /*=========================================*/   if (FindModuleSeparator(ValueToString(theToken->value)))     {      IllegalModuleSpecifierMessage(theEnv);      return(NULL);     }   /*=========================================================*/   /* Find the deftemplate associated with the relation name. */   /*=========================================================*/   theDeftemplate = (struct deftemplate *)                    FindImportedConstruct(theEnv,"deftemplate",NULL,ValueToString(theToken->value),                                          &count,TRUE,NULL);   if (count > 1)     {      AmbiguousReferenceErrorMessage(theEnv,"deftemplate",ValueToString(theToken->value));      return(NULL);     }   /*======================================================*/   /* If no deftemplate exists with the specified relation */   /* name, then create an implied deftemplate.            */   /*======================================================*/   if (theDeftemplate == NULL)     {#if DEFMODULE_CONSTRUCT      if (FindImportExportConflict(theEnv,"deftemplate",((struct defmodule *) EnvGetCurrentModule(theEnv)),ValueToString(theToken->value)))        {         ImportExportConflictMessage(theEnv,"implied deftemplate",ValueToString(theToken->value),NULL,NULL);         return(NULL);        }#endif /* DEFMODULE_CONSTRUCT */      if (! ConstructData(theEnv)->CheckSyntaxMode)        { theDeftemplate = CreateImpliedDeftemplate(theEnv,(SYMBOL_HN *) theToken->value,TRUE); }      else        { theDeftemplate = NULL; }     }   /*===============================================*/   /* If an explicit deftemplate exists, then parse */   /* the pattern as a deftemplate pattern.         */   /*===============================================*/   if ((theDeftemplate != NULL) && (theDeftemplate->implied == FALSE))     { return(DeftemplateLHSParse(theEnv,readSource,theDeftemplate)); }   /*================================*/   /* Parse an ordered fact pattern. */   /*================================*/   return(SequenceRestrictionParse(theEnv,readSource,theToken));  }
开发者ID:Anusaaraka,项目名称:anusaaraka,代码行数:68,


示例27: ParseDefglobal

globle intBool ParseDefglobal(  void *theEnv,  char *readSource)  {   int defglobalError = FALSE;#if (MAC_MCW || IBM_MCW) && (RUN_TIME || BLOAD_ONLY)#pragma unused(theEnv,readSource)#endif#if (! RUN_TIME) && (! BLOAD_ONLY)   struct token theToken;   int tokenRead = TRUE;   struct defmodule *theModule;   /*=====================================*/   /* Pretty print buffer initialization. */   /*=====================================*/   SetPPBufferStatus(theEnv,ON);   FlushPPBuffer(theEnv);   SetIndentDepth(theEnv,3);   SavePPBuffer(theEnv,"(defglobal ");   /*=================================================*/   /* Individual defglobal constructs can't be parsed */   /* while a binary load is in effect.               */   /*=================================================*/#if BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE   if ((Bloaded(theEnv) == TRUE) && (! ConstructData(theEnv)->CheckSyntaxMode))     {      CannotLoadWithBloadMessage(theEnv,"defglobal");      return(TRUE);     }#endif   /*===========================*/   /* Look for the module name. */   /*===========================*/   GetToken(theEnv,readSource,&theToken);   if (theToken.type == SYMBOL)     {      /*=================================================*/      /* The optional module name can't contain a module */      /* separator like other constructs. For example,   */      /* (defrule X::foo is OK for rules, but the right  */      /* syntax for defglobals is (defglobal X ?*foo*.   */      /*=================================================*/      tokenRead = FALSE;      if (FindModuleSeparator(ValueToString(theToken.value)))        {         SyntaxErrorMessage(theEnv,"defglobal");         return(TRUE);        }      /*=================================*/      /* Determine if the module exists. */      /*=================================*/      theModule = (struct defmodule *) EnvFindDefmodule(theEnv,ValueToString(theToken.value));      if (theModule == NULL)        {         CantFindItemErrorMessage(theEnv,"defmodule",ValueToString(theToken.value));         return(TRUE);        }      /*=========================================*/      /* If the module name was OK, then set the */      /* current module to the specified module. */      /*=========================================*/      SavePPBuffer(theEnv," ");      EnvSetCurrentModule(theEnv,(void *) theModule);     }   /*===========================================*/   /* If the module name wasn't specified, then */   /* use the current module's name in the      */   /* defglobal's pretty print representation.  */   /*===========================================*/   else     {      PPBackup(theEnv);      SavePPBuffer(theEnv,EnvGetDefmoduleName(theEnv,((struct defmodule *) EnvGetCurrentModule(theEnv))));      SavePPBuffer(theEnv," ");      SavePPBuffer(theEnv,theToken.printForm);     }   /*======================*/   /* Parse the variables. */   /*======================*/   while (GetVariableDefinition(theEnv,readSource,&defglobalError,tokenRead,&theToken))     {      tokenRead = FALSE;//.........这里部分代码省略.........
开发者ID:femto,项目名称:rbclips,代码行数:101,


示例28: EnvSaveFacts

globle intBool EnvSaveFacts(  void *theEnv,  char *fileName,  int saveCode,  struct expr *theList)  {   int tempValue1, tempValue2, tempValue3;   struct fact *theFact;   FILE *filePtr;   struct defmodule *theModule;   DATA_OBJECT_PTR theDOArray;   int count, i, printFact, error;   /*======================================================*/   /* Open the file. Use either "fast save" or I/O Router. */   /*======================================================*/   if ((filePtr = GenOpen(theEnv,fileName,(char*)"w")) == NULL)     {      OpenErrorMessage(theEnv,(char*)"save-facts",fileName);      return(FALSE);     }   SetFastSave(theEnv,filePtr);   /*===========================================*/   /* Set the print flags so that addresses and */   /* strings are printed properly to the file. */   /*===========================================*/   tempValue1 = PrintUtilityData(theEnv)->PreserveEscapedCharacters;   PrintUtilityData(theEnv)->PreserveEscapedCharacters = TRUE;   tempValue2 = PrintUtilityData(theEnv)->AddressesToStrings;   PrintUtilityData(theEnv)->AddressesToStrings = TRUE;   tempValue3 = PrintUtilityData(theEnv)->InstanceAddressesToNames;   PrintUtilityData(theEnv)->InstanceAddressesToNames = TRUE;   /*===================================================*/   /* Determine the list of specific facts to be saved. */   /*===================================================*/   theDOArray = GetSaveFactsDeftemplateNames(theEnv,theList,saveCode,&count,&error);   if (error)     {      PrintUtilityData(theEnv)->PreserveEscapedCharacters = tempValue1;      PrintUtilityData(theEnv)->AddressesToStrings = tempValue2;      PrintUtilityData(theEnv)->InstanceAddressesToNames = tempValue3;      GenClose(theEnv,filePtr);      SetFastSave(theEnv,NULL);      return(FALSE);     }   /*=================*/   /* Save the facts. */   /*=================*/   theModule = ((struct defmodule *) EnvGetCurrentModule(theEnv));   for (theFact = (struct fact *) GetNextFactInScope(theEnv,NULL);        theFact != NULL;        theFact = (struct fact *) GetNextFactInScope(theEnv,theFact))     {      /*===========================================================*/      /* If we're doing a local save and the facts's corresponding */      /* deftemplate isn't in the current module, then don't save  */      /* the fact.                                                 */      /*===========================================================*/      if ((saveCode == LOCAL_SAVE) &&          (theFact->whichDeftemplate->header.whichModule->theModule != theModule))        { printFact = FALSE; }      /*=====================================================*/      /* Otherwise, if the list of facts to be printed isn't */      /* restricted, then set the print flag to TRUE.        */      /*=====================================================*/      else if (theList == NULL)        { printFact = TRUE; }      /*=======================================================*/      /* Otherwise see if the fact's corresponding deftemplate */      /* is in the list of deftemplates whose facts are to be  */      /* saved. If it's in the list, then set the print flag   */      /* to TRUE, otherwise set it to FALSE.                   */      /*=======================================================*/      else        {         printFact = FALSE;         for (i = 0; i < count; i++)           {            if (theDOArray[i].value == (void *) theFact->whichDeftemplate)              {               printFact = TRUE;               break;              }           }        }//.........这里部分代码省略.........
开发者ID:DrItanium,项目名称:DROID-CLIPS,代码行数:101,


示例29: EnvFacts

globle void EnvFacts(  void *theEnv,  char *logicalName,  void *vTheModule,  long long start,  long long end,  long long max)  {   struct fact *factPtr;   long count = 0;   struct defmodule *oldModule, *theModule = (struct defmodule *) vTheModule;   int allModules = FALSE;   /*==========================*/   /* Save the current module. */   /*==========================*/   oldModule = ((struct defmodule *) EnvGetCurrentModule(theEnv));   /*=========================================================*/   /* Determine if facts from all modules are to be displayed */   /* or just facts from the current module.                  */   /*=========================================================*/   if (theModule == NULL) allModules = TRUE;   else EnvSetCurrentModule(theEnv,(void *) theModule);   /*=====================================*/   /* Get the first fact to be displayed. */   /*=====================================*/   if (allModules) factPtr = (struct fact *) EnvGetNextFact(theEnv,NULL);   else factPtr = (struct fact *) GetNextFactInScope(theEnv,NULL);   /*===============================*/   /* Display facts until there are */   /* no more facts to display.     */   /*===============================*/   while (factPtr != NULL)     {      /*==================================================*/      /* Abort the display of facts if the Halt Execution */      /* flag has been set (normally by user action).     */      /*==================================================*/      if (GetHaltExecution(theEnv) == TRUE)        {         EnvSetCurrentModule(theEnv,(void *) oldModule);         return;        }      /*===============================================*/      /* If the maximum fact index of facts to display */      /* has been reached, then stop displaying facts. */      /*===============================================*/      if ((factPtr->factIndex > end) && (end != UNSPECIFIED))        {         PrintTally(theEnv,logicalName,count,(char*)"fact",(char*)"facts");         EnvSetCurrentModule(theEnv,(void *) oldModule);         return;        }      /*================================================*/      /* If the maximum number of facts to be displayed */      /* has been reached, then stop displaying facts.  */      /*================================================*/      if (max == 0)        {         PrintTally(theEnv,logicalName,count,(char*)"fact",(char*)"facts");         EnvSetCurrentModule(theEnv,(void *) oldModule);         return;        }      /*======================================================*/      /* If the index of the fact is greater than the minimum */      /* starting fact index, then display the fact.          */      /*======================================================*/      if (factPtr->factIndex >= start)        {         PrintFactWithIdentifier(theEnv,logicalName,factPtr);         EnvPrintRouter(theEnv,logicalName,(char*)"/n");         count++;         if (max > 0) max--;        }      /*========================================*/      /* Proceed to the next fact to be listed. */      /*========================================*/      if (allModules) factPtr = (struct fact *) EnvGetNextFact(theEnv,factPtr);      else factPtr = (struct fact *) GetNextFactInScope(theEnv,factPtr);     }   /*===================================================*/   /* Print the total of the number of facts displayed. */   /*===================================================*///.........这里部分代码省略.........
开发者ID:DrItanium,项目名称:DROID-CLIPS,代码行数:101,


示例30: FactsCommand

globle void FactsCommand(  void *theEnv)  {   int argumentCount;   long long start = UNSPECIFIED, end = UNSPECIFIED, max = UNSPECIFIED;   struct defmodule *theModule;   DATA_OBJECT theValue;   int argOffset;   /*=========================================================*/   /* Determine the number of arguments to the facts command. */   /*=========================================================*/   if ((argumentCount = EnvArgCountCheck(theEnv,(char*)"facts",NO_MORE_THAN,4)) == -1) return;   /*==================================*/   /* The default module for the facts */   /* command is the current module.   */   /*==================================*/   theModule = ((struct defmodule *) EnvGetCurrentModule(theEnv));   /*==========================================*/   /* If no arguments were specified, then use */   /* the default values to list the facts.    */   /*==========================================*/   if (argumentCount == 0)     {      EnvFacts(theEnv,WDISPLAY,theModule,start,end,max);      return;     }   /*========================================================*/   /* Since there are one or more arguments, see if a module */   /* or start index was specified as the first argument.    */   /*========================================================*/   EnvRtnUnknown(theEnv,1,&theValue);   /*===============================================*/   /* If the first argument is a symbol, then check */   /* to see that a valid module was specified.     */   /*===============================================*/   if (theValue.type == SYMBOL)     {      theModule = (struct defmodule *) EnvFindDefmodule(theEnv,ValueToString(theValue.value));      if ((theModule == NULL) && (strcmp(ValueToString(theValue.value),"*") != 0))        {         SetEvaluationError(theEnv,TRUE);         CantFindItemErrorMessage(theEnv,(char*)"defmodule",ValueToString(theValue.value));         return;        }      if ((start = GetFactsArgument(theEnv,2,argumentCount)) == INVALID) return;      argOffset = 1;     }   /*================================================*/   /* Otherwise if the first argument is an integer, */   /* check to see that a valid index was specified. */   /*================================================*/   else if (theValue.type == INTEGER)     {      start = DOToLong(theValue);      if (start < 0)        {         ExpectedTypeError1(theEnv,(char*)"facts",1,(char*)"symbol or positive number");         SetHaltExecution(theEnv,TRUE);         SetEvaluationError(theEnv,TRUE);         return;        }      argOffset = 0;     }   /*==========================================*/   /* Otherwise the first argument is invalid. */   /*==========================================*/   else     {      ExpectedTypeError1(theEnv,(char*)"facts",1,(char*)"symbol or positive number");      SetHaltExecution(theEnv,TRUE);      SetEvaluationError(theEnv,TRUE);      return;     }   /*==========================*/   /* Get the other arguments. */   /*==========================*/   if ((end = GetFactsArgument(theEnv,2 + argOffset,argumentCount)) == INVALID) return;   if ((max = GetFactsArgument(theEnv,3 + argOffset,argumentCount)) == INVALID) return;   /*=================*/   /* List the facts. */   /*=================*///.........这里部分代码省略.........
开发者ID:DrItanium,项目名称:DROID-CLIPS,代码行数:101,



注:本文中的EnvGetCurrentModule函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ EnvGetNextDefmodule函数代码示例
C++ EnvFalseSymbol函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。