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