2001-01-14 17:44:38 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS Ancillary Function Driver
|
|
|
|
* FILE: include/debug.h
|
|
|
|
* PURPOSE: Debugging support macros
|
|
|
|
* DEFINES: DBG - Enable debug output
|
|
|
|
* NASSERT - Disable assertions
|
|
|
|
*/
|
2010-02-26 11:43:19 +00:00
|
|
|
|
|
|
|
#pragma once
|
2001-01-14 17:44:38 +00:00
|
|
|
|
|
|
|
#define NORMAL_MASK 0x000000FF
|
|
|
|
#define SPECIAL_MASK 0xFFFFFF00
|
|
|
|
#define MIN_TRACE 0x00000001
|
|
|
|
#define MID_TRACE 0x00000002
|
|
|
|
#define MAX_TRACE 0x00000003
|
|
|
|
|
2001-05-01 22:44:07 +00:00
|
|
|
#define DEBUG_CHECK 0x00000100
|
|
|
|
#define DEBUG_IRP 0x00000200
|
2001-01-14 17:44:38 +00:00
|
|
|
#define DEBUG_ULTRA 0xFFFFFFFF
|
|
|
|
|
2009-06-17 12:44:05 +00:00
|
|
|
#if DBG
|
2001-01-14 17:44:38 +00:00
|
|
|
|
|
|
|
extern DWORD DebugTraceLevel;
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
|
|
|
|
#define AFD_DbgPrint(_t_, _x_) \
|
|
|
|
if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
|
|
|
|
((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
|
|
|
|
DbgPrint("(%s:%d) ", __FILE__, __LINE__); \
|
|
|
|
DbgPrint _x_ ; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#else /* _MSC_VER */
|
|
|
|
|
|
|
|
#define AFD_DbgPrint(_t_, _x_) \
|
|
|
|
if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
|
|
|
|
((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
|
|
|
|
DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
|
|
|
|
DbgPrint _x_ ; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _MSC_VER */
|
|
|
|
|
|
|
|
#ifdef ASSERT
|
|
|
|
#undef ASSERT
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef NASSERT
|
|
|
|
#define ASSERT(x)
|
|
|
|
#else /* NASSERT */
|
2009-10-21 17:52:11 +00:00
|
|
|
#define ASSERT(x) if (!(x)) { AFD_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); DbgBreakPoint(); }
|
2001-01-14 17:44:38 +00:00
|
|
|
#endif /* NASSERT */
|
|
|
|
|
|
|
|
#else /* DBG */
|
|
|
|
|
|
|
|
#define AFD_DbgPrint(_t_, _x_)
|
|
|
|
|
2001-06-15 17:48:43 +00:00
|
|
|
#define ASSERTKM(x)
|
2004-11-12 09:27:02 +00:00
|
|
|
#ifndef ASSERT
|
2001-01-14 17:44:38 +00:00
|
|
|
#define ASSERT(x)
|
2004-11-12 09:27:02 +00:00
|
|
|
#endif
|
2001-01-14 17:44:38 +00:00
|
|
|
|
|
|
|
#endif /* DBG */
|
|
|
|
|
|
|
|
|
2004-01-11 20:46:06 +00:00
|
|
|
#undef assert
|
2001-01-14 17:44:38 +00:00
|
|
|
#define assert(x) ASSERT(x)
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
|
|
|
|
#define UNIMPLEMENTED \
|
|
|
|
AFD_DbgPrint(MIN_TRACE, ("The function at %s:%d is unimplemented, \
|
|
|
|
but come back another day.\n", __FILE__, __LINE__));
|
|
|
|
|
|
|
|
#else /* _MSC_VER */
|
|
|
|
|
|
|
|
#define UNIMPLEMENTED \
|
|
|
|
AFD_DbgPrint(MIN_TRACE, ("%s at %s:%d is unimplemented, " \
|
|
|
|
"but come back another day.\n", __FUNCTION__, __FILE__, __LINE__));
|
|
|
|
|
|
|
|
#endif /* _MSC_VER */
|
|
|
|
|
|
|
|
|
|
|
|
#define CHECKPOINT \
|
2001-05-01 22:44:07 +00:00
|
|
|
AFD_DbgPrint(DEBUG_CHECK, ("\n"));
|
|
|
|
|
|
|
|
#define CP CHECKPOINT
|
2001-01-14 17:44:38 +00:00
|
|
|
|
|
|
|
/* EOF */
|