47 const char *
kAssertMsg =
"%s violated at line %d of `%s'";
48 const char *
kCheckMsg =
"%s not true at line %d of `%s'";
53 static const char *__crashreporter_info__ = 0;
54 asm(
".desc ___crashreporter_info__, 0x10");
66 TTHREAD_TLS(
Int_t) buf_size = 2048;
67 TTHREAD_TLS(
char*) buf = 0;
74 buf =
new char[buf_size];
76 Int_t n = vsnprintf(buf, buf_size, fmt, ap);
79 if (n == -1 || n >= buf_size) {
95 const char *toprint = buf;
96 fprintf(stderr,
"%s", toprint);
99 ::OutputDebugString(buf);
109 gErrorHandler = newhandler;
127 if (gErrorIgnoreLevel ==
kUnset) {
130 gErrorIgnoreLevel = 0;
134 gErrorIgnoreLevel =
kPrint;
136 gErrorIgnoreLevel =
kInfo;
140 gErrorIgnoreLevel =
kError;
142 gErrorIgnoreLevel =
kBreak;
146 gErrorIgnoreLevel =
kFatal;
150 if (level < gErrorIgnoreLevel)
153 const char *
type = 0;
162 type =
"\n *** Break ***";
170 smsg.
Form(
"%s", msg);
172 smsg.
Form(
"%s %s", type, msg);
173 else if (!location || !location[0])
174 smsg.
Form(
"%s: %s", type, msg);
176 smsg.
Form(
"%s in <%s>: %s", type, location, msg);
184 if (__crashreporter_info__)
185 delete [] __crashreporter_info__;
186 __crashreporter_info__ =
StrDup(smsg);
204 TTHREAD_TLS(
Int_t) buf_size(256);
205 TTHREAD_TLS(
char*) buf_storage(0);
208 char *buf = buf_storage ? buf_storage : small_buf;
216 buf_storage = buf =
new char[buf_size];
220 fmt =
"no error message provided";
222 Int_t n = vsnprintf(buf, buf_size, fmt, ap);
225 if (n == -1 || n >= buf_size) {
230 if (buf != &(small_buf[0]))
delete [] buf;
243 const char *toprint = buf;
249 gErrorHandler(level, level >= gErrorAbortLevel, location, bp);
262 Warning(method,
"this method must be overridden!");
271 Warning(method,
"may not use this method");
278 void Obsolete(
const char *
function,
const char *asOfVers,
const char *removedFromVers)
281 mess.
Form(
"obsolete as of %s and will be removed from %s", asOfVers, removedFromVers);
288 void Error(
const char *location,
const char *
va_(fmt), ...)
291 va_start(ap,
va_(fmt));
302 va_start(ap,
va_(fmt));
310 void Break(
const char *location,
const char *
va_(fmt), ...)
313 va_start(ap,
va_(fmt));
321 void Info(
const char *location,
const char *
va_(fmt), ...)
324 va_start(ap,
va_(fmt));
332 void Warning(
const char *location,
const char *
va_(fmt), ...)
335 va_start(ap,
va_(fmt));
343 void Fatal(
const char *location,
const char *
va_(fmt), ...)
346 va_start(ap,
va_(fmt));
static ErrorHandlerFunc_t gErrorHandler
void DefaultErrorHandler(Int_t level, Bool_t abort_bool, const char *location, const char *msg)
The default error handler function.
void SysError(const char *location, const char *va_(fmt),...)
Use this function in case a system (OS or GUI) related error occurred.
virtual void StackTrace()
Print a stack trace.
void MayNotUse(const char *method)
This function can be used in classes that should override a certain function, but in the inherited cl...
This class implements a mutex interface.
ErrorHandlerFunc_t GetErrorHandler()
Returns the current error handler function.
const char * Data() const
void Warning(const char *location, const char *va_(fmt),...)
Use this function in warning situations.
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
void Error(const char *location, const char *va_(fmt),...)
Use this function in case an error occurred.
void Fatal(const char *location, const char *va_(fmt),...)
Use this function in case of a fatal error. It will abort the program.
static void DebugPrint(const char *fmt,...)
Print debugging message to stderr and, on Windows, to the system debugger.
#define R__VA_COPY(to, from)
R__EXTERN TSystem * gSystem
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
char * Form(const char *fmt,...)
virtual void Abort(int code=0)
Abort the application.
char * StrDup(const char *str)
Duplicate the string str.
void Obsolete(const char *function, const char *asOfVers, const char *removedFromVers)
Use this function to declare a function obsolete.
void(* ErrorHandlerFunc_t)(int level, Bool_t abort, const char *location, const char *msg)
ErrorHandlerFunc_t SetErrorHandler(ErrorHandlerFunc_t newhandler)
Set an errorhandler function. Returns the old handler.
void AbstractMethod(const char *method)
This function can be used in abstract base classes in case one does not want to make the class a "rea...
void Info(const char *location, const char *va_(fmt),...)
Use this function for informational messages.
void Break(const char *location, const char *va_(fmt),...)
Use this function in case an error occurred.
void ErrorHandler(Int_t level, const char *location, const char *fmt, va_list ap)
General error handler function. It calls the user set error handler.
Bool_t gPrintViaErrorHandler
virtual const char * GetError()
Return system error string.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.