omError.h
Go to the documentation of this file.
1 /*******************************************************************
2  * File: omError.h
3  * Purpose: Error handling of omalloc
4  * Author: obachman (Olaf Bachmann)
5  * Created: 11/99
6  *******************************************************************/
7 #ifndef OM_ERROR_H
8 #define OM_ERROR_H
9 
10 #include <stdio.h>
11 /*******************************************************************
12  *
13  * error codes
14  *
15  *******************************************************************/
17 {
43 };
44 typedef enum omError_e omError_t;
45 
46 /* global variable holding last omError */
48 /* globale variable holding last low-level omError */
50 /* returns description of error */
51 const char* omError2String(omError_t error);
52 /* returns error as string */
53 const char* omError2Serror(omError_t error);
54 extern omError_t omReportError(omError_t error, omError_t report_error, OM_FLR_DECL,
55  const char* fmt, ...);
56 
57 /* this is a dummy function and used as default for om_Opts.ErrorHook */
58 extern void omErrorBreak();
59 
60 #ifndef OM_NDEBUG
61 extern void omPrintAddrInfo(FILE* fd, void* addr, const char* s);
62 #else
63 #define omPrintAddrInfo(fd, addr, s) fprintf(fd, "OM_NDEBUG: no addr info available\n")
64 #endif
65 
66 /*BEGINPRIVATE*/
67 
68 #ifndef OM_NDEBUG
69 extern int om_CallErrorHook;
70 #else
71 #define om_CallErrorHook 1
72 #endif
73 
74 /*******************************************************************
75  *
76  * om_assume(x) -- a handy macro for assumptions
77  *
78  ******************************************************************/
79 #ifndef HAVE_OM_ASSUME
80 
81 #define omAssume(x) do {} while (0)
82 
83 #else /* ! HAVE_OM_ASSUME */
84 
85 #define omAssume(x) \
86 do \
87 { \
88  if (! (x)) \
89  { \
90  omReportError(omError_InternalBug, omError_InternalBug, OM_FLR, "omAssume violation"); \
91  } \
92 } \
93 while (0)
94 
95 #endif /* HAVE_OM_ASSUME */
96 /*ENDPRIVATE*/
97 
98 #endif /* OM_LOCAL_H */
int status int fd
Definition: si_signals.h:59
const CanonicalForm int s
Definition: facAbsFact.cc:55
enum omError_e omError_t
Definition: omError.h:44
void omPrintAddrInfo(FILE *fd, void *addr, const char *s)
Definition: omDebugCheck.c:445
const char * omError2Serror(omError_t error)
Definition: omError.c:63
void error(const char *fmt,...)
Definition: emacs.cc:58
omError_t om_ErrorStatus
Definition: omError.c:11
omError_t om_InternalErrorStatus
Definition: omError.c:12
omError_e
Definition: omError.h:16
int om_CallErrorHook
Definition: omError.c:75
const char * omError2String(omError_t error)
Definition: omError.c:52
omError_t omReportError(omError_t error, omError_t report_error, OM_FLR_DECL, const char *fmt,...)
Definition: omError.c:78
void omErrorBreak()
Definition: omError.c:135