:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / lib / user32 / include / debug.h
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS user32.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_OBJECT   0x00000200
20 #define DEBUG_WINDOW   0x00000400
21 #define DEBUG_ULTRA    0xFFFFFFFF
22
23 #ifdef DBG
24
25 extern DWORD DebugTraceLevel;
26
27 #define D(_t_, _x_) \
28     if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
29         ((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
30         DbgPrint("(%hS:%d)(%hS) ", __FILE__, __LINE__, __FUNCTION__); \
31                     DbgPrint _x_; \
32     }
33
34 #ifdef ASSERT
35 #undef ASSERT
36 #endif
37
38 #ifdef NASSERT
39 #define ASSERT(x)
40 #else /* NASSERT */
41 #define ASSERT(x) if (!(x)) { D(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); KeBugCheck(0); }
42 #endif /* NASSERT */
43
44 #define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
45
46 #else /* DBG */
47
48 #define D(_t_, _x_)
49
50 #define ASSERT_IRQL(x)
51 #define ASSERT(x)
52
53 #endif /* DBG */
54
55
56 #define assert(x) ASSERT(x)
57 #define assert_irql(x) ASSERT_IRQL(x)
58
59
60 #define UNIMPLEMENTED \
61     D(MIN_TRACE, ("is unimplemented, please try again later.\n"));
62
63 #define CHECKPOINT \
64     D(DEBUG_CHECK, ("\n"));
65
66 #define DPRINT(X...) D(DEBUG_CHECK, (X))
67
68 #define CP CHECKPOINT
69
70 #endif /* __DEBUG_H */
71
72 /* EOF */