- Tree cleanups proposed on the mailing list. Move all non-Core OS modules to rosapps...
[reactos.git] / rosapps / 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 DBG
21
22 extern ULONG DebugTraceLevel;
23
24 #ifdef _MSC_VER
25
26 #define TDI_DbgPrint(_t_, _x_) \
27 if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
28 ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
29 DbgPrint("(%s:%d) ", __FILE__, __LINE__); \
30 DbgPrint _x_ ; \
31 }
32
33 #else /* _MSC_VER */
34
35 #define TDI_DbgPrint(_t_, _x_) \
36 if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
37 ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
38 DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
39 DbgPrint _x_ ; \
40 }
41
42 #endif /* _MSC_VER */
43
44 #ifdef ASSERT
45 #undef ASSERT
46 #endif
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 */