00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef _CPL_ERROR_H_INCLUDED_
00032 #define _CPL_ERROR_H_INCLUDED_
00033
00034 #include "cpl_port.h"
00035
00036
00037
00038
00039
00046 CPL_C_START
00047
00048 typedef enum
00049 {
00050 CE_None = 0,
00051 CE_Debug = 1,
00052 CE_Warning = 2,
00053 CE_Failure = 3,
00054 CE_Fatal = 4
00055 } CPLErr;
00056
00057 void CPL_DLL CPLError(CPLErr eErrClass, int err_no, const char *fmt, ...);
00058 void CPL_DLL CPLErrorV(CPLErr, int, const char *, va_list );
00059 void CPL_DLL CPL_STDCALL CPLErrorReset( void );
00060 int CPL_DLL CPL_STDCALL CPLGetLastErrorNo( void );
00061 CPLErr CPL_DLL CPL_STDCALL CPLGetLastErrorType( void );
00062 const char CPL_DLL * CPL_STDCALL CPLGetLastErrorMsg( void );
00063
00064 typedef void (CPL_STDCALL *CPLErrorHandler)(CPLErr, int, const char*);
00065
00066 void CPL_DLL CPL_STDCALL CPLLoggingErrorHandler( CPLErr, int, const char * );
00067 void CPL_DLL CPL_STDCALL CPLDefaultErrorHandler( CPLErr, int, const char * );
00068 void CPL_DLL CPL_STDCALL CPLQuietErrorHandler( CPLErr, int, const char * );
00069
00070 CPLErrorHandler CPL_DLL CPL_STDCALL CPLSetErrorHandler(CPLErrorHandler);
00071 void CPL_DLL CPL_STDCALL CPLPushErrorHandler( CPLErrorHandler );
00072 void CPL_DLL CPL_STDCALL CPLPopErrorHandler(void);
00073
00074 void CPL_DLL CPL_STDCALL CPLDebug( const char *, const char *, ... );
00075 void CPL_DLL CPL_STDCALL _CPLAssert( const char *, const char *, int );
00076
00077 #ifdef DEBUG
00078 # define CPLAssert(expr) ((expr) ? (void)(0) : _CPLAssert(#expr,__FILE__,__LINE__))
00079 #else
00080 # define CPLAssert(expr)
00081 #endif
00082
00083 CPL_C_END
00084
00085
00086
00087
00088
00089 #define CPLE_None 0
00090 #define CPLE_AppDefined 1
00091 #define CPLE_OutOfMemory 2
00092 #define CPLE_FileIO 3
00093 #define CPLE_OpenFailed 4
00094 #define CPLE_IllegalArg 5
00095 #define CPLE_NotSupported 6
00096 #define CPLE_AssertionFailed 7
00097 #define CPLE_NoWriteAccess 8
00098 #define CPLE_UserInterrupt 9
00099
00100
00101
00102 #endif