本文整理汇总了C++中SetHaltExecution函数的典型用法代码示例。如果您正苦于以下问题:C++ SetHaltExecution函数的具体用法?C++ SetHaltExecution怎么用?C++ SetHaltExecution使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetHaltExecution函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CommandLoop
globle void CommandLoop(
void *theEnv)
{
int inchar;
EnvPrintRouter(theEnv,WPROMPT,CommandLineData(theEnv)->BannerString);
SetHaltExecution(theEnv,FALSE);
SetEvaluationError(theEnv,FALSE);
PeriodicCleanup(theEnv,TRUE,FALSE);
PrintPrompt(theEnv);
RouterData(theEnv)->CommandBufferInputCount = 0;
while (TRUE)
{
/*===================================================*/
/* If a batch file is active, grab the command input */
/* directly from the batch file, otherwise call the */
/* event function. */
/*===================================================*/
if (BatchActive(theEnv) == TRUE)
{
inchar = LLGetcBatch(theEnv,"stdin",TRUE);
if (inchar == EOF)
{ (*CommandLineData(theEnv)->EventFunction)(theEnv); }
else
{ ExpandCommandString(theEnv,(char) inchar); }
}
else
{ (*CommandLineData(theEnv)->EventFunction)(theEnv); }
/*=================================================*/
/* If execution was halted, then remove everything */
/* from the command buffer. */
/*=================================================*/
if (GetHaltExecution(theEnv) == TRUE)
{
SetHaltExecution(theEnv,FALSE);
SetEvaluationError(theEnv,FALSE);
FlushCommandString(theEnv);
#if ! WINDOW_INTERFACE
fflush(stdin);
#endif
EnvPrintRouter(theEnv,WPROMPT,"\n");
PrintPrompt(theEnv);
}
/*=========================================*/
/* If a complete command is in the command */
/* buffer, then execute it. */
/*=========================================*/
ExecuteIfCommandComplete(theEnv);
}
}
示例2: ParseConstruct
globle int ParseConstruct(
void *theEnv,
char *name,
char *logicalName)
{
struct construct *currentPtr;
int rv, ov;
/*=================================*/
/* Look for a valid construct name */
/* (e.g. defrule, deffacts). */
/*=================================*/
currentPtr = FindConstruct(theEnv,name);
if (currentPtr == NULL) return(-1);
/*==================================*/
/* Prepare the parsing environment. */
/*==================================*/
ov = GetHaltExecution(theEnv);
SetEvaluationError(theEnv,FALSE);
SetHaltExecution(theEnv,FALSE);
ClearParsedBindNames(theEnv);
PushRtnBrkContexts(theEnv);
ExpressionData(theEnv)->ReturnContext = FALSE;
ExpressionData(theEnv)->BreakContext = FALSE;
EvaluationData(theEnv)->CurrentEvaluationDepth++;
/*=======================================*/
/* Call the construct's parsing routine. */
/*=======================================*/
ConstructData(theEnv)->ParsingConstruct = TRUE;
rv = (*currentPtr->parseFunction)(theEnv,logicalName);
ConstructData(theEnv)->ParsingConstruct = FALSE;
/*===============================*/
/* Restore environment settings. */
/*===============================*/
EvaluationData(theEnv)->CurrentEvaluationDepth--;
PopRtnBrkContexts(theEnv);
ClearParsedBindNames(theEnv);
SetPPBufferStatus(theEnv,OFF);
SetHaltExecution(theEnv,ov);
/*==============================*/
/* Return the status of parsing */
/* the construct. */
/*==============================*/
return(rv);
}
示例3: NonexistantError
globle char *EnvRtnLexeme(
void *theEnv,
int argumentPosition)
{
int count = 1;
DATA_OBJECT result;
struct expr *argPtr;
/*=====================================================*/
/* Find the appropriate argument in the argument list. */
/*=====================================================*/
for (argPtr = EvaluationData(theEnv)->CurrentExpression->argList;
(argPtr != NULL) && (count < argumentPosition);
argPtr = argPtr->nextArg)
{ count++; }
if (argPtr == NULL)
{
NonexistantError(theEnv,"RtnLexeme",
ValueToString(ExpressionFunctionCallName(EvaluationData(theEnv)->CurrentExpression)),
argumentPosition);
SetHaltExecution(theEnv,TRUE);
SetEvaluationError(theEnv,TRUE);
return(NULL);
}
/*============================================*/
/* Return the value of the nth argument if it */
/* is a symbol, string, or instance name. */
/*============================================*/
EvaluateExpression(theEnv,argPtr,&result);
if ((result.type == SYMBOL) ||
#if OBJECT_SYSTEM
(result.type == INSTANCE_NAME) ||
#endif
(result.type == STRING))
{ return(ValueToString(result.value));}
/*======================================================*/
/* Generate an error if the argument is the wrong type. */
/*======================================================*/
ExpectedTypeError3(theEnv,"RtnLexeme",
ValueToString(ExpressionFunctionCallName(EvaluationData(theEnv)->CurrentExpression)),
argumentPosition,"symbol, string, or instance name");
SetHaltExecution(theEnv,TRUE);
SetEvaluationError(theEnv,TRUE);
return(NULL);
}
示例4: EnvRtnLong
globle long EnvRtnLong(
void *theEnv,
int argumentPosition)
{
int count = 1;
DATA_OBJECT result;
struct expr *argPtr;
/*=====================================================*/
/* Find the appropriate argument in the argument list. */
/*=====================================================*/
for (argPtr = EvaluationData(theEnv)->CurrentExpression->argList;
(argPtr != NULL) && (count < argumentPosition);
argPtr = argPtr->nextArg)
{ count++; }
if (argPtr == NULL)
{
NonexistantError(theEnv,"RtnLong",
ValueToString(ExpressionFunctionCallName(EvaluationData(theEnv)->CurrentExpression)),
argumentPosition);
SetHaltExecution(theEnv,TRUE);
SetEvaluationError(theEnv,TRUE);
return(1L);
}
/*======================================*/
/* Return the value of the nth argument */
/* if it is a float or integer. */
/*======================================*/
EvaluateExpression(theEnv,argPtr,&result);
if (result.type == FLOAT)
{ return((long) ValueToDouble(result.value)); }
else if (result.type == INTEGER)
{ return(ValueToLong(result.value)); }
/*======================================================*/
/* Generate an error if the argument is the wrong type. */
/*======================================================*/
ExpectedTypeError3(theEnv,"RtnLong",
ValueToString(ExpressionFunctionCallName(EvaluationData(theEnv)->CurrentExpression)),
argumentPosition,"number");
SetHaltExecution(theEnv,TRUE);
SetEvaluationError(theEnv,TRUE);
return(1L);
}
示例5: EnvArgRangeCheck
globle int EnvArgRangeCheck(
void *theEnv,
char *functionName,
int min,
int max)
{
int numberOfArguments;
numberOfArguments = EnvRtnArgCount(theEnv);
if ((numberOfArguments < min) || (numberOfArguments > max))
{
PrintErrorID(theEnv,"ARGACCES",1,FALSE);
EnvPrintRouter(theEnv,WERROR,"Function ");
EnvPrintRouter(theEnv,WERROR,functionName);
EnvPrintRouter(theEnv,WERROR," expected at least ");
PrintLongInteger(theEnv,WERROR,(long) min);
EnvPrintRouter(theEnv,WERROR," and no more than ");
PrintLongInteger(theEnv,WERROR,(long) max);
EnvPrintRouter(theEnv,WERROR," arguments.\n");
SetHaltExecution(theEnv,TRUE);
SetEvaluationError(theEnv,TRUE);
return(-1);
}
return(numberOfArguments);
}
示例6: EnvRtnUnknown
globle DATA_OBJECT_PTR EnvRtnUnknown(
void *theEnv,
int argumentPosition,
DATA_OBJECT_PTR returnValue)
{
int count = 1;
struct expr *argPtr;
/*=====================================================*/
/* Find the appropriate argument in the argument list. */
/*=====================================================*/
for (argPtr = EvaluationData(theEnv)->CurrentExpression->argList;
(argPtr != NULL) && (count < argumentPosition);
argPtr = argPtr->nextArg)
{ count++; }
if (argPtr == NULL)
{
NonexistantError(theEnv,"RtnUnknown",
ValueToString(ExpressionFunctionCallName(EvaluationData(theEnv)->CurrentExpression)),
argumentPosition);
SetHaltExecution(theEnv,TRUE);
SetEvaluationError(theEnv,TRUE);
return(NULL);
}
/*=======================================*/
/* Return the value of the nth argument. */
/*=======================================*/
EvaluateExpression(theEnv,argPtr,returnValue);
return(returnValue);
}
示例7: CatchCtrlC
static void _cdecl CatchCtrlC()
{
#if ALLOW_ENVIRONMENT_GLOBALS
SetHaltExecution(GetCurrentEnvironment(),TRUE);
CloseAllBatchSources(GetCurrentEnvironment());
#endif
}
示例8: FunctionCall2
globle int FunctionCall2(
FUNCTION_REFERENCE *theReference,
char *args,
DATA_OBJECT *result)
{
EXPRESSION *argexps;
int error = FALSE;
/*=============================================*/
/* Force periodic cleanup if the function call */
/* was executed from an embedded application. */
/*=============================================*/
if ((CurrentEvaluationDepth == 0) && (! EvaluatingTopLevelCommand) &&
(CurrentExpression == NULL))
{ PeriodicCleanup(TRUE,FALSE); }
/*========================*/
/* Reset the error state. */
/*========================*/
if (CurrentEvaluationDepth == 0) SetHaltExecution(FALSE);
EvaluationError = FALSE;
/*======================================*/
/* Initialize the default return value. */
/*======================================*/
result->type = SYMBOL;
result->value = FalseSymbol;
/*============================*/
/* Parse the argument string. */
/*============================*/
argexps = ParseConstantArguments(args,&error);
if (error == TRUE) return(TRUE);
/*====================*/
/* Call the function. */
/*====================*/
theReference->argList = argexps;
error = EvaluateExpression(theReference,result);
/*========================*/
/* Return the expression. */
/*========================*/
ReturnExpression(argexps);
theReference->argList = NULL;
/*==========================*/
/* Return the error status. */
/*==========================*/
return(error);
}
示例9: CatchCtrlC
static void CatchCtrlC(
int sgnl)
{
#if ALLOW_ENVIRONMENT_GLOBALS
SetHaltExecution(GetCurrentEnvironment(),TRUE);
CloseAllBatchSources(GetCurrentEnvironment());
#endif
signal(SIGINT,CatchCtrlC);
}
示例10: CommandLoopBatchDriver
globle void CommandLoopBatchDriver(
void *theEnv)
{
int inchar;
while (TRUE)
{
if (GetHaltCommandLoopBatch(theEnv) == TRUE)
{
CloseAllBatchSources(theEnv);
SetHaltCommandLoopBatch(theEnv,FALSE);
}
/*===================================================*/
/* If a batch file is active, grab the command input */
/* directly from the batch file, otherwise call the */
/* event function. */
/*===================================================*/
if (BatchActive(theEnv) == TRUE)
{
inchar = LLGetcBatch(theEnv,"stdin",TRUE);
if (inchar == EOF)
{ return; }
else
{ ExpandCommandString(theEnv,(char) inchar); }
}
else
{ return; }
/*=================================================*/
/* If execution was halted, then remove everything */
/* from the command buffer. */
/*=================================================*/
if (GetHaltExecution(theEnv) == TRUE)
{
SetHaltExecution(theEnv,FALSE);
SetEvaluationError(theEnv,FALSE);
FlushCommandString(theEnv);
#if ! WINDOW_INTERFACE
fflush(stdin);
#endif
EnvPrintRouter(theEnv,WPROMPT,"\n");
PrintPrompt(theEnv);
}
/*=========================================*/
/* If a complete command is in the command */
/* buffer, then execute it. */
/*=========================================*/
ExecuteIfCommandComplete(theEnv);
}
}
示例11: CommandLoopBatch
globle void CommandLoopBatch(
void *theEnv)
{
SetHaltExecution(theEnv,FALSE);
SetEvaluationError(theEnv,FALSE);
PeriodicCleanup(theEnv,TRUE,FALSE);
PrintPrompt(theEnv);
RouterData(theEnv)->CommandBufferInputCount = 0;
CommandLoopBatchDriver(theEnv);
}
示例12: DomainErrorMessage
static void DomainErrorMessage(
void *theEnv,
const char *functionName)
{
PrintErrorID(theEnv,"EMATHFUN",1,FALSE);
EnvPrintRouter(theEnv,WERROR,"Domain error for ");
EnvPrintRouter(theEnv,WERROR,functionName);
EnvPrintRouter(theEnv,WERROR," function.\n");
SetHaltExecution(theEnv,TRUE);
SetEvaluationError(theEnv,TRUE);
}
示例13: ArgumentOverflowErrorMessage
static void ArgumentOverflowErrorMessage(
void *theEnv,
const char *functionName)
{
PrintErrorID(theEnv,"EMATHFUN",2,FALSE);
EnvPrintRouter(theEnv,WERROR,"Argument overflow for ");
EnvPrintRouter(theEnv,WERROR,functionName);
EnvPrintRouter(theEnv,WERROR," function.\n");
SetHaltExecution(theEnv,TRUE);
SetEvaluationError(theEnv,TRUE);
}
示例14: SingularityErrorMessage
static void SingularityErrorMessage(
void *theEnv,
const char *functionName)
{
PrintErrorID(theEnv,"EMATHFUN",3,FALSE);
EnvPrintRouter(theEnv,WERROR,"Singularity at asymptote in ");
EnvPrintRouter(theEnv,WERROR,functionName);
EnvPrintRouter(theEnv,WERROR," function.\n");
SetHaltExecution(theEnv,TRUE);
SetEvaluationError(theEnv,TRUE);
}
示例15: PrintDataObject
globle void PrintDataObject(
void *theEnv,
const char *fileid,
DATA_OBJECT_PTR argPtr)
{
switch(argPtr->type)
{
case RVOID:
case SYMBOL:
case STRING:
case INTEGER:
case FLOAT:
case EXTERNAL_ADDRESS:
case DATA_OBJECT_ARRAY: // TBD Remove with AddPrimitive
case FACT_ADDRESS:
#if OBJECT_SYSTEM
case INSTANCE_NAME:
case INSTANCE_ADDRESS:
#endif
PrintAtom(theEnv,fileid,argPtr->type,argPtr->value);
break;
case MULTIFIELD:
PrintMultifield(theEnv,fileid,(struct multifield *) argPtr->value,
argPtr->begin,argPtr->end,TRUE);
break;
default:
if (EvaluationData(theEnv)->PrimitivesArray[argPtr->type] != NULL)
{
if (EvaluationData(theEnv)->PrimitivesArray[argPtr->type]->longPrintFunction)
{
(*EvaluationData(theEnv)->PrimitivesArray[argPtr->type]->longPrintFunction)(theEnv,fileid,argPtr->value);
break;
}
else if (EvaluationData(theEnv)->PrimitivesArray[argPtr->type]->shortPrintFunction)
{
(*EvaluationData(theEnv)->PrimitivesArray[argPtr->type]->shortPrintFunction)(theEnv,fileid,argPtr->value);
break;
}
}
EnvPrintRouter(theEnv,fileid,"<UnknownPrintType");
PrintLongInteger(theEnv,fileid,(long int) argPtr->type);
EnvPrintRouter(theEnv,fileid,">");
SetHaltExecution(theEnv,TRUE);
SetEvaluationError(theEnv,TRUE);
break;
}
}