这篇教程C++ EnvSetCurrentModule函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中EnvSetCurrentModule函数的典型用法代码示例。如果您正苦于以下问题:C++ EnvSetCurrentModule函数的具体用法?C++ EnvSetCurrentModule怎么用?C++ EnvSetCurrentModule使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了EnvSetCurrentModule函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ResetDefinstancesActionstatic void ResetDefinstancesAction( void *theEnv, struct constructHeader *vDefinstances, void *userBuffer) {#if MAC_MCW || WIN_MCW || MAC_XCD#pragma unused(userBuffer)#endif DEFINSTANCES *theDefinstances = (DEFINSTANCES *) vDefinstances; EXPRESSION *theExp; DATA_OBJECT temp; SaveCurrentModule(theEnv); EnvSetCurrentModule(theEnv,(void *) vDefinstances->whichModule->theModule); theDefinstances->busy++; for (theExp = theDefinstances->mkinstance ; theExp != NULL ; theExp = GetNextArgument(theExp)) { EvaluateExpression(theEnv,theExp,&temp); if (EvaluationData(theEnv)->HaltExecution || ((GetType(temp) == SYMBOL) && (GetValue(temp) == EnvFalseSymbol(theEnv)))) { RestoreCurrentModule(theEnv); theDefinstances->busy--; return; } } theDefinstances->busy--; RestoreCurrentModule(theEnv); }
开发者ID:DrItanium,项目名称:DROID-CLIPS,代码行数:32,
示例2: BsaveExpressionsstatic void BsaveExpressions( void *theEnv, FILE *fp) { struct deffacts *theDeffacts; struct defmodule *theModule; /*===========================*/ /* Loop through each module. */ /*===========================*/ for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL); theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,theModule)) { /*======================================================*/ /* Set the current module to the module being examined. */ /*======================================================*/ EnvSetCurrentModule(theEnv,(void *) theModule); /*==================================================*/ /* Loop through each deffacts in the current module */ /* and save the assertion list expression. */ /*==================================================*/ for (theDeffacts = (struct deffacts *) EnvGetNextDeffacts(theEnv,NULL); theDeffacts != NULL; theDeffacts = (struct deffacts *) EnvGetNextDeffacts(theEnv,theDeffacts)) { BsaveExpression(theEnv,theDeffacts->assertList,fp); } } }
开发者ID:DrItanium,项目名称:durandal,代码行数:32,
示例3: ValueToStringgloble 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 = EnvAddBitMap(theEnv,scopeMap,scopeMapSize); IncrementBitMapCount(theBitMap); rm(theEnv,(void *) scopeMap,scopeMapSize); return(theBitMap); }
开发者ID:Anusaaraka,项目名称:anusaaraka,代码行数:35,
示例4: DefruleRunTimeInitializegloble void DefruleRunTimeInitialize( void *theEnv, struct joinLink *rightPrime, struct joinLink *leftPrime) { struct defmodule *theModule; struct defrule *theRule, *theDisjunct; DefruleData(theEnv)->RightPrimeJoins = rightPrime; DefruleData(theEnv)->LeftPrimeJoins = leftPrime; SaveCurrentModule(theEnv); for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL); theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,theModule)) { EnvSetCurrentModule(theEnv,(void *) theModule); for (theRule = EnvGetNextDefrule(theEnv,NULL); theRule != NULL; theRule = EnvGetNextDefrule(theEnv,theRule)) { for (theDisjunct = theRule; theDisjunct != NULL; theDisjunct = theDisjunct->disjunct) { AddBetaMemoriesToRule(theEnv,theDisjunct->lastJoin); } } } RestoreCurrentModule(theEnv); }
开发者ID:DrItanium,项目名称:DROID-CLIPS,代码行数:31,
示例5: EnvSetIncrementalResetgloble intBool EnvSetIncrementalReset( void *theEnv, int value) { int ov; struct defmodule *theModule; SaveCurrentModule(theEnv); for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL); theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,theModule)) { EnvSetCurrentModule(theEnv,(void *) theModule); if (EnvGetNextDefrule(theEnv,NULL) != NULL) { RestoreCurrentModule(theEnv); return(-1); } } RestoreCurrentModule(theEnv); ov = EngineData(theEnv)->IncrementalResetFlag; EngineData(theEnv)->IncrementalResetFlag = value; return(ov); }
开发者ID:Anusaaraka,项目名称:anusaaraka,代码行数:27,
示例6: SetIncrementalResetCommandgloble int SetIncrementalResetCommand( void *theEnv, EXEC_STATUS) { int oldValue; DATA_OBJECT argPtr; struct defmodule *theModule; oldValue = EnvGetIncrementalReset(theEnv,execStatus); /*============================================*/ /* Check for the correct number of arguments. */ /*============================================*/ if (EnvArgCountCheck(theEnv,execStatus,"set-incremental-reset",EXACTLY,1) == -1) { return(oldValue); } /*=========================================*/ /* The incremental reset behavior can't be */ /* changed when rules are loaded. */ /*=========================================*/ SaveCurrentModule(theEnv,execStatus); for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,execStatus,NULL); theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,execStatus,theModule)) { EnvSetCurrentModule(theEnv,execStatus,(void *) theModule); if (EnvGetNextDefrule(theEnv,execStatus,NULL) != NULL) { RestoreCurrentModule(theEnv,execStatus); PrintErrorID(theEnv,execStatus,"INCRRSET",1,FALSE); EnvPrintRouter(theEnv,execStatus,WERROR,"The incremental reset behavior cannot be changed with rules loaded./n"); SetEvaluationError(theEnv,execStatus,TRUE); return(oldValue); } } RestoreCurrentModule(theEnv,execStatus); /*==================================================*/ /* The symbol FALSE disables incremental reset. Any */ /* other value enables incremental reset. */ /*==================================================*/ EnvRtnUnknown(theEnv,execStatus,1,&argPtr); if ((argPtr.value == EnvFalseSymbol(theEnv,execStatus)) && (argPtr.type == SYMBOL)) { EnvSetIncrementalReset(theEnv,execStatus,FALSE); } else { EnvSetIncrementalReset(theEnv,execStatus,TRUE); } /*=======================*/ /* Return the old value. */ /*=======================*/ return(oldValue); }
开发者ID:atrniv,项目名称:CLIPS,代码行数:59,
示例7: BsaveExpressionsstatic void BsaveExpressions( void *theEnv, FILE *fp) { struct defrule *theDefrule, *theDisjunct; struct defmodule *theModule; /*===========================*/ /* Loop through each module. */ /*===========================*/ for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL); theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,theModule)) { /*======================================================*/ /* Set the current module to the module being examined. */ /*======================================================*/ EnvSetCurrentModule(theEnv,(void *) theModule); /*==================================================*/ /* Loop through each defrule in the current module. */ /*==================================================*/ for (theDefrule = (struct defrule *) EnvGetNextDefrule(theEnv,NULL); theDefrule != NULL; theDefrule = (struct defrule *) EnvGetNextDefrule(theEnv,theDefrule)) { /*===========================================*/ /* Save the dynamic salience of the defrule. */ /*===========================================*/ BsaveExpression(theEnv,theDefrule->dynamicSalience,fp); /*===================================*/ /* Loop through each disjunct of the */ /* defrule and save its RHS actions. */ /*===================================*/ for (theDisjunct = theDefrule; theDisjunct != NULL; theDisjunct = theDisjunct->disjunct) { BsaveExpression(theEnv,theDisjunct->actions,fp); } } } /*==============================*/ /* Set the marked flag for each */ /* join in the join network. */ /*==============================*/ MarkRuleNetwork(theEnv,1); }
开发者ID:RobotJustina,项目名称:JUSTINA,代码行数:54,
示例8: BsaveFindstatic void BsaveFind( void *theEnv, EXEC_STATUS) { struct defglobal *defglobalPtr; struct defmodule *theModule; /*=======================================================*/ /* If a binary image is already loaded, then temporarily */ /* save the count values since these will be overwritten */ /* in the process of saving the binary image. */ /*=======================================================*/ SaveBloadCount(theEnv,execStatus,DefglobalBinaryData(theEnv,execStatus)->NumberOfDefglobalModules); SaveBloadCount(theEnv,execStatus,DefglobalBinaryData(theEnv,execStatus)->NumberOfDefglobals); /*============================================*/ /* Set the count of defglobals and defglobals */ /* module data structures to zero. */ /*============================================*/ DefglobalBinaryData(theEnv,execStatus)->NumberOfDefglobals = 0; DefglobalBinaryData(theEnv,execStatus)->NumberOfDefglobalModules = 0; for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,execStatus,NULL); theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,execStatus,theModule)) { /*================================================*/ /* Set the current module to the module being */ /* examined and increment the number of defglobal */ /* modules encountered. */ /*================================================*/ EnvSetCurrentModule(theEnv,execStatus,(void *) theModule); DefglobalBinaryData(theEnv,execStatus)->NumberOfDefglobalModules++; /*====================================================*/ /* Loop through each defglobal in the current module. */ /*====================================================*/ for (defglobalPtr = (struct defglobal *) EnvGetNextDefglobal(theEnv,execStatus,NULL); defglobalPtr != NULL; defglobalPtr = (struct defglobal *) EnvGetNextDefglobal(theEnv,execStatus,defglobalPtr)) { /*======================================================*/ /* Initialize the construct header for the binary save. */ /*======================================================*/ MarkConstructHeaderNeededItems(&defglobalPtr->header,DefglobalBinaryData(theEnv,execStatus)->NumberOfDefglobals++); } } }
开发者ID:atrniv,项目名称:CLIPS,代码行数:53,
示例9: BloadBinaryItemstatic void BloadBinaryItem( void *theEnv) { unsigned long int space; GenReadBinary(theEnv,&space,(unsigned long) sizeof(unsigned long int)); if (DefmoduleData(theEnv)->BNumberOfDefmodules == 0) return; BloadandRefresh(theEnv,DefmoduleData(theEnv)->BNumberOfDefmodules,(unsigned) sizeof(struct bsaveDefmodule),UpdateDefmodule); BloadandRefresh(theEnv,DefmoduleData(theEnv)->NumberOfPortItems,(unsigned) sizeof(struct bsavePortItem),UpdatePortItem); SetListOfDefmodules(theEnv,(void *) DefmoduleData(theEnv)->DefmoduleArray); EnvSetCurrentModule(theEnv,(void *) EnvGetNextDefmodule(theEnv,NULL)); }
开发者ID:femto,项目名称:rbclips,代码行数:14,
示例10: BsaveFindstatic void BsaveFind( void *theEnv, EXEC_STATUS) { struct deftemplate *theDeftemplate; struct defmodule *theModule; /*=======================================================*/ /* If a binary image is already loaded, then temporarily */ /* save the count values since these will be overwritten */ /* in the process of saving the binary image. */ /*=======================================================*/ SaveBloadCount(theEnv,execStatus,FactBinaryData(theEnv,execStatus)->NumberOfPatterns); /*=======================================*/ /* Set the count of fact pattern network */ /* data structures to zero. */ /*=======================================*/ FactBinaryData(theEnv,execStatus)->NumberOfPatterns = 0L; /*===========================*/ /* Loop through each module. */ /*===========================*/ for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,execStatus,NULL); theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,execStatus,theModule)) { /*===============================*/ /* Set the current module to the */ /* module being examined. */ /*===============================*/ EnvSetCurrentModule(theEnv,execStatus,(void *) theModule); /*=====================================================*/ /* Loop through each deftemplate in the current module */ /* and count the number of data structures which must */ /* be saved for its pattern network. */ /*=====================================================*/ for (theDeftemplate = (struct deftemplate *) EnvGetNextDeftemplate(theEnv,execStatus,NULL); theDeftemplate != NULL; theDeftemplate = (struct deftemplate *) EnvGetNextDeftemplate(theEnv,execStatus,theDeftemplate)) { BsaveDriver(theEnv,execStatus,BSAVE_FIND,NULL,theDeftemplate->patternNetwork); } } }
开发者ID:atrniv,项目名称:CLIPS,代码行数:49,
示例11: DoForAllModulesgloble long DoForAllModules( void *theEnv, EXEC_STATUS, void (*actionFunction)(struct defmodule *,void *), int interruptable, void *userBuffer) { void *theModule; long moduleCount = 0L; /*==========================*/ /* Save the current module. */ /*==========================*/ SaveCurrentModule(theEnv,execStatus); /*==================================*/ /* Loop through all of the modules. */ /*==================================*/ for (theModule = EnvGetNextDefmodule(theEnv,execStatus,NULL); theModule != NULL; theModule = EnvGetNextDefmodule(theEnv,execStatus,theModule), moduleCount++) { EnvSetCurrentModule(theEnv,execStatus,(void *) theModule); if ((interruptable) && GetHaltExecution(theEnv,execStatus)) { RestoreCurrentModule(theEnv,execStatus); return(-1L); } (*actionFunction)((struct defmodule *) theModule,userBuffer); } /*=============================*/ /* Restore the current module. */ /*=============================*/ RestoreCurrentModule(theEnv,execStatus); /*=========================================*/ /* Return the number of modules traversed. */ /*=========================================*/ return(moduleCount); }
开发者ID:atrniv,项目名称:CLIPS,代码行数:47,
示例12: BsaveFactPatternsstatic void BsaveFactPatterns( void *theEnv, EXEC_STATUS, FILE *fp) { size_t space; struct deftemplate *theDeftemplate; struct defmodule *theModule; /*========================================*/ /* Write out the amount of space taken up */ /* by the factPatternNode data structures */ /* in the binary image. */ /*========================================*/ space = FactBinaryData(theEnv,execStatus)->NumberOfPatterns * sizeof(struct bsaveFactPatternNode); GenWrite(&space,sizeof(size_t),fp); /*===========================*/ /* Loop through each module. */ /*===========================*/ for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,execStatus,NULL); theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,execStatus,theModule)) { /*=====================================================*/ /* Loop through each deftemplate in the current module */ /* and save its fact pattern network to the file. */ /*=====================================================*/ EnvSetCurrentModule(theEnv,execStatus,(void *) theModule); for (theDeftemplate = (struct deftemplate *) EnvGetNextDeftemplate(theEnv,execStatus,NULL); theDeftemplate != NULL; theDeftemplate = (struct deftemplate *) EnvGetNextDeftemplate(theEnv,execStatus,theDeftemplate)) { BsaveDriver(theEnv,execStatus,BSAVE_PATTERNS,fp,theDeftemplate->patternNetwork); } } /*=============================================================*/ /* If a binary image was already loaded when the bsave command */ /* was issued, then restore the counts indicating the number */ /* of factPatternNode data structures in the binary image */ /* (these were overwritten by the binary save). */ /*=============================================================*/ RestoreBloadCount(theEnv,execStatus,&FactBinaryData(theEnv,execStatus)->NumberOfPatterns); }
开发者ID:atrniv,项目名称:CLIPS,代码行数:47,
示例13: EnvFocusgloble void EnvFocus( void *theEnv, void *vTheModule) { struct defmodule *theModule = (struct defmodule *) vTheModule; struct focus *tempFocus; /*==================================================*/ /* Make the specified module be the current module. */ /* If the specified module is the current focus, */ /* then no further action is needed. */ /*==================================================*/ EnvSetCurrentModule(theEnv,(void *) theModule); if (EngineData(theEnv)->CurrentFocus != NULL) { if (EngineData(theEnv)->CurrentFocus->theModule == theModule) return; } /*=====================================*/ /* If the focus is being watched, then */ /* print an information message. */ /*=====================================*/#if DEBUGGING_FUNCTIONS if (EngineData(theEnv)->WatchFocus) { EnvPrintRouter(theEnv,WTRACE,"==> Focus "); EnvPrintRouter(theEnv,WTRACE,ValueToString(theModule->name)); if (EngineData(theEnv)->CurrentFocus != NULL) { EnvPrintRouter(theEnv,WTRACE," from "); EnvPrintRouter(theEnv,WTRACE,ValueToString(EngineData(theEnv)->CurrentFocus->theModule->name)); } EnvPrintRouter(theEnv,WTRACE,"/n"); }#endif /*=======================================*/ /* Add the new focus to the focus stack. */ /*=======================================*/ tempFocus = get_struct(theEnv,focus); tempFocus->theModule = theModule; tempFocus->theDefruleModule = GetDefruleModuleItem(theEnv,theModule); tempFocus->next = EngineData(theEnv)->CurrentFocus; EngineData(theEnv)->CurrentFocus = tempFocus; EngineData(theEnv)->FocusChanged = TRUE; }
开发者ID:femto,项目名称:rbclips,代码行数:47,
示例14: EnvGetCurrentModulegloble 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,
示例15: FindModuleSeparatorgloble char *ExtractModuleAndConstructName( void *theEnv, EXEC_STATUS, char *theName) { unsigned separatorPosition; SYMBOL_HN *moduleName, *shortName; struct defmodule *theModule; /*========================*/ /* Find the :: separator. */ /*========================*/ separatorPosition = FindModuleSeparator(theName); if (! separatorPosition) return(theName); /*==========================*/ /* Extract the module name. */ /*==========================*/ moduleName = ExtractModuleName(theEnv,execStatus,separatorPosition,theName); if (moduleName == NULL) return(NULL); /*====================================*/ /* Check to see if the module exists. */ /*====================================*/ theModule = (struct defmodule *) EnvFindDefmodule(theEnv,execStatus,ValueToString(moduleName)); if (theModule == NULL) return(NULL); /*============================*/ /* Change the current module. */ /*============================*/ EnvSetCurrentModule(theEnv,execStatus,(void *) theModule); /*=============================*/ /* Extract the construct name. */ /*=============================*/ shortName = ExtractConstructName(theEnv,execStatus,separatorPosition,theName); if (shortName == NULL) return(NULL); return(ValueToString(shortName)); }
开发者ID:atrniv,项目名称:CLIPS,代码行数:44,
示例16: BsaveJoinsstatic void BsaveJoins( void *theEnv, FILE *fp) { struct defrule *rulePtr; struct joinNode *joinPtr; struct defmodule *theModule; /*===========================*/ /* Loop through each module. */ /*===========================*/ for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL); theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,theModule)) { EnvSetCurrentModule(theEnv,(void *) theModule); /*===========================================*/ /* Loop through each rule and its disjuncts. */ /*===========================================*/ rulePtr = (struct defrule *) EnvGetNextDefrule(theEnv,NULL); while (rulePtr != NULL) { /*=========================================*/ /* Loop through each join of the disjunct. */ /*=========================================*/ for (joinPtr = rulePtr->lastJoin; joinPtr != NULL; joinPtr = GetPreviousJoin(joinPtr)) { if (joinPtr->marked) BsaveJoin(theEnv,fp,joinPtr); } /*=======================================*/ /* Move on to the next rule or disjunct. */ /*=======================================*/ if (rulePtr->disjunct != NULL) rulePtr = rulePtr->disjunct; else rulePtr = (struct defrule *) EnvGetNextDefrule(theEnv,rulePtr); } } }
开发者ID:RobotJustina,项目名称:JUSTINA,代码行数:43,
示例17: BeforeObjectPatternsToCode/***************************************************** NAME : BeforeObjectPatternsToCode DESCRIPTION : Marks all object pattern intermediate and alpha memory nodes with a unique integer id prior to the constructs-to-c execution INPUTS : None RETURNS : Nothing useful SIDE EFFECTS : bsaveIDs of nodes set NOTES : None *****************************************************/static void BeforeObjectPatternsToCode( void *theEnv) { long whichPattern; OBJECT_PATTERN_NODE *intermediateNode; OBJECT_ALPHA_NODE *alphaNode; struct defmodule *theModule; DEFCLASS *theDefclass; CLASS_ALPHA_LINK *theLink; whichPattern = 0L; intermediateNode = ObjectNetworkPointer(theEnv); while (intermediateNode != NULL) { intermediateNode->bsaveID = whichPattern++; intermediateNode = GetNextObjectPatternNode(intermediateNode); } whichPattern = 0L; alphaNode = ObjectNetworkTerminalPointer(theEnv); while (alphaNode != NULL) { alphaNode->bsaveID = whichPattern++; alphaNode = alphaNode->nxtTerminal; } whichPattern = 0L; for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL); theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,theModule)) { EnvSetCurrentModule(theEnv,(void *) theModule); for (theDefclass = (DEFCLASS *) EnvGetNextDefclass(theEnv,NULL) ; theDefclass != NULL ; theDefclass = (DEFCLASS *) EnvGetNextDefclass(theEnv,(void *) theDefclass)) { for (theLink = theDefclass->relevant_terminal_alpha_nodes; theLink != NULL; theLink = theLink->next) { theLink->bsaveID = whichPattern++; } } } }
开发者ID:garydriley,项目名称:FuzzyCLIPS631,代码行数:54,
示例18: whilestatic CLASS_ALPHA_LINK *GetNextAlphaLink( void *theEnv, struct defmodule **theModule, DEFCLASS **theClass, CLASS_ALPHA_LINK *theLink) { while (TRUE) { if (theLink != NULL) { theLink = theLink->next; if (theLink != NULL) { return theLink; } } else if (*theClass != NULL) { *theClass = EnvGetNextDefclass(theEnv,*theClass); if (*theClass != NULL) { theLink = (*theClass)->relevant_terminal_alpha_nodes; } if (theLink != NULL) { return theLink; } } else { *theModule = EnvGetNextDefmodule(theEnv,*theModule); if (*theModule == NULL) { return NULL; } EnvSetCurrentModule(theEnv,(void *) *theModule); *theClass = EnvGetNextDefclass(theEnv,*theClass); if (*theClass != NULL) { theLink = (*theClass)->relevant_terminal_alpha_nodes; if (theLink != NULL) { return theLink; } } } } return NULL; }
开发者ID:garydriley,项目名称:FuzzyCLIPS631,代码行数:41,
示例19: EnvSetIncrementalResetgloble intBool EnvSetIncrementalReset( void *theEnv, int value) { int ov; struct defmodule *theModule; /*============================================*/ /* The incremental reset behavior can only be */ /* changed if there are no existing rules. */ /*============================================*/ SaveCurrentModule(theEnv); for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL); theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,theModule)) { EnvSetCurrentModule(theEnv,(void *) theModule); if (EnvGetNextDefrule(theEnv,NULL) != NULL) { RestoreCurrentModule(theEnv); return(-1); } } RestoreCurrentModule(theEnv); /*====================================*/ /* Change the incremental reset flag. */ /*====================================*/ ov = EngineData(theEnv)->IncrementalResetFlag; EngineData(theEnv)->IncrementalResetFlag = value; return(ov); }
开发者ID:Khenji55,项目名称:Computacion_UCLM,代码行数:36,
示例20: ConstructToCodestatic int ConstructToCode( void *theEnv, char *fileName, char *pathName, char *fileNameBuffer, int fileID, FILE *headerFP, int imageID, int maxIndices){ int fileCount = 1; struct defmodule *theModule; struct defglobal *theDefglobal; int moduleCount = 0, moduleArrayCount = 0, moduleArrayVersion = 1; int defglobalArrayCount = 0, defglobalArrayVersion = 1; FILE *moduleFile = NULL, *defglobalFile = NULL; /*================================================*/ /* Include the appropriate defglobal header file. */ /*================================================*/ fprintf(headerFP,"#include /"globldef.h/"/n"); /*===================================================================*/ /* Loop through all the modules and all the defglobals writing their */ /* C code representation to the file as they are traversed. */ /*===================================================================*/ for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL); theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,theModule)) { EnvSetCurrentModule(theEnv,(void *) theModule); moduleFile = OpenFileIfNeeded(theEnv,moduleFile,fileName,pathName,fileNameBuffer,fileID,imageID,&fileCount, moduleArrayVersion,headerFP, "struct defglobalModule",ModulePrefix(DefglobalData(theEnv)->DefglobalCodeItem), FALSE,NULL); if (moduleFile == NULL) { CloseDefglobalFiles(theEnv,moduleFile,defglobalFile,maxIndices); return(0); } DefglobalModuleToCode(theEnv,moduleFile,theModule,imageID,maxIndices,moduleCount); moduleFile = CloseFileIfNeeded(theEnv,moduleFile,&moduleArrayCount,&moduleArrayVersion, maxIndices,NULL,NULL); for (theDefglobal = (struct defglobal *) EnvGetNextDefglobal(theEnv,NULL); theDefglobal != NULL; theDefglobal = (struct defglobal *) EnvGetNextDefglobal(theEnv,theDefglobal)) { defglobalFile = OpenFileIfNeeded(theEnv,defglobalFile,fileName,pathName,fileNameBuffer,fileID,imageID,&fileCount, defglobalArrayVersion,headerFP, "struct defglobal",ConstructPrefix(DefglobalData(theEnv)->DefglobalCodeItem), FALSE,NULL); if (defglobalFile == NULL) { CloseDefglobalFiles(theEnv,moduleFile,defglobalFile,maxIndices); return(0); } DefglobalToCode(theEnv,defglobalFile,theDefglobal,imageID,maxIndices,moduleCount); defglobalArrayCount++; defglobalFile = CloseFileIfNeeded(theEnv,defglobalFile,&defglobalArrayCount, &defglobalArrayVersion,maxIndices,NULL,NULL); } moduleCount++; moduleArrayCount++; } CloseDefglobalFiles(theEnv,moduleFile,defglobalFile,maxIndices); return(1);}
开发者ID:rdegraci,项目名称:CLIPS,代码行数:77,
示例21: FindMultiImportConflictstatic int FindMultiImportConflict( void *theEnv, struct defmodule *theModule) { struct defmodule *testModule; int count; struct portConstructItem *thePCItem; struct construct *theConstruct; void *theCItem; /*==========================*/ /* Save the current module. */ /*==========================*/ SaveCurrentModule(theEnv); /*============================*/ /* Loop through every module. */ /*============================*/ for (testModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL); testModule != NULL; testModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,testModule)) { /*========================================*/ /* Loop through every construct type that */ /* can be imported/exported by a module. */ /*========================================*/ for (thePCItem = DefmoduleData(theEnv)->ListOfPortConstructItems; thePCItem != NULL; thePCItem = thePCItem->next) { EnvSetCurrentModule(theEnv,(void *) testModule); /*=====================================================*/ /* Loop through every construct of the specified type. */ /*=====================================================*/ theConstruct = FindConstruct(theEnv,thePCItem->constructName); for (theCItem = (*theConstruct->getNextItemFunction)(theEnv,NULL); theCItem != NULL; theCItem = (*theConstruct->getNextItemFunction)(theEnv,theCItem)) { /*===============================================*/ /* Check to see if the specific construct in the */ /* module can be imported with more than one */ /* reference into the module we're examining for */ /* ambiguous import specifications. */ /*===============================================*/ EnvSetCurrentModule(theEnv,(void *) theModule); FindImportedConstruct(theEnv,thePCItem->constructName,NULL, ValueToString((*theConstruct->getConstructNameFunction) ((struct constructHeader *) theCItem)), &count,FALSE,NULL); if (count > 1) { ImportExportConflictMessage(theEnv,"defmodule",EnvGetDefmoduleName(theEnv,theModule), thePCItem->constructName, ValueToString((*theConstruct->getConstructNameFunction) ((struct constructHeader *) theCItem))); RestoreCurrentModule(theEnv); return(TRUE); } EnvSetCurrentModule(theEnv,(void *) testModule); } } } /*=============================*/ /* Restore the current module. */ /*=============================*/ RestoreCurrentModule(theEnv); /*=======================================*/ /* Return FALSE to indicate no ambiguous */ /* references were found. */ /*=======================================*/ return(FALSE); }
开发者ID:RobotJustina,项目名称:JUSTINA,代码行数:85,
示例22: ParseImportSpec//.........这里部分代码省略......... /*========================================================*/ /* If the ?NONE keyword was used with the import spec, */ /* then no constructs were actually imported and the */ /* import spec does not need to be checked for conflicts. */ /*========================================================*/ if (newModule->importList == oldImportSpec) return(FALSE); /*======================================================*/ /* Check to see if the construct being imported can be */ /* by the specified module. This check exported doesn't */ /* guarantee that a specific named construct actually */ /* exists. It just checks that it could be exported if */ /* it does exists. */ /*======================================================*/ if (newModule->importList->constructType != NULL) { /*=============================*/ /* Look for the construct in */ /* the module that exports it. */ /*=============================*/ found = FALSE; for (thePort = theModule->exportList; (thePort != NULL) && (! found); thePort = thePort->next) { if (thePort->constructType == NULL) found = TRUE; else if (thePort->constructType == newModule->importList->constructType) { if (newModule->importList->constructName == NULL) found = TRUE; else if (thePort->constructName == NULL) found = TRUE; else if (thePort->constructName == newModule->importList->constructName) { found = TRUE; } } } /*=======================================*/ /* If it's not exported by the specified */ /* module, print an error message. */ /*=======================================*/ if (! found) { if (newModule->importList->constructName == NULL) { NotExportedErrorMessage(theEnv,EnvGetDefmoduleName(theEnv,theModule), ValueToString(newModule->importList->constructType), NULL); } else { NotExportedErrorMessage(theEnv,EnvGetDefmoduleName(theEnv,theModule), ValueToString(newModule->importList->constructType), ValueToString(newModule->importList->constructName)); } return(TRUE); } } /*======================================================*/ /* Verify that specific named constructs actually exist */ /* and can be seen from the module importing them. */ /*======================================================*/ SaveCurrentModule(theEnv); EnvSetCurrentModule(theEnv,(void *) newModule); for (thePort = newModule->importList; thePort != NULL; thePort = thePort->next) { if ((thePort->constructType == NULL) || (thePort->constructName == NULL)) { continue; } theModule = (struct defmodule *) EnvFindDefmodule(theEnv,ValueToString(thePort->moduleName)); EnvSetCurrentModule(theEnv,theModule); if (FindImportedConstruct(theEnv,ValueToString(thePort->constructType),NULL, ValueToString(thePort->constructName),&count, TRUE,FALSE) == NULL) { NotExportedErrorMessage(theEnv,EnvGetDefmoduleName(theEnv,theModule), ValueToString(thePort->constructType), ValueToString(thePort->constructName)); RestoreCurrentModule(theEnv); return(TRUE); } } RestoreCurrentModule(theEnv); /*===============================================*/ /* The import list has been successfully parsed. */ /*===============================================*/ return(FALSE); }
开发者ID:RobotJustina,项目名称:JUSTINA,代码行数:101,
示例23: ParseDefmodule//.........这里部分代码省略......... if (parseError) return(TRUE); return(FALSE); } /*===============================================*/ /* Increment the symbol table counts for symbols */ /* used in the defmodule data structures. */ /*===============================================*/ if (redefiningMainModule == NULL) { IncrementSymbolCount(newDefmodule->name); } else { if ((newDefmodule->importList != NULL) || (newDefmodule->exportList != NULL)) { DefmoduleData(theEnv)->MainModuleRedefinable = FALSE; } } for (portSpecs = newDefmodule->importList; portSpecs != NULL; portSpecs = portSpecs->next) { if (portSpecs->moduleName != NULL) IncrementSymbolCount(portSpecs->moduleName); if (portSpecs->constructType != NULL) IncrementSymbolCount(portSpecs->constructType); if (portSpecs->constructName != NULL) IncrementSymbolCount(portSpecs->constructName); } for (portSpecs = newDefmodule->exportList; portSpecs != NULL; portSpecs = portSpecs->next) { if (portSpecs->moduleName != NULL) IncrementSymbolCount(portSpecs->moduleName); if (portSpecs->constructType != NULL) IncrementSymbolCount(portSpecs->constructType); if (portSpecs->constructName != NULL) IncrementSymbolCount(portSpecs->constructName); } /*====================================================*/ /* Allocate storage for the module's construct lists. */ /*====================================================*/ if (redefiningMainModule != NULL) { /* Do nothing */ } else if (DefmoduleData(theEnv)->NumberOfModuleItems == 0) newDefmodule->itemsArray = NULL; else { newDefmodule->itemsArray = (struct defmoduleItemHeader **) gm2(theEnv,sizeof(void *) * DefmoduleData(theEnv)->NumberOfModuleItems); for (i = 0, theItem = DefmoduleData(theEnv)->ListOfModuleItems; (i < DefmoduleData(theEnv)->NumberOfModuleItems) && (theItem != NULL); i++, theItem = theItem->next) { if (theItem->allocateFunction == NULL) { newDefmodule->itemsArray[i] = NULL; } else { newDefmodule->itemsArray[i] = (struct defmoduleItemHeader *) (*theItem->allocateFunction)(theEnv); theHeader = (struct defmoduleItemHeader *) newDefmodule->itemsArray[i]; theHeader->theModule = newDefmodule; theHeader->firstItem = NULL; theHeader->lastItem = NULL; } } } /*=======================================*/ /* Save the pretty print representation. */ /*=======================================*/ SavePPBuffer(theEnv,"/n"); if (EnvGetConserveMemory(theEnv) == TRUE) { newDefmodule->ppForm = NULL; } else { newDefmodule->ppForm = CopyPPBuffer(theEnv); } /*==============================================*/ /* Add the defmodule to the list of defmodules. */ /*==============================================*/ if (redefiningMainModule == NULL) { if (DefmoduleData(theEnv)->LastDefmodule == NULL) DefmoduleData(theEnv)->ListOfDefmodules = newDefmodule; else DefmoduleData(theEnv)->LastDefmodule->next = newDefmodule; DefmoduleData(theEnv)->LastDefmodule = newDefmodule; newDefmodule->bsaveID = DefmoduleData(theEnv)->NumberOfDefmodules++; } EnvSetCurrentModule(theEnv,(void *) newDefmodule); /*=========================================*/ /* Call any functions required by other */ /* constructs when a new module is defined */ /*=========================================*/ for (defineFunctions = DefmoduleData(theEnv)->AfterModuleDefinedFunctions; defineFunctions != NULL; defineFunctions = defineFunctions->next) { (* (void (*)(void *)) defineFunctions->func)(theEnv); } /*===============================================*/ /* Defmodule successfully parsed with no errors. */ /*===============================================*/ return(FALSE); }
开发者ID:RobotJustina,项目名称:JUSTINA,代码行数:101,
示例24: FindImportExportConflictgloble int FindImportExportConflict( void *theEnv, char *constructName, struct defmodule *matchModule, char *findName) { struct defmodule *theModule; struct moduleItem *theModuleItem; int count; /*===========================================================*/ /* If the construct type can't be imported or exported, then */ /* it's not possible to have an import/export conflict. */ /*===========================================================*/ if (ValidPortConstructItem(theEnv,constructName) == NULL) return(FALSE); /*============================================*/ /* There module name should already have been */ /* separated fromthe construct's name. */ /*============================================*/ if (FindModuleSeparator(findName)) return(FALSE); /*===============================================================*/ /* The construct must be capable of being stored within a module */ /* (this test should never fail). The construct must also have */ /* a find function associated with it so we can actually look */ /* for import/export conflicts. */ /*===============================================================*/ if ((theModuleItem = FindModuleItem(theEnv,constructName)) == NULL) return(FALSE); if (theModuleItem->findFunction == NULL) return(FALSE); /*==========================*/ /* Save the current module. */ /*==========================*/ SaveCurrentModule(theEnv); /*================================================================*/ /* Look at each module and count each definition of the specified */ /* construct which is visible to the module. If more than one */ /* definition is visible, then an import/export conflict exists */ /* and TRUE is returned. */ /*================================================================*/ for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL); theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,theModule)) { EnvSetCurrentModule(theEnv,(void *) theModule); FindImportedConstruct(theEnv,constructName,NULL,findName,&count,TRUE,matchModule); if (count > 1) { RestoreCurrentModule(theEnv); return(TRUE); } } /*==========================================*/ /* Restore the current module. No conflicts */ /* were detected so FALSE is returned. */ /*==========================================*/ RestoreCurrentModule(theEnv); return(FALSE); }
开发者ID:RobotJustina,项目名称:JUSTINA,代码行数:70,
示例25: EnvRefreshAgendagloble void EnvRefreshAgenda( void *theEnv, void *vTheModule){ struct activation *theActivation; struct defmodule *theModule = (struct defmodule *) vTheModule; intBool oldValue; int allModules = FALSE; /*==========================*/ /* Save the current module. */ /*==========================*/ SaveCurrentModule(theEnv); /*=============================================*/ /* If the module specified is a NULL pointer, */ /* then every module has its agenda refreshed. */ /*=============================================*/ if (theModule == NULL) { allModules = TRUE; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL); } /*=======================================================*/ /* Remember the current setting for salience evaluation. */ /* To perform the refresh, the when activated setting is */ /* used to recompute the salience values. */ /*=======================================================*/ oldValue = EnvGetSalienceEvaluation(theEnv); EnvSetSalienceEvaluation(theEnv,WHEN_ACTIVATED); /*========================*/ /* Refresh the agenda(s). */ /*========================*/ for (; theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,theModule)) { /*=========================================*/ /* Change the current module to the module */ /* of the agenda being refreshed. */ /*=========================================*/ EnvSetCurrentModule(theEnv,(void *) theModule); /*================================================================*/ /* Recompute the salience values for the current module's agenda. */ /*================================================================*/ for (theActivation = (struct activation *) EnvGetNextActivation(theEnv,NULL); theActivation != NULL; theActivation = (struct activation *) EnvGetNextActivation(theEnv,theActivation)) { theActivation->salience = EvaluateSalience(theEnv,theActivation->theRule); } /*======================================================*/ /* Reorder the agenda based on the new salience values. */ /*======================================================*/ EnvReorderAgenda(theEnv,theModule); /*===============================================*/ /* Return if only one agenda is being refreshed. */ /*===============================================*/ if (! allModules) { EnvSetSalienceEvaluation(theEnv,oldValue); RestoreCurrentModule(theEnv); return; } } /*==========================================*/ /* Restore the salience evaluation setting. */ /*==========================================*/ EnvSetSalienceEvaluation(theEnv,oldValue); /*=============================*/ /* Restore the current module. */ /*=============================*/ RestoreCurrentModule(theEnv);}
开发者ID:DrItanium,项目名称:AdventureEngine,代码行数:91,
示例26: DefinstancesToCode/******************************************************* NAME : DefinstancesToCode DESCRIPTION : Writes out static array code for definstances INPUTS : 1) The base name of the construct set 2) The base id for this construct 3) The file pointer for the header file 4) The base id for the construct set 5) The max number of indices allowed in an array RETURNS : -1 if no definstances, 0 on errors, 1 if definstances written SIDE EFFECTS : Code written to files NOTES : None *******************************************************/static int DefinstancesToCode( void *theEnv, char *fileName, char *pathName, char *fileNameBuffer, int fileID, FILE *headerFP, int imageID, int maxIndices) { int fileCount = 1; struct defmodule *theModule; DEFINSTANCES *theDefinstances; int moduleCount = 0, moduleArrayCount = 0, moduleArrayVersion = 1; int definstancesArrayCount = 0, definstancesArrayVersion = 1; FILE *moduleFile = NULL, *definstancesFile = NULL; /* ================================================ Include the appropriate definstances header file ================================================ */ fprintf(headerFP,"#include /"defins.h/"/n"); /* ============================================================= Loop through all the modules and all the definstances writing their C code representation to the file as they are traversed ============================================================= */ theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL); while (theModule != NULL) { EnvSetCurrentModule(theEnv,(void *) theModule); moduleFile = OpenFileIfNeeded(theEnv,moduleFile,fileName,pathName,fileNameBuffer,fileID,imageID,&fileCount, moduleArrayVersion,headerFP, (char*)"DEFINSTANCES_MODULE",ModulePrefix(DefinstancesData(theEnv)->DefinstancesCodeItem), FALSE,NULL); if (moduleFile == NULL) { CloseDefinstancesFiles(theEnv,moduleFile,definstancesFile,maxIndices); return(0); } DefinstancesModuleToCode(theEnv,moduleFile,theModule,imageID,maxIndices); moduleFile = CloseFileIfNeeded(theEnv,moduleFile,&moduleArrayCount,&moduleArrayVersion, maxIndices,NULL,NULL); theDefinstances = (DEFINSTANCES *) EnvGetNextDefinstances(theEnv,NULL); while (theDefinstances != NULL) { definstancesFile = OpenFileIfNeeded(theEnv,definstancesFile,fileName,pathName,fileNameBuffer,fileID,imageID,&fileCount, definstancesArrayVersion,headerFP, (char*)"DEFINSTANCES",ConstructPrefix(DefinstancesData(theEnv)->DefinstancesCodeItem), FALSE,NULL); if (definstancesFile == NULL) { CloseDefinstancesFiles(theEnv,moduleFile,definstancesFile,maxIndices); return(0); } SingleDefinstancesToCode(theEnv,definstancesFile,theDefinstances,imageID, maxIndices,moduleCount); definstancesArrayCount++; definstancesFile = CloseFileIfNeeded(theEnv,definstancesFile,&definstancesArrayCount, &definstancesArrayVersion,maxIndices,NULL,NULL); theDefinstances = (DEFINSTANCES *) EnvGetNextDefinstances(theEnv,theDefinstances); } theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,theModule); moduleCount++; moduleArrayCount++; } CloseDefinstancesFiles(theEnv,moduleFile,definstancesFile,maxIndices); return(1); }
开发者ID:DrItanium,项目名称:AdventureEngine,代码行数:94,
示例27: EnvResetgloble void EnvReset( void *theEnv) { struct callFunctionItem *resetPtr; /*=====================================*/ /* The reset command can't be executed */ /* while a reset is in progress. */ /*=====================================*/ if (ConstructData(theEnv)->ResetInProgress) return; ConstructData(theEnv)->ResetInProgress = TRUE; ConstructData(theEnv)->ResetReadyInProgress = TRUE; /*================================================*/ /* If the reset is performed from the top level */ /* command prompt, reset the halt execution flag. */ /*================================================*/ if (UtilityData(theEnv)->CurrentGarbageFrame->topLevel) SetHaltExecution(theEnv,FALSE); /*=======================================================*/ /* Call the before reset function to determine if the */ /* reset should continue. [Used by the some of the */ /* windowed interfaces to query the user whether a */ /* reset should proceed with activations on the agenda.] */ /*=======================================================*/ if ((ConstructData(theEnv)->BeforeResetFunction != NULL) ? ((*ConstructData(theEnv)->BeforeResetFunction)(theEnv) == FALSE) : FALSE) { ConstructData(theEnv)->ResetReadyInProgress = FALSE; ConstructData(theEnv)->ResetInProgress = FALSE; return; } ConstructData(theEnv)->ResetReadyInProgress = FALSE; /*===========================*/ /* Call each reset function. */ /*===========================*/ for (resetPtr = ConstructData(theEnv)->ListOfResetFunctions; (resetPtr != NULL) && (GetHaltExecution(theEnv) == FALSE); resetPtr = resetPtr->next) { if (resetPtr->environmentAware) { (*resetPtr->func)(theEnv); } else { (* (void (*)(void)) resetPtr->func)(); } } /*============================================*/ /* Set the current module to the MAIN module. */ /*============================================*/ EnvSetCurrentModule(theEnv,(void *) EnvFindDefmodule(theEnv,"MAIN")); /*===========================================*/ /* Perform periodic cleanup if the reset was */ /* issued from an embedded controller. */ /*===========================================*/ if ((UtilityData(theEnv)->CurrentGarbageFrame->topLevel) && (! CommandLineData(theEnv)->EvaluatingTopLevelCommand) && (EvaluationData(theEnv)->CurrentExpression == NULL) && (UtilityData(theEnv)->GarbageCollectionLocks == 0)) { CleanCurrentGarbageFrame(theEnv,NULL); CallPeriodicTasks(theEnv); } /*===================================*/ /* A reset is no longer in progress. */ /*===================================*/ ConstructData(theEnv)->ResetInProgress = FALSE; }
开发者ID:Khenji55,项目名称:Computacion_UCLM,代码行数:77,
示例28: ReturnDefmodulestatic void ReturnDefmodule( void *theEnv, struct defmodule *theDefmodule, intBool environmentClear) { int i; struct moduleItem *theItem; struct portItem *theSpec, *nextSpec; /*=====================================================*/ /* Set the current module to the module being deleted. */ /*=====================================================*/ if (theDefmodule == NULL) return; if (! environmentClear) { EnvSetCurrentModule(theEnv,(void *) theDefmodule); } /*============================================*/ /* Call the free functions for the constructs */ /* belonging to this module. */ /*============================================*/ if (theDefmodule->itemsArray != NULL) { if (! environmentClear) { for (i = 0, theItem = DefmoduleData(theEnv)->ListOfModuleItems; (i < DefmoduleData(theEnv)->NumberOfModuleItems) && (theItem != NULL); i++, theItem = theItem->next) { if (theItem->freeFunction != NULL) { (*theItem->freeFunction)(theEnv,theDefmodule->itemsArray[i]); } } } rm(theEnv,theDefmodule->itemsArray,sizeof(void *) * DefmoduleData(theEnv)->NumberOfModuleItems); } /*======================================================*/ /* Decrement the symbol count for the defmodule's name. */ /*======================================================*/ if (! environmentClear) { DecrementSymbolCount(theEnv,theDefmodule->name); } /*====================================*/ /* Free the items in the import list. */ /*====================================*/ theSpec = theDefmodule->importList; while (theSpec != NULL) { nextSpec = theSpec->next; if (! environmentClear) { if (theSpec->moduleName != NULL) DecrementSymbolCount(theEnv,theSpec->moduleName); if (theSpec->constructType != NULL) DecrementSymbolCount(theEnv,theSpec->constructType); if (theSpec->constructName != NULL) DecrementSymbolCount(theEnv,theSpec->constructName); } rtn_struct(theEnv,portItem,theSpec); theSpec = nextSpec; } /*====================================*/ /* Free the items in the export list. */ /*====================================*/ theSpec = theDefmodule->exportList; while (theSpec != NULL) { nextSpec = theSpec->next; if (! environmentClear) { if (theSpec->moduleName != NULL) DecrementSymbolCount(theEnv,theSpec->moduleName); if (theSpec->constructType != NULL) DecrementSymbolCount(theEnv,theSpec->constructType); if (theSpec->constructName != NULL) DecrementSymbolCount(theEnv,theSpec->constructName); } rtn_struct(theEnv,portItem,theSpec); theSpec = nextSpec; } /*=========================================*/ /* Free the defmodule pretty print string. */ /*=========================================*/ if (theDefmodule->ppForm != NULL) { rm(theEnv,theDefmodule->ppForm, (int) sizeof(char) * (strlen(theDefmodule->ppForm) + 1)); } /*=======================*/ /* Return the user data. */ /*=======================*/ ClearUserDataList(theEnv,theDefmodule->usrData); /*======================================*/ /* Return the defmodule data structure. *///.........这里部分代码省略.........
开发者ID:bigsmiles,项目名称:eventCLIPS,代码行数:101,
示例29: CreateMainModulegloble void CreateMainModule( void *theEnv) { struct defmodule *newDefmodule; struct moduleItem *theItem; int i; struct defmoduleItemHeader *theHeader; /*=======================================*/ /* Allocate the defmodule data structure */ /* and name it the MAIN module. */ /*=======================================*/ newDefmodule = get_struct(theEnv,defmodule); newDefmodule->name = (SYMBOL_HN *) EnvAddSymbol(theEnv,"MAIN"); IncrementSymbolCount(newDefmodule->name); newDefmodule->next = NULL; newDefmodule->ppForm = NULL; newDefmodule->importList = NULL; newDefmodule->exportList = NULL; newDefmodule->bsaveID = 0L; newDefmodule->usrData = NULL; /*==================================*/ /* Initialize the array for storing */ /* the module's construct lists. */ /*==================================*/ if (DefmoduleData(theEnv)->NumberOfModuleItems == 0) newDefmodule->itemsArray = NULL; else { newDefmodule->itemsArray = (struct defmoduleItemHeader **) gm2(theEnv,sizeof(void *) * DefmoduleData(theEnv)->NumberOfModuleItems); for (i = 0, theItem = DefmoduleData(theEnv)->ListOfModuleItems; (i < DefmoduleData(theEnv)->NumberOfModuleItems) && (theItem != NULL); i++, theItem = theItem->next) { if (theItem->allocateFunction == NULL) { newDefmodule->itemsArray[i] = NULL; } else { newDefmodule->itemsArray[i] = (struct defmoduleItemHeader *) (*theItem->allocateFunction)(theEnv); theHeader = (struct defmoduleItemHeader *) newDefmodule->itemsArray[i]; theHeader->theModule = newDefmodule; theHeader->firstItem = NULL; theHeader->lastItem = NULL; } } } /*=======================================*/ /* Add the module to the list of modules */ /* and make it the current module. */ /*=======================================*/#if (! BLOAD_ONLY) && (! RUN_TIME) && DEFMODULE_CONSTRUCT SetNumberOfDefmodules(theEnv,1L);#endif DefmoduleData(theEnv)->LastDefmodule = newDefmodule; DefmoduleData(theEnv)->ListOfDefmodules = newDefmodule; EnvSetCurrentModule(theEnv,(void *) newDefmodule); }
开发者ID:bigsmiles,项目名称:eventCLIPS,代码行数:64,
示例30: ConstructToCodestatic int ConstructToCode( void *theEnv, char *fileName, char *pathName, char *fileNameBuffer, int fileID, FILE *headerFP, int imageID, int maxIndices) { int fileCount = 1; struct defmodule *theModule; struct defrule *theDefrule; int joinArrayCount = 0, joinArrayVersion = 1; int linkArrayCount = 0, linkArrayVersion = 1; int moduleCount = 0, moduleArrayCount = 0, moduleArrayVersion = 1; int defruleArrayCount = 0, defruleArrayVersion = 1; FILE *joinFile = NULL, *moduleFile = NULL, *defruleFile = NULL, *linkFile = NULL; /*==============================================*/ /* Include the appropriate defrule header file. */ /*==============================================*/ fprintf(headerFP,"#include /"ruledef.h/"/n"); /*======================================*/ /* Save the left and right prime links. */ /*======================================*/ if (! TraverseJoinLinks(theEnv,DefruleData(theEnv)->LeftPrimeJoins,fileName,pathName,fileNameBuffer,fileID,headerFP,imageID, maxIndices,&linkFile,&fileCount,&linkArrayVersion,&linkArrayCount)) { CloseDefruleFiles(theEnv,moduleFile,defruleFile,joinFile,linkFile,maxIndices); return(0); } if (! TraverseJoinLinks(theEnv,DefruleData(theEnv)->RightPrimeJoins,fileName,pathName,fileNameBuffer,fileID,headerFP,imageID, maxIndices,&linkFile,&fileCount,&linkArrayVersion,&linkArrayCount)) { CloseDefruleFiles(theEnv,moduleFile,defruleFile,joinFile,linkFile,maxIndices); return(0); } /*=========================================================*/ /* Loop through all the modules, all the defrules, and all */ /* the join nodes writing their C code representation to */ /* the file as they are traversed. */ /*=========================================================*/ for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL); theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,theModule)) { /*=========================*/ /* Set the current module. */ /*=========================*/ EnvSetCurrentModule(theEnv,(void *) theModule); /*==========================*/ /* Save the defrule module. */ /*==========================*/ moduleFile = OpenFileIfNeeded(theEnv,moduleFile,fileName,pathName,fileNameBuffer,fileID,imageID,&fileCount, moduleArrayVersion,headerFP, (char*)"struct defruleModule",ModulePrefix(DefruleData(theEnv)->DefruleCodeItem), FALSE,NULL); if (moduleFile == NULL) { CloseDefruleFiles(theEnv,moduleFile,defruleFile,joinFile,linkFile,maxIndices); return(0); } DefruleModuleToCode(theEnv,moduleFile,theModule,imageID,maxIndices,moduleCount); moduleFile = CloseFileIfNeeded(theEnv,moduleFile,&moduleArrayCount,&moduleArrayVersion, maxIndices,NULL,NULL); /*=========================================*/ /* Loop through all of the defrules (and */ /* their disjuncts) in the current module. */ /*=========================================*/ theDefrule = (struct defrule *) EnvGetNextDefrule(theEnv,NULL); while (theDefrule != NULL) { /*===================================*/ /* Save the defrule data structures. */ /*===================================*/ defruleFile = OpenFileIfNeeded(theEnv,defruleFile,fileName,pathName,fileNameBuffer,fileID,imageID,&fileCount, defruleArrayVersion,headerFP, (char*)"struct defrule",ConstructPrefix(DefruleData(theEnv)->DefruleCodeItem), FALSE,NULL); if (defruleFile == NULL) { CloseDefruleFiles(theEnv,moduleFile,defruleFile,joinFile,linkFile,maxIndices); return(0); }//.........这里部分代码省略.........
开发者ID:DrItanium,项目名称:DROID-CLIPS,代码行数:101,
注:本文中的EnvSetCurrentModule函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ Eof函数代码示例 C++ EnvRtnUnknown函数代码示例 |