- Leftover from 41436
[reactos.git] / rosapps / applications / net / tditest / include / debug.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS TDI test driver
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_ULTRA 0xFFFFFFFF
19
20 #ifdef ASSERT
21 #undef ASSERT
22 #endif
23
24 #if DBG
25
26 extern ULONG DebugTraceLevel;
27
28 #ifdef _MSC_VER
29
30 #define TDI_DbgPrint(_t_, _x_) \
31 if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
32 ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
33 DbgPrint("(%s:%d) ", __FILE__, __LINE__); \
34 DbgPrint _x_ ; \
35 }
36
37 #else /* _MSC_VER */
38
39 #define TDI_DbgPrint(_t_, _x_) \
40 if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
41 ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
42 DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
43 DbgPrint _x_ ; \
44 }
45
46 #endif /* _MSC_VER */
47
48 #ifdef NASSERT
49 #define ASSERT(x)
50 #else /* NASSERT */
51 #define ASSERT(x) if (!(x)) { TDI_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); KeBugCheck(0); }
52 #endif /* NASSERT */
53 #define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
54
55 #else /* DBG */
56
57 #define TDI_DbgPrint(_t_, _x_)
58
59 #define ASSERT_IRQL(x)
60 #define ASSERT(x)
61
62 #endif /* DBG */
63
64
65 #define assert(x) ASSERT(x)
66 #define assert_irql(x) ASSERT_IRQL(x)
67
68
69 #ifdef _MSC_VER
70
71 #define UNIMPLEMENTED \
72 TDI_DbgPrint(MIN_TRACE, ("The function at %s:%d is unimplemented, \
73 but come back another day.\n", __FILE__, __LINE__));
74
75 #else /* _MSC_VER */
76
77 #define UNIMPLEMENTED \
78 TDI_DbgPrint(MIN_TRACE, ("%s at %s:%d is unimplemented, \
79 but come back another day.\n", __FUNCTION__, __FILE__, __LINE__));
80
81 #endif /* _MSC_VER */
82
83
84 #define CHECKPOINT \
85 do { TDI_DbgPrint(MIN_TRACE, ("%s:%d\n", __FILE__, __LINE__)); } while(0);
86
87 #endif /* __DEBUG_H */
88
89 /* EOF */