newer msvc's are aware of __FUNCTION__
[reactos.git] / reactos / include / wine / debug.h
1 #ifndef __WINE_DEBUG_H
2 #define __WINE_DEBUG_H
3
4 #include "../roscfg.h"
5 #include <stdarg.h>
6 #include <windows.h>
7 #include <wchar.h>
8
9 /* Add ROS Master debug functions if not added yet */
10 #ifndef __INTERNAL_DEBUG
11 #ifdef YDEBUG
12 #undef NDEBUG
13 #else
14 #define NDEBUG
15 #endif
16 #include <reactos/debug.h>
17 #endif
18
19 #ifndef __GNUC__
20 #if !defined(_MSC_VER) || _MSC_VER < 8
21 #define __FUNCTION__ ""
22 #endif//_MSC_VER
23 #define inline __inline
24 #endif
25
26 unsigned long DbgPrint(char *Format,...);
27
28 struct _GUID;
29
30 /* Exported definitions and macros */
31
32 /* These function return a printable version of a string, including
33 quotes. The string will be valid for some time, but not indefinitely
34 as strings are re-used. */
35 extern const char *wine_dbgstr_w( const WCHAR *s );
36 extern const char *wine_dbgstr_an( const char * s, int n );
37 extern const char *wine_dbgstr_wn( const wchar_t *s, int n );
38 extern const char *wine_dbgstr_guid( const struct _GUID *id );
39 extern const char *wine_dbgstr_longlong( unsigned long long ll );
40 extern const char *wine_dbg_sprintf( const char *format, ... );
41
42 inline static const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); }
43 inline static const char *debugstr_wn( const wchar_t *s, int n ) { return wine_dbgstr_wn( s, n ); }
44 inline static const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); }
45 inline static const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, 80 ); }
46 inline static const char *debugstr_w( const wchar_t *s ) { return wine_dbgstr_wn( s, 80 ); }
47 inline static const char *debugres_a( const char *s ) { return wine_dbgstr_an( s, 80 ); }
48 inline static const char *debugres_w( const wchar_t *s ) { return wine_dbgstr_wn( s, 80 ); }
49
50 static inline const char *wine_dbgstr_point( const POINT *pt )
51 {
52 if (!pt) return "(null)";
53 return wine_dbg_sprintf( "(%ld,%ld)", pt->x, pt->y );
54 }
55
56 static inline const char *wine_dbgstr_size( const SIZE *size )
57 {
58 if (!size) return "(null)";
59 return wine_dbg_sprintf( "(%ld,%ld)", size->cx, size->cy );
60 }
61
62 static inline const char *wine_dbgstr_rect( const RECT *rect )
63 {
64 if (!rect) return "(null)";
65 return wine_dbg_sprintf( "(%ld,%ld)-(%ld,%ld)", rect->left, rect->top, rect->right, rect->bottom );
66 }
67
68 #define TRACE DPRINT
69 #define TRACE_(ch) DPRINT
70 #ifdef NDEBUG
71 #define TRACE_ON(ch) 0
72 #else
73 #define TRACE_ON(ch) 1
74 #endif
75
76 #define WINE_TRACE DPRINT
77 #define WINE_TRACE_(ch) DPRINT
78 #ifdef NDEBUG
79 #define WINE_TRACE_ON(ch) 0
80 #else
81 #define WINE_TRACE_ON(ch) 1
82 #endif
83
84 #define WARN DPRINT
85 #define WARN_(ch) DPRINT
86 #ifdef NDEBUG
87 #define WARN_ON(ch) 0
88 #else
89 #define WARN_ON(ch) 1
90 #endif
91
92 #ifdef FIXME
93 #undef FIXME
94 #endif
95 #define FIXME DPRINT1
96 #define FIXME_(ch) DPRINT1
97 #ifdef NDEBUG
98 #define FIXME_ON(ch) 0
99 #else
100 #define FIXME_ON(ch) 1
101 #endif
102
103 #ifdef WINE_FIXME
104 #undef WINE_FIXME
105 #endif
106 #define WINE_FIXME DPRINT1
107 #define WINE_FIXME_(ch) DPRINT1
108 #ifdef NDEBUG
109 #define WINE_FIXME_ON(ch) 0
110 #else
111 #define WINE_FIXME_ON(ch) 1
112 #endif
113
114 #define ERR DPRINT1
115 #define ERR_(ch) DPRINT1
116 #ifdef NDEBUG
117 #define ERR_ON(ch) 0
118 #else
119 #define ERR_ON(ch) 1
120 #endif
121
122 #define WINE_ERR DPRINT1
123 #define WINE_ERR_(ch) DPRINT1
124 #ifdef NDEBUG
125 #define WINE_ERR_ON(ch) 0
126 #else
127 #define WINE_ERR_ON(ch) 1
128 #endif
129
130 #define DECLARE_DEBUG_CHANNEL(ch)
131 #define DEFAULT_DEBUG_CHANNEL(ch)
132
133 #define WINE_DECLARE_DEBUG_CHANNEL(ch) DECLARE_DEBUG_CHANNEL(ch)
134 #define WINE_DEFAULT_DEBUG_CHANNEL(ch) DEFAULT_DEBUG_CHANNEL(ch)
135
136 #define DPRINTF DPRINT
137 #define MESSAGE DPRINT
138
139 #endif /* __WINE_DEBUG_H */