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