c1a75a6bea2b2d5da61104647e898694225a9c14
[reactos.git] / include / win32k / debug1.h
1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS kernel
4  * FILE:            include/internal/debug.h
5  * PURPOSE:         Useful debugging macros
6  * PROGRAMMER:      David Welch (welch@mcmail.com)
7  * UPDATE HISTORY:
8  *                28/05/98: Created
9  */
10
11 /*
12  * NOTE: Define NDEBUG before including this header to disable debugging
13  * macros
14  */
15
16 #ifndef __INTERNAL_DEBUG
17 #define __INTERNAL_DEBUG
18
19 #define UNIMPLEMENTED do {DbgPrint("%s at %s:%d is unimplemented, have a nice day\n",__FUNCTION__,__FILE__,__LINE__); for(;;);  } while(0);
20
21 /*  FIXME: should probably remove this later  */
22 #if !defined(CHECKED) && !defined(NDEBUG)
23 #define CHECKED
24 #endif
25
26 #ifndef NASSERT
27 #define assert(x) if (!(x)) {DbgPrint("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); KeBugCheck(0); }
28 #define ASSERT(x) assert(x)
29 #else
30 #define assert(x)
31 #define ASSERT(x)
32 #endif
33
34 #define DPRINT1(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); ExAllocatePool(NonPagedPool,0); } while(0);
35 #define CHECKPOINT1 do { DbgPrint("%s:%d\n",__FILE__,__LINE__); ExAllocatePool(NonPagedPool,0); } while(0);
36
37
38 #ifdef __NTOSKRNL__
39 #define DPRINT_CHECKS
40 #else
41 #define DPRINT_CHECKS
42 #endif
43
44 #ifndef NDEBUG
45 #define DPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
46 #define CHECKPOINT do { DbgPrint("%s:%d\n",__FILE__,__LINE__); ExAllocatePool(NonPagedPool,0); } while(0);
47 #else
48 #define DPRINT(args...)
49 #define CHECKPOINT
50 #endif /* NDEBUG */
51
52 /*
53  * FUNCTION: Assert a maximum value for the current irql
54  * ARGUMENTS:
55  *        x = Maximum irql
56  */
57 #define ASSERT_IRQL(x) assert(KeGetCurrentIrql()<=(x))
58 #define assert_irql(x) assert(KeGetCurrentIrql()<=(x))
59
60 #endif /* __INTERNAL_DEBUG */