#include <windows.h>#include <stdio.h>#include <assert.h>#include <stdlib.h>#include <string.h>#include "ErrorLog.h"Go to the source code of this file.
Compounds | |
| struct | geErrorLogType |
| struct | geErrorType |
Defines | |
| #define | WIN32_LEAN_AND_MEAN |
| #define | MAX_ERRORS 30 |
| #define | MAX_USER_NAME_LEN 128 |
| #define | MAX_CONTEXT_LEN 128 |
Functions | |
| GENESISAPI void | geErrorLog_Clear (void) |
| GENESISAPI int | geErrorLog_Count (void) |
| GENESISAPI void | geErrorLog_AddExplicit (geErrorLog_ErrorClassType Error, const char *ErrorIDString, const char *ErrorFileString, int LineNumber, const char *UserString, const char *Context) |
| GENESISAPI geBoolean | geErrorLog_AppendStringToLastError (const char *String) |
| GENESISAPI geBoolean | geErrorLog_Report (int history, geErrorLog_ErrorClassType *error, const char **UserString) |
Variables | |
| geErrorLogType | geErrorLog_Locals = {0,MAX_ERRORS} |
|
|
Definition at line 34 of file ERRORLOG.C. Referenced by geErrorLog_AddExplicit(). |
|
|
Definition at line 31 of file ERRORLOG.C. Referenced by geErrorLog_AddExplicit(). |
|
|
Definition at line 33 of file ERRORLOG.C. Referenced by geErrorLog_AddExplicit(), and geErrorLog_AppendStringToLastError(). |
|
|
Definition at line 22 of file ERRORLOG.C. |
|
||||||||||||||||||||||||||||
|
Definition at line 65 of file ERRORLOG.C. References Error, geErrorLogType::ErrorCount, geErrorLogType::ErrorList, geErrorLog_Locals, GENESISAPI, MAX_CONTEXT_LEN, MAX_ERRORS, MAX_USER_NAME_LEN, geErrorLogType::MaxErrors, and NULL.
00071 {
00072 char *SDst;
00073 char *CDst;
00074
00075 assert( geErrorLog_Locals.ErrorCount >= 0 );
00076
00077 if (geErrorLog_Locals.ErrorCount>=MAX_ERRORS)
00078 { // scoot list down by one (lose oldest error)
00079 memmove(
00080 (char *)(&( geErrorLog_Locals.ErrorList[0] )),
00081 (char *)(&( geErrorLog_Locals.ErrorList[1] )),
00082 sizeof(geErrorType) * (geErrorLog_Locals.MaxErrors-1) );
00083 geErrorLog_Locals.ErrorCount = geErrorLog_Locals.MaxErrors-1;
00084 }
00085
00086 assert( geErrorLog_Locals.ErrorCount < geErrorLog_Locals.MaxErrors );
00087
00088 SDst = geErrorLog_Locals.ErrorList[geErrorLog_Locals.ErrorCount].String;
00089
00090 // Copy new error info
00091 if (ErrorIDString != NULL)
00092 {
00093 strncpy(SDst,ErrorIDString,MAX_USER_NAME_LEN);
00094 }
00095
00096 strncat(SDst," ",MAX_USER_NAME_LEN);
00097
00098 if (ErrorFileString!=NULL)
00099 {
00100 const char* pModule = strrchr(ErrorFileString, '\\');
00101 if(!pModule)
00102 pModule = ErrorFileString;
00103 else
00104 pModule++; // skip that backslash
00105 strncat(SDst,pModule,MAX_USER_NAME_LEN);
00106 strncat(SDst," ",MAX_USER_NAME_LEN);
00107 }
00108
00109 {
00110 char Number[20];
00111 itoa(LineNumber,Number,10);
00112 strncat(SDst,Number,MAX_USER_NAME_LEN);
00113 }
00114
00115 if (UserString != NULL)
00116 {
00117 if (UserString[0]!=0)
00118 {
00119 strncat(SDst," ",MAX_USER_NAME_LEN);
00120 strncat(SDst,UserString,MAX_USER_NAME_LEN);
00121 }
00122 }
00123
00124 CDst = geErrorLog_Locals.ErrorList[geErrorLog_Locals.ErrorCount].Context;
00125
00126 // Clear the context string in the errorlog to prepare for a new one
00127 memset(CDst, 0, sizeof(char)*MAX_CONTEXT_LEN);
00128
00129 if (Context != NULL)
00130 {
00131 if (Context[0]!=0)
00132 {
00133 //strncat(SDst," ",MAX_USER_NAME_LEN);
00134 strncat(SDst,Context,MAX_USER_NAME_LEN);
00135 }
00136 }
00137
00138 geErrorLog_Locals.ErrorCount++;
00139
00140 #ifndef NDEBUG
00141 #pragma message ("Clean up the OutputDebugStrings in geErrorLog_AddExplicit")
00142 {
00143 char buff[100];
00144 sprintf(buff, "ErrorLog: %d -", Error);
00145 OutputDebugString(buff);
00146 OutputDebugString(SDst);
00147 OutputDebugString("\r\n");
00148 }
00149 #endif
00150 }
|
|
|
Definition at line 154 of file ERRORLOG.C. References geErrorLogType::ErrorCount, geErrorLogType::ErrorList, GE_FALSE, GE_TRUE, geBoolean, geErrorLog_Locals, GENESISAPI, MAX_USER_NAME_LEN, and NULL.
00155 {
00156 char *SDst;
00157 if (String == NULL)
00158 {
00159 return GE_FALSE;
00160 }
00161
00162 if (geErrorLog_Locals.ErrorCount>0)
00163 {
00164 SDst = geErrorLog_Locals.ErrorList[geErrorLog_Locals.ErrorCount-1].String;
00165
00166 strncat(SDst,String,MAX_USER_NAME_LEN);
00167 return GE_TRUE;
00168 }
00169 else
00170 {
00171 return GE_FALSE;
00172 }
00173 }
|
|
|
Definition at line 52 of file ERRORLOG.C. References geErrorLogType::ErrorCount, geErrorLog_Locals, and GENESISAPI.
00054 {
00055 geErrorLog_Locals.ErrorCount = 0;
00056 }
|
|
|
Definition at line 58 of file ERRORLOG.C. References geErrorLogType::ErrorCount, geErrorLog_Locals, and GENESISAPI. Referenced by GenVS_Error().
00060 {
00061 return geErrorLog_Locals.ErrorCount;
00062 }
|
|
||||||||||||||||
|
Definition at line 175 of file ERRORLOG.C. References geErrorLogType::ErrorCount, geErrorType::ErrorID, geErrorLogType::ErrorList, GE_FALSE, GE_TRUE, geBoolean, geErrorLog_Locals, GENESISAPI, NULL, and geErrorType::String. Referenced by GenVS_Error().
00176 {
00177 assert( error != NULL );
00178
00179 if ( (history > geErrorLog_Locals.ErrorCount) || (history < 0))
00180 {
00181 return GE_FALSE;
00182 }
00183
00184
00185 *error = geErrorLog_Locals.ErrorList[history].ErrorID;
00186 *UserString = geErrorLog_Locals.ErrorList[history].String;
00187 return GE_TRUE;
00188 }
|
|
|
Definition at line 50 of file ERRORLOG.C. Referenced by geErrorLog_AddExplicit(), geErrorLog_AppendStringToLastError(), geErrorLog_Clear(), geErrorLog_Count(), and geErrorLog_Report(). |
1.3.2