Macros | Typedefs | Enumerations | Functions | Variables
omError.h File Reference
#include <stdio.h>

Go to the source code of this file.

Macros

#define omAssume(x)
 

Typedefs

typedef enum omError_e omError_t
 

Enumerations

enum  omError_e {
  omError_NoError = 0, omError_Unknown, omError_InternalBug, omError_MemoryCorrupted,
  omError_NullAddr, omError_InvalidRangeAddr, omError_FalseAddr, omError_FalseAddrOrMemoryCorrupted,
  omError_WrongSize, omError_FreedAddr, omError_FreedAddrOrMemoryCorrupted, omError_WrongBin,
  omError_UnknownBin, omError_NotBinAddr, omError_UnalignedAddr, omError_NullSizeAlloc,
  omError_ListCycleError, omError_SortedListError, omError_KeptAddrListCorrupted, omError_FreePattern,
  omError_BackPattern, omError_FrontPattern, omError_NotString, omError_StickyBin,
  omError_MaxError
}
 

Functions

const char * omError2String (omError_t error)
 
const char * omError2Serror (omError_t error)
 
omError_t omReportError (omError_t error, omError_t report_error, OM_FLR_DECL, const char *fmt,...)
 
void omErrorBreak ()
 
void omPrintAddrInfo (FILE *fd, void *addr, const char *s)
 

Variables

omError_t om_ErrorStatus
 
omError_t om_InternalErrorStatus
 
int om_CallErrorHook
 

Macro Definition Documentation

#define omAssume (   x)
Value:
do \
{ \
if (! (x)) \
{ \
omReportError(omError_InternalBug, omError_InternalBug, OM_FLR, "omAssume violation"); \
} \
} \
while (0)
int int kStrategy strat if(h==NULL) return NULL
while(1)
Definition: libparse.cc:1442
Variable x
Definition: cfModGcd.cc:4023
omError_t omReportError(omError_t error, omError_t report_error, OM_FLR_DECL, const char *fmt,...)
Definition: omError.c:78

Definition at line 85 of file omError.h.

Typedef Documentation

typedef enum omError_e omError_t

Definition at line 44 of file omError.h.

Enumeration Type Documentation

enum omError_e
Enumerator
omError_NoError 
omError_Unknown 
omError_InternalBug 
omError_MemoryCorrupted 
omError_NullAddr 
omError_InvalidRangeAddr 
omError_FalseAddr 
omError_FalseAddrOrMemoryCorrupted 
omError_WrongSize 
omError_FreedAddr 
omError_FreedAddrOrMemoryCorrupted 
omError_WrongBin 
omError_UnknownBin 
omError_NotBinAddr 
omError_UnalignedAddr 
omError_NullSizeAlloc 
omError_ListCycleError 
omError_SortedListError 
omError_KeptAddrListCorrupted 
omError_FreePattern 
omError_BackPattern 
omError_FrontPattern 
omError_NotString 
omError_StickyBin 
omError_MaxError 

Definition at line 16 of file omError.h.

17 {
18  omError_NoError = 0,
43 };

Function Documentation

const char* omError2Serror ( omError_t  error)

Definition at line 63 of file omError.c.

64 {
65  int i = 0;
66  while (! (om_ErrorStrings[i].string == NULL && om_ErrorStrings[i].error == omError_MaxError))
67  {
69  i++;
70  }
71  return "omError_UnKnown";
72 }
static struct omErrorString_s om_ErrorStrings[]
Definition: omError.c:22
char * s_error
Definition: omError.c:17
int i
Definition: cfEzgcd.cc:123
#define error(a)
Definition: mpr_numeric.cc:979
#define NULL
Definition: omList.c:10
const char* omError2String ( omError_t  error)

Definition at line 52 of file omError.c.

53 {
54  int i = 0;
55  while (! (om_ErrorStrings[i].string == NULL && om_ErrorStrings[i].error == omError_MaxError))
56  {
58  i++;
59  }
60  return "undocumented error";
61 }
static struct omErrorString_s om_ErrorStrings[]
Definition: omError.c:22
int i
Definition: cfEzgcd.cc:123
#define error(a)
Definition: mpr_numeric.cc:979
#define NULL
Definition: omList.c:10
char * string
Definition: omError.c:18
void omErrorBreak ( )

Definition at line 135 of file omError.c.

136 {}
void omPrintAddrInfo ( FILE *  fd,
void *  addr,
const char *  s 
)

Definition at line 445 of file omDebugCheck.c.

446 {
447  _omPrintAddrInfo(fd, omError_NoError, addr, NULL, 0, 10, s);
448 }
int status int fd
Definition: si_signals.h:59
const CanonicalForm int s
Definition: facAbsFact.cc:55
static void _omPrintAddrInfo(FILE *fd, omError_t error, void *addr, void *bin_size, omTrackFlags_t flags, int max_frames, const char *s)
Definition: omDebugCheck.c:420
#define NULL
Definition: omList.c:10
omError_t omReportError ( omError_t  error,
omError_t  report_error,
OM_FLR_DECL  ,
const char *  fmt,
  ... 
)

Definition at line 78 of file omError.c.

80 {
81  int max_check, max_track;
82 
83  if (report_error == omError_MaxError) return error;
84  /* reset MaxTrack and MaxCheck to prevent infinite loop, in case
85  printf allocates memory */
86  max_check = om_Opts.MaxCheck;
87  max_track = om_Opts.MaxTrack;
88  om_Opts.MaxCheck = 0;
89  om_Opts.MaxTrack = 0;
90 
92  om_ErrorStatus = (report_error == omError_NoError ? error : report_error);
93 
94  if (om_Opts.HowToReportErrors && om_ErrorStatus != omError_NoError)
95  {
96  /* to avoid spurious error msg in 64 bit mode*/
97  if (om_ErrorStatus == omError_StickyBin) return error;
98  fprintf(stderr, "***%s: %s", omError2Serror(om_ErrorStatus), omError2String(om_ErrorStatus));
99 
100 #ifdef OM_INTERNAL_DEBUG
101  if (om_ErrorStatus != error)
102  fprintf(stderr, "\n___%s: %s", omError2Serror(error), omError2String(error));
103 #endif
104 
105  if (om_Opts.HowToReportErrors > 2 && fmt != NULL && *fmt != '\0')
106  {
107  va_list ap;
108  va_start(ap, fmt);
109  fprintf(stderr, ": ");
110  vfprintf(stderr, fmt, ap);
111  va_end(ap);
112  }
113 
114  if (om_Opts.HowToReportErrors > 1)
115  {
116 #ifndef OM_NDEBUG
117  fprintf(stderr, "\n occured at: ");
118  if (! _omPrintCurrentBackTrace(stderr, OM_FLR_VAL))
119  fprintf(stderr, " ??");
120 #endif
121  }
122  fprintf(stderr, "\n");
123  fflush(stderr);
124  }
125  if (om_CallErrorHook)
126  om_Opts.ErrorHook();
127 
128  om_Opts.MaxCheck = max_check;
129  om_Opts.MaxTrack = max_track;
130  return error;
131 }
const char * omError2String(omError_t error)
Definition: omError.c:52
int _omPrintCurrentBackTrace(FILE *fd, OM_FLR_DECL)
Definition: omRet2Info.c:270
omError_t om_InternalErrorStatus
Definition: omError.c:12
omOpts_t om_Opts
Definition: omOpts.c:11
omError_t om_ErrorStatus
Definition: omError.c:11
const char * omError2Serror(omError_t error)
Definition: omError.c:63
#define error(a)
Definition: mpr_numeric.cc:979
#define NULL
Definition: omList.c:10
int om_CallErrorHook
Definition: omError.c:75

Variable Documentation

int om_CallErrorHook

Definition at line 75 of file omError.c.

omError_t om_ErrorStatus

Definition at line 11 of file omError.c.

omError_t om_InternalErrorStatus

Definition at line 12 of file omError.c.