📄 errorlog.h
字号:
/*
Simple error id logger.
errors are logged to this object using ErrorLog_Add()
errors are retrieved using ErrorLog_Report()
created: Mike Sandige 1/2/98
*/
#ifndef GE_ERRORLOG_H
#define GE_ERRORLOG_H
#include "basetype.h"
//#ifndef NDEBUG
#define ERRORLOG_FULL_REPORTING
//#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
Temporary structure forward, to hold place for when geThreadQueue is fully
implemented.
*/
typedef struct geErrorLog geErrorLog;
typedef enum
{
//do not use these errors - use the next list
GE_ERR_DRIVER_INIT_FAILED=500, // Could not init Driver
//do not use these errors - use the next list
GE_ERR_DRIVER_NOT_FOUND, // File open error for driver
//do not use these errors - use the next list
GE_ERR_DRIVER_NOT_INITIALIZED, // Driver shutdown failure
GE_ERR_INVALID_DRIVER, // Wrong driver version, or bad driver
GE_ERR_DRIVER_BEGIN_SCENE_FAILED,
GE_ERR_DRIVER_END_SCENE_FAILED,
//do not use these errors - use the next list
GE_ERR_NO_PERF_FREQ,
GE_ERR_FILE_OPEN_ERROR,
//do not use these errors - use the next list
GE_ERR_INVALID_PARMS,
GE_ERR_OUT_OF_MEMORY,
} geErrorLog_ErrorIDEnumType;
typedef enum
{
GE_ERR_MEMORY_RESOURCE,
GE_ERR_DISPLAY_RESOURCE,
GE_ERR_SOUND_RESOURCE,
GE_ERR_SYSTEM_RESOURCE,
GE_ERR_INTERNAL_RESOURCE,
GE_ERR_FILEIO_OPEN,
GE_ERR_FILEIO_CLOSE,
GE_ERR_FILEIO_READ,
GE_ERR_FILEIO_WRITE,
GE_ERR_FILEIO_FORMAT,
GE_ERR_FILEIO_VERSION,
GE_ERR_LIST_FULL,
GE_ERR_DATA_FORMAT,
GE_ERR_BAD_PARAMETER,
GE_ERR_SEARCH_FAILURE,
GE_ERR_WINDOWS_API_FAILURE,
GE_ERR_SUBSYSTEM_FAILURE,
} geErrorLog_ErrorClassType;
void geErrorLog_Clear(void);
// clears error history
int geErrorLog_Count(void);
// reports size of current error log
void geErrorLog_AddExplicit(geErrorLog_ErrorClassType,
const char *ErrorIDString,
const char *ErrorFileString,
int LineNumber,
const char *UserString,
const char *Context);
// not intended to be used directly: use ErrorLog_Add or ErrorLog_AddString
#ifdef ERRORLOG_FULL_REPORTING
// 'Debug' version includes a textual error id, and the user string
#define geErrorLog_Add(Error, Context) geErrorLog_AddExplicit((geErrorLog_ErrorClassType)(Error), #Error, __FILE__, __LINE__,"", Context)
// logs an error.
#define geErrorLog_AddString(Error,String, Context) geErrorLog_AddExplicit((geErrorLog_ErrorClassType)(Error), #Error, __FILE__,__LINE__, String, Context)
// logs an error with additional identifing string.
bool geErrorLog_AppendStringToLastError(const char *String);// use geErrorLog_AppendString
#define geErrorLog_AppendString(XXX) geErrorLog_AppendStringToLastError(XXX)
// adds text to the previous logged error
#else
// 'Release' version does not include the textual error id, or the user string
#define geErrorLog_Add(Error, Context) geErrorLog_AddExplicit((geErrorLog_ErrorClassType)(Error), "", __FILE__, __LINE__,"", Context)
// logs an error.
#define geErrorLog_AddString(Error,String, Context) geErrorLog_AddExplicit((geErrorLog_ErrorClassType)(Error), "", __FILE__,__LINE__, "", Context)
// logs an error with additional identifing string.
#define geErrorLog_AppendString(XXX)
// adds text to the previous logged error
#endif
const char *geErrorLog_IntToString(int Number);
// turns Number into a string. uses a fixed static character string.
// for use with the context parameter of geErrorLog_AddString()
bool geErrorLog_Report(int History, geErrorLog_ErrorClassType *Error, const char **UserString, const char **Context);
// reports from the error log.
// history is 0 for most recent, 1.. for second most recent etc.
// returns GETRUE if report succeeded. GEFALSE if it failed.
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -