ee80cc3bc14f70f6c6ee737f5695f6f666dee174
[reactos.git] / drivers / 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 DWORD 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
54 #define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
55
56 #else /* DBG */
57
58 #define TDI_DbgPrint(_t_, _x_)
59
60 #define ASSERT_IRQL(x)
61 #define ASSERT(x)
62
63 #endif /* DBG */
64
65
66 #define assert(x) ASSERT(x)
67 #define assert_irql(x) ASSERT_IRQL(x)
68
69
70 #ifdef _MSC_VER
71
72 #define UNIMPLEMENTED \
73     TDI_DbgPrint(MIN_TRACE, ("The function at %s:%d is unimplemented, \
74         but come back another day.\n", __FILE__, __LINE__));
75
76 #else /* _MSC_VER */
77
78 #define UNIMPLEMENTED \
79     TDI_DbgPrint(MIN_TRACE, ("%s at %s:%d is unimplemented, \
80         but come back another day.\n", __FUNCTION__, __FILE__, __LINE__));
81
82 #endif /* _MSC_VER */
83
84
85 #define CHECKPOINT \
86 do { TDI_DbgPrint(MIN_TRACE, ("%s:%d\n", __FILE__, __LINE__)); } while(0);
87
88 #endif /* __DEBUG_H */
89
90 /* EOF */