📄 erapprtf.cpp
字号:
/* GLOBALS: */
/* variable type expected description */
/* -------- ---- -------- ----------- */
/* None */
/*\p*******************************************************************/
VOID_RTN ERAerrorLog
( CHAR *pasLocationPtr, // Function where error occurred
CHAR *pasFormatStr, // 'printf' format string
... ) // macro that defines va_alist
{ /* ERAerrorLog procedure */
/**********************************************************************/
/* LOCAL CONSTANT DECLARATIONS */
/**********************************************************************/
/**********************************************************************/
/* LOCAL VARIABLE DECLARATIONS */
/**********************************************************************/
va_list erlArgs;
CHAR erlMsg[257];
/**********************************************************************/
/* Procedure Body */
/**********************************************************************/
va_start (erlArgs, pasFormatStr);
vsprintf(erlMsg,pasFormatStr,erlArgs);
va_end (erlArgs);
if (ermUserFile != NULL)
{
fprintf(ermUserFile, "LOG %s:%s\n",pasLocationPtr,erlMsg);
fflush(ermUserFile);
}
if (ermShowAllErrors)
{
printf( "LOG:%s:%s\n", pasLocationPtr, erlMsg );
}
} /* ERAerrorLog end */
VOID_RTN ERAparameterError
( CHAR *pasLocationPtr ) // Function where error occurred
{
ERAerrorLog( pasLocationPtr, "Invalid Parameter" );
}
/*\p*******************************************************************/
/* */
/* NAME: ERAerrorReport */
/* */
/* PURPOSE: Allow routines to log or display and error message. */
/* This procedure transmits an IPC to the error handler process. */
/* Several commands are aavailable. See errorC.inc for constants */
/* used to specify the command paimeter. See "Mini-QUIC Error */
/* Reporter and Logger" document for a description of the various */
/* commands */
/* */
/* INPUTS: */
/* variable type expected description */
/* -------- ---- -------- ----------- */
/* pasCommand ERP_CMD_TY constant from errorC.inc */
/* pasLocationPtr ERP_LOC_TY * string where error occurred*/
/* pasErrorTextPtr ERP_TEXT_TY * string error Text */
/* */
/* OUTPUTS: */
/* variable type expected description */
/* -------- ---- -------- ----------- */
/* None */
/* GLOBALS: */
/* variable type expected description */
/* -------- ---- -------- ----------- */
/* None */
/*\p*******************************************************************/
VOID_RTN ERAerrorReport
( ERP_CMD_TY pasCommand,
CHAR *pasLocationPtr,
CHAR *pasFormatStr,
... ) /* macro that defines va_alist */
{ /* ERAerrorReport procedure */
/**********************************************************************/
/* LOCAL CONSTANT DECLARATIONS */
/**********************************************************************/
/**********************************************************************/
/* LOCAL VARIABLE DECLARATIONS */
/**********************************************************************/
CHAR erlReport[512];
int erlCmd;
va_list erlArgs;
CHAR erlMsg[257];
CHAR erlWarn[40];
/**********************************************************************/
/* Procedure Body */
/**********************************************************************/
va_start (erlArgs, pasFormatStr);
vsprintf(erlMsg,pasFormatStr,erlArgs);
va_end (erlArgs);
sprintf(erlReport, "REPORT %s:%s\n",pasLocationPtr,erlMsg);
if (ermUserFile != NULL)
{
fflush(ermUserFile);
}
switch( pasCommand )
{
case ER_WARNING:
strcpy(erlWarn, "WARNING");
break;
case ER_REPORT:
strcpy(erlWarn, "INFORMATION");
break;
case ER_ABORT:
strcpy(erlWarn, "ABORT!");
break;
case ER_FATAL:
strcpy(erlWarn, "FATAL ERROR!!");
break;
default:
strcpy(erlWarn, "UNDEFINED");
break;
}
printf( "%s:%s", erlWarn, erlReport );
if (ermUserFile != NULL)
{
fprintf(ermUserFile, "%s:%s\n", erlWarn, erlReport );
fflush (ermUserFile);
}
}
/*\p*******************************************************************/
/* */
/* NAME: ERAerrorTerm */
/* */
/* PURPOSE: to terminate use of the error handler. */
/* */
/* */
/* */
/* INTERFACE DEFINITION: */
/* variable def. expected/description */
/* ------------ ----- ------------------------------------- */
/* erlErr FNC (SUCCEEDED_ / FAILED_) error return */
/*\p*******************************************************************/
STAT_TYPE ERAerrorTerm()
{ /* ERAerrorTerm procedure */
/**********************************************************************/
/* Local Constant Declarations */
/**********************************************************************/
//CHARPTR ERL_PROC_NAME = "ERAerrorTerm";
/**********************************************************************/
/* Local Variable Declarations */
/**********************************************************************/
STAT_TYPE erlErr ;/* error return flag */
/**********************************************************************/
/* Procedure Body */
/**********************************************************************/
erlErr = SUCCEEDED_;
if (ermCloseFlag)
{
if (ermUserFile != NULL)
{
fclose(ermUserFile);
}
}
ermCloseFlag = FALSE_;
ermUserFile = NULL;
return(erlErr);
} /* end ERAerrorTerm */
/*\p********************************************************************
** **
** **
NAME: ERAdisplayLogErrors
PURPOSE: to enable or disable the display of all errors
logged. Helpful to enable this when first bringing
up software. Once "stable", disable (default), and
just log errors to a file.
** **
** **
**\p*******************************************************************/
VOID_RTN ERAdisplayLogErrors( int pasDisplayAll )
{ /* ERAdisplayLogErrors procedure */
/******************* Local Constant Declarations **********************/
/******************* Local Variable Declarations **********************/
/************************* Procedure Body *****************************/
ermShowAllErrors = pasDisplayAll;
} /* ERAdisplayLogErrors end */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -