2be8a158b8e98ca4d0f6fb2631ac63e49e29496e
[reactos.git] / dll / win32 / msafd / include / debug.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Ancillary Function Driver DLL
4 * FILE: include/debug.h
5 * PURPOSE: Debugging support macros
6 * DEFINES: DBG - Enable debug output
7 * NASSERT - Disable assertions
8 */
9 #ifndef __DEBUG_H
10 #define __DEBUG_H
11
12 #define NORMAL_MASK 0x000000FF
13 #define SPECIAL_MASK 0xFFFFFF00
14 #define MIN_TRACE 0x00000001
15 #define MID_TRACE 0x00000002
16 #define MAX_TRACE 0x00000003
17
18 #define DEBUG_CHECK 0x00000100
19 #define DEBUG_ULTRA 0xFFFFFFFF
20
21 #ifdef ASSERT
22 #undef ASSERT
23 #endif
24
25 #if DBG
26
27 extern DWORD DebugTraceLevel;
28
29 #define AFD_DbgPrint(_t_, _x_) \
30 if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
31 ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
32 DbgPrint("(%hS:%d)(%hS) ", __FILE__, __LINE__, __FUNCTION__); \
33 DbgPrint _x_; \
34 }
35
36 #ifdef NASSERT
37 #define ASSERT(x)
38 #else /* NASSERT */
39 #define ASSERT(x) if (!(x)) { AFD_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); ExitProcess(0); }
40 #endif /* NASSERT */
41
42 #else /* DBG */
43
44 #define AFD_DbgPrint(_t_, _x_)
45
46 #define ASSERT_IRQL(x)
47 #define ASSERT(x)
48
49 #endif /* DBG */
50
51 #ifdef assert
52 #undef assert
53 #endif
54 #define assert(x) ASSERT(x)
55
56
57 #define UNIMPLEMENTED \
58 AFD_DbgPrint(MIN_TRACE, ("is unimplemented, please try again later.\n"));
59
60 #define CHECKPOINT \
61 AFD_DbgPrint(DEBUG_CHECK, ("\n"));
62
63 #define CP CHECKPOINT
64
65 #endif /* __DEBUG_H */
66
67 /* EOF */