merge ROS Shell without integrated explorer part into trunk
[reactos.git] / reactos / lib / crt / include / internal / debug.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: include/msvcrt/msvcrtdbg.h
5 * PURPOSE: Useful debugging macros
6 * PROGRAMMER:
7 * UPDATE HISTORY:
8 *
9 */
10
11 /*
12 * NOTE: Define NDEBUG before including this header to disable debugging
13 * macros
14 */
15
16 #ifndef __MSVCRT_DEBUG
17 #define __MSVCRT_DEBUG
18
19 #include <roscfg.h>
20 #include <windows.h>
21
22
23 #define MK_STR(s) #s
24
25 #ifdef _UNICODE
26 #define sT "S"
27 #else
28 #define sT "s"
29 #endif
30
31
32
33 #define TRACE(...)
34
35
36 #ifdef DBG
37 #define DPRINT1(args...) do { DbgPrint("(MSVCRT:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
38 #define CHECKPOINT1 do { DbgPrint("MSVCRT:%s:%d\n",__FILE__,__LINE__); } while(0);
39 #else
40 #ifdef __GNUC__
41 #define DPRINT1(args...)
42 #else
43 #define DPRINT DbgPrint
44 #endif
45 #define CHECKPOINT1
46 #endif
47
48 #if !defined(NDEBUG) && defined(DBG)
49 #define DPRINT(args...) do { DbgPrint("(MSVCRT:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
50 #define CHECKPOINT do { DbgPrint("MSVCRT:%s:%d\n",__FILE__,__LINE__); } while(0);
51 #else
52 #ifdef __GNUC__
53 #define DPRINT(args...)
54 #else
55 #define DPRINT DbgPrint
56 #endif
57 #define CHECKPOINT
58 #endif /* NDEBUG */
59
60
61 #if 0
62
63 #define TRACE_RETURN(format_str, ret_type) \
64 ret_type __return_value__; \
65 static char* __return_format_str__ = "%s ret: "format_str"\n"
66
67 #define FUNCTION(func) \
68 static char* __func_name__ = #func
69
70 #define TRACE(a,b...) DPRINT1(a"\n", b)
71
72 #define RETURN(a) \
73 do{ __return_value__ = (a); DPRINT1(__return_format_str__ ,__func_name__,__return_value__); return __return_value__ ; }while(0)
74
75 #endif
76
77
78 /* ULONG CDECL DbgPrint(PCH Format, ...); */
79 ULONG DbgPrint(PCH Format,...);
80 /* unsigned long DbgPrint(const char* Format, ...); */
81
82
83
84 /* #define TRACE 0 ? (void)0 : Trace */
85
86 /* void Trace(TCHAR* lpszFormat, ...); */
87
88
89
90 #endif /* __MSVCRT_DEBUG */