1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/*
* Ivy League
*
* Error management
*
* Copyright 1990-2000
* Laboratoire de Recherche en Informatique (LRI)
* Centre d'Etudes de la Navigation Aerienne (CENA)
*
* original code by Michel Beaudouin-Lafon,
* maintained by Stephane Chatty
*
* $Id$
*
*/
#ifndef IvlError_H_
#define IvlError_H_
#include "cplus_bugs.h"
#include "ivl/bool.h"
#ifdef DOC
// fake class for global functions
class IvlError {
};
#endif
enum errtype {
ErrNone = -4, // do nothing
ErrLog = -3, // only log to file
ErrWarn = -2, // warn and continue
ErrAbort = -1, // call abort
ErrExit = 0, // exit with code 0
ErrUsage = 1, // bad usage
ErrFatal = 2 // exit with code != 0
};
enum errcode {
ErrShouldImplement
};
extern char *ErrorTable [];
typedef errtype (*ErrorHandler) (errtype, const char* who, const char* what, const char* msg);
typedef void (*CleanUpProc) ();
extern void ProgramName (const char*);
extern void LogfileName (const char*, bool = false);
extern void CleanUp (CleanUpProc);
extern ErrorHandler SetErrorHandler (ErrorHandler);
extern void Error (errtype, const char* who, const char* what);
extern bool SysError (errtype, const char* who, int exc1 = -1, int exc2 = -1);
extern char* MakeErrorString (errtype, const char* who, const char* what);
extern void LogMessage (const char*);
extern int errno;
#endif /* IvlError_H_ */
|