本文整理匯總了C++中EnvSetCurrentModule函數的典型用法代碼示例。如果您正苦於以下問題:C++ EnvSetCurrentModule函數的具體用法?C++ EnvSetCurrentModule怎麽用?C++ EnvSetCurrentModule使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了EnvSetCurrentModule函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: ResetDefinstancesAction
static 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);
}
示例2: BsaveExpressions
static 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); }
}
}
示例3: ValueToString
globle void *CreateDeftemplateScopeMap(
void *theEnv,
struct deftemplate *theDeftemplate)
{
unsigned scopeMapSize;
char *scopeMap;
char *templateName;
struct defmodule *matchModule, *theModule;
int moduleID,count;
void *theBitMap;
templateName = ValueToString(theDeftemplate->header.name);
matchModule = theDeftemplate->header.whichModule->theModule;
scopeMapSize = (sizeof(char) * ((GetNumberOfDefmodules(theEnv) / BITS_PER_BYTE) + 1));
scopeMap = (char *) gm2(theEnv,scopeMapSize);
ClearBitString((void *) scopeMap,scopeMapSize);
SaveCurrentModule(theEnv);
for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL) ;
theModule != NULL ;
theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,(void *) theModule))
{
EnvSetCurrentModule(theEnv,(void *) theModule);
moduleID = (int) theModule->bsaveID;
if (FindImportedConstruct(theEnv,"deftemplate",matchModule,
templateName,&count,TRUE,NULL) != NULL)
SetBitMap(scopeMap,moduleID);
}
RestoreCurrentModule(theEnv);
theBitMap = EnvAddBitMap(theEnv,scopeMap,scopeMapSize);
IncrementBitMapCount(theBitMap);
rm(theEnv,(void *) scopeMap,scopeMapSize);
return(theBitMap);
}
示例4: DefruleRunTimeInitialize
globle 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);
}
示例5: EnvSetIncrementalReset
globle 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);
}
示例6: SetIncrementalResetCommand
globle 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);
}
示例7: BsaveExpressions
static 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);
}
示例8: BsaveFind
static 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++);
}
}
}
示例9: BloadBinaryItem
static 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));
}
示例10: BsaveFind
static 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); }
}
}
示例11: DoForAllModules
globle 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);
}
示例12: BsaveFactPatterns
static 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);
}
示例13: EnvFocus
globle 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;
}
示例14: 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);
}
示例15: FindModuleSeparator
globle 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));
}