00001
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 #ifndef _GAN_ERR_H
00166 #define _GAN_ERR_H
00167
00168 #include <gandalf/common/misc_defs.h>
00169
00170 #ifdef __cplusplus
00171 extern "C" {
00172 #endif
00173
00189 typedef void (*Gan_ErrorReporterFunc)(void);
00190
00191
00196 #define GAN_ERR_DFL ((Gan_ErrorReporterFunc) 0)
00197 #define GAN_ERR_IGN ((Gan_ErrorReporterFunc) 1)
00198
00199
00205 #define GAN_EC_OK 0
00206 #define GAN_EC_FAIL -1
00207
00208 #define GAN_EC_BASE 0
00209
00210 #define GAN_EC_DFT (GAN_EC_BASE+1000)
00211 #define GAN_EC_DFT_DEEP_ERROR (GAN_EC_DFT + 1)
00212 #define GAN_EC_DFT_SPARE (GAN_EC_DFT + 2)
00213 #define GAN_EC_DFT_BAD_N (GAN_EC_DFT + 3)
00214
00215 #define GAN_EC_DFT_EMPTY (GAN_EC_DFT + 4)
00216
00217
00231 void gan_err_register ( const char *func_name, int err_code, const char *message );
00232
00247 void gan_err_register_with_number ( const char *func_name, int err_code, const char *message, int number );
00248
00249
00250
00268 typedef enum { GAN_ERR_TRACE_OFF, GAN_ERR_TRACE_ON } Gan_TraceMode;
00269
00270
00271 Gan_ErrorReporterFunc
00272 gan_err_set_reporter(Gan_ErrorReporterFunc app_error_reporter);
00273 Gan_ErrorReporterFunc gan_err_get_reporter( void );
00274 void gan_err_report( void );
00275 int gan_err_register_fileline(
00276 const char * func_name,
00277 int err_code,
00278 const char * file_name,
00279 int line_number,
00280 const char * message,
00281 int number);
00282 void gan_err_set_trace( Gan_TraceMode trace_mode );
00283 void gan_err_flush_trace(void);
00284 int gan_err_get_error_count(void);
00285 int gan_err_get_error ( int n,
00286 const char ** func_name,
00287 int * err_code,
00288 const char ** file_name,
00289 int * line_number,
00290 const char ** message,
00291 int * number);
00292
00293
00294
00308 Gan_Bool gan_err_test_bool ( Gan_Bool test, char *funcname,
00309 int code, char *message );
00310
00325 int gan_err_test_int ( Gan_Bool test, char *funcname,
00326 int code, char *message );
00327
00342 int gan_err_test_uint ( Gan_Bool test, char *funcname,
00343 int code, char *message );
00344
00345
00360 void *gan_err_test_ptr ( Gan_Bool test, char *funcname,
00361 int code, char *message );
00362
00377 double gan_err_test_double ( Gan_Bool test, char *funcname,
00378 int code, char *message );
00379
00394 float gan_err_test_float ( Gan_Bool test, char *funcname,
00395 int code, char *message );
00396
00405 #ifdef __cplusplus
00406 }
00407 #endif
00408
00409 #endif