[NETWORKING][CABMAN]
[reactos.git] / reactos / dll / win32 / ws2_32 / include / debug.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS WinSock 2 DLL
4 * FILE: include/debug.h
5 * PURPOSE: Debugging support macros
6 * DEFINES: DBG - Enable debug output
7 * NASSERT - Disable assertions
8 */
9
10 #ifndef __DEBUG_H
11 #define __DEBUG_H
12
13 #define NORMAL_MASK 0x000000FF
14 #define SPECIAL_MASK 0xFFFFFF00
15 #define MIN_TRACE 0x00000001
16 #define MID_TRACE 0x00000002
17 #define MAX_TRACE 0x00000003
18
19 #define DEBUG_CHECK 0x00000100
20 #define DEBUG_ULTRA 0xFFFFFFFF
21
22 #ifdef ASSERT
23 #undef ASSERT
24 #endif
25
26 #if DBG
27
28 extern DWORD DebugTraceLevel;
29
30 #define WS_DbgPrint(_t_, _x_) \
31 if ((_t_ > NORMAL_MASK) \
32 ? (DebugTraceLevel & _t_) > NORMAL_MASK \
33 : (DebugTraceLevel & NORMAL_MASK) >= _t_) { \
34 DbgPrint("(%hS:%d)(%hS) ", __FILE__, __LINE__, __FUNCTION__); \
35 DbgPrint _x_; \
36 }
37
38 #ifdef NASSERT
39 #define ASSERT(x)
40 #else /* NASSERT */
41 #define ASSERT(x) if (!(x)) { WS_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); ExitProcess(0); }
42 #endif /* NASSERT */
43
44 #else /* DBG */
45
46 #define WS_DbgPrint(_t_, _x_)
47
48 #define ASSERT_IRQL(x)
49 #define ASSERT(x)
50
51 #endif /* DBG */
52
53
54 #define assert(x) ASSERT(x)
55 #define assert_irql(x) ASSERT_IRQL(x)
56
57
58 #define UNIMPLEMENTED \
59 WS_DbgPrint(MIN_TRACE, ("is unimplemented, please try again later.\n"));
60
61 #define CHECKPOINT \
62 WS_DbgPrint(DEBUG_CHECK, ("\n"));
63
64 #define CP CHECKPOINT
65
66 #endif /* __DEBUG_H */