- In Win32 DBG is defined to 0 for a non-debug build and to 1 for a debug build....
[reactos.git] / reactos / lib / drivers / oskittcp / include / oskitdebug.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS TCP/IP protocol driver
4 * FILE: include/debug.h
5 * PURPOSE: Debugging support macros
6 * DEFINES: DBG - Enable debug output
7 * NASSERT - Disable assertions
8 */
9 #ifndef __OSKITDEBUG_H
10 #define __OSKITDEBUG_H
11
12 #define OSK_NORMAL_MASK 0x000000FF
13 #define OSK_SPECIAL_MASK 0xFFFFFF00
14 #define OSK_MIN_TRACE 0x00000001
15 #define OSK_MID_TRACE 0x00000002
16 #define OSK_MAX_TRACE 0x00000003
17
18 #define OSK_DEBUG_CHECK 0x00000100
19 #define OSK_DEBUG_MEMORY 0x00000200
20 #define OSK_DEBUG_BUFFER 0x00000400
21 #define OSK_DEBUG_IRP 0x00000800
22 #define OSK_DEBUG_REFCOUNT 0x00001000
23 #define OSK_DEBUG_ADDRFILE 0x00002000
24 #define OSK_DEBUG_DATALINK 0x00004000
25 #define OSK_DEBUG_ARP 0x00008000
26 #define OSK_DEBUG_IP 0x00010000
27 #define OSK_DEBUG_UDP 0x00020000
28 #define OSK_DEBUG_TCP 0x00040000
29 #define OSK_DEBUG_ICMP 0x00080000
30 #define OSK_DEBUG_ROUTER 0x00100000
31 #define OSK_DEBUG_RCACHE 0x00200000
32 #define OSK_DEBUG_NCACHE 0x00400000
33 #define OSK_DEBUG_CPOINT 0x00800000
34 #define OSK_DEBUG_ULTRA 0xFFFFFFFF
35
36 #include <oskittypes.h>
37
38 #if DBG
39
40 extern OSK_UINT OskitDebugTraceLevel;
41
42 #ifdef _MSC_VER
43
44 #define OS_DbgPrint(_t_, _x_) \
45 if (((OskitDebugTraceLevel & OSK_NORMAL_MASK) >= _t_) || \
46 ((OskitDebugTraceLevel & _t_) > OSK_NORMAL_MASK)) { \
47 DbgPrint("(%s:%d) ", __FILE__, __LINE__); \
48 DbgPrint _x_ ; \
49 }
50
51 #else /* _MSC_VER */
52
53 #define OS_DbgPrint(_t_, _x_) \
54 if (((OskitDebugTraceLevel & OSK_NORMAL_MASK) >= _t_) || \
55 ((OskitDebugTraceLevel & _t_) > OSK_NORMAL_MASK)) { \
56 DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
57 DbgPrint _x_ ; \
58 }
59
60 #endif /* _MSC_VER */
61
62 #if 0
63 #ifdef ASSERT
64 #undef ASSERT
65 #endif
66
67 #ifdef NASSERT
68 #define ASSERT(x)
69 #else /* NASSERT */
70 #define ASSERT(x) if (!(x)) { OS_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); KeBugCheck(0); }
71 #endif /* NASSERT */
72 #endif
73
74 #define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
75
76 #else /* DBG */
77
78 #define OS_DbgPrint(_t_, _x_)
79
80 #if 0
81 #define ASSERT_IRQL(x)
82 #define ASSERT(x)
83 #endif
84
85 #endif /* DBG */
86
87 #ifndef _MSC_VER
88 #define assert(x) ASSERT(x)
89 #endif//_MSC_VER
90 #define assert_irql(x) ASSERT_IRQL(x)
91
92 #endif /* __OSKITDEBUG_H */
93
94 /* EOF */