#ifndef KERBEROSDEBUG_H
#define KERBEROSDEBUG_H
#include <stdarg.h>
#include <sys/types.h>
#include <mach/mach.h>
#ifdef __cplusplus
extern "C" {
#endif
#define ddebuglevel __KerberosDebugLogLevel
#define dprintf __KerberosDebugPrint
#define dvprintf __KerberosDebugVAPrint
#define dprintmem __KerberosDebugPrintMemory
#define dprintsession __KerberosDebugPrintSession
int ddebuglevel (void);
void dprintf (const char *in_format, ...) __attribute__ ((format (printf, 1, 2)));
void dvprintf (const char *in_format, va_list in_args);
void dprintmem (const void *in_data, size_t in_length);
void dprintsession (void);
#define SetSignalAction_(inAction)
#ifdef __PowerPlant__
#define GetSignalAction_() debugAction_Nothing
#else
#define GetSignalAction_() (0)
#endif
#ifdef __PowerPlant__
# undef SignalPStr_
# undef SignalCStr_
# undef SignalIf_
# undef SignalIfNot_
#endif
#define SignalPStr_(pstr) \
do { \
dprintf ("%.*s in %s() (%s:%d)", \
(pstr) [0], (pstr) + 1, \
__FUNCTION__, __FILE__, __LINE__); \
} while (0)
#define SignalCStr_(cstr) \
do { \
dprintf ("%s in %s() (%s:%d)", \
cstr, __FUNCTION__, __FILE__, __LINE__); \
} while (0)
#define SignalIf_(test) \
do { \
if (test) SignalCStr_("Assertion " #test " failed"); \
} while (0)
#define SignalIfNot_(test) SignalIf_(!(test))
#define Assert_(test) SignalIfNot_(test)
enum { errUncaughtException = 666 };
#define SafeTry_ try
#define SafeCatch_ catch (...)
#define SafeCatchOSErr_(error) catch (...) { SignalCStr_ ("Uncaught exception"); error = errUncaughtException; }
#define DebugThrow_(e) \
do { \
dprintf ("Exception thrown from %s() (%s:%d)", \
__FUNCTION__, __FILE__, __LINE__); \
throw (e); \
} while (0)
#ifdef __cplusplus
}
#endif
#endif