本文整理匯總了C++中EnvGetCurrentModule函數的典型用法代碼示例。如果您正苦於以下問題:C++ EnvGetCurrentModule函數的具體用法?C++ EnvGetCurrentModule怎麽用?C++ EnvGetCurrentModule使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了EnvGetCurrentModule函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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));
}
示例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)));
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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");
}