465f9faa83619d52a08ac2e710ef03a7063e2568
[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(args...)
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_an( const char * s, int n );
39 extern const char *wine_dbgstr_wn( const wchar_t *s, int n );
40 extern const char *wine_dbgstr_guid( const struct _GUID *id );
41 extern const char *wine_dbgstr_longlong( unsigned long long ll );
42 extern const char *wine_dbg_sprintf( const char *format, ... );
43
44 inline static const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); }
45 inline static const char *debugstr_wn( const wchar_t *s, int n ) { return wine_dbgstr_wn( s, n ); }
46 inline static const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); }
47 inline static const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, 80 ); }
48 inline static const char *debugstr_w( const wchar_t *s ) { return wine_dbgstr_wn( s, 80 ); }
49 inline static const char *debugres_a( const char *s ) { return wine_dbgstr_an( s, 80 ); }
50 inline static const char *debugres_w( const wchar_t *s ) { return wine_dbgstr_wn( s, 80 ); }
51
52 static inline const char *wine_dbgstr_point( const POINT *pt )
53 {
54 if (!pt) return "(null)";
55 return wine_dbg_sprintf( "(%ld,%ld)", pt->x, pt->y );
56 }
57
58 static inline const char *wine_dbgstr_size( const SIZE *size )
59 {
60 if (!size) return "(null)";
61 return wine_dbg_sprintf( "(%ld,%ld)", size->cx, size->cy );
62 }
63
64 static inline const char *wine_dbgstr_rect( const RECT *rect )
65 {
66 if (!rect) return "(null)";
67 return wine_dbg_sprintf( "(%ld,%ld)-(%ld,%ld)", rect->left, rect->top, rect->right, rect->bottom );
68 }
69
70 #define TRACE DPRINT
71 #define TRACE_(ch) DPRINT
72 #ifdef NDEBUG
73 #define TRACE_ON(ch) 0
74 #else
75 #define TRACE_ON(ch) 1
76 #endif
77
78 #define WINE_TRACE DPRINT
79 #define WINE_TRACE_(ch) DPRINT
80 #ifdef NDEBUG
81 #define WINE_TRACE_ON(ch) 0
82 #else
83 #define WINE_TRACE_ON(ch) 1
84 #endif
85
86 #define WARN DPRINT
87 #define WARN_(ch) DPRINT
88 #ifdef NDEBUG
89 #define WARN_ON(ch) 0
90 #else
91 #define WARN_ON(ch) 1
92 #endif
93
94 #ifdef FIXME
95 #undef FIXME
96 #endif
97 #define FIXME DPRINT1
98 #define FIXME_(ch) DPRINT1
99 #ifdef NDEBUG
100 #define FIXME_ON(ch) 0
101 #else
102 #define FIXME_ON(ch) 1
103 #endif
104
105 #ifdef WINE_FIXME
106 #undef WINE_FIXME
107 #endif
108 #define WINE_FIXME DPRINT1
109 #define WINE_FIXME_(ch) DPRINT1
110 #ifdef NDEBUG
111 #define WINE_FIXME_ON(ch) 0
112 #else
113 #define WINE_FIXME_ON(ch) 1
114 #endif
115
116 #define ERR DPRINT1
117 #define ERR_(ch) DPRINT1
118 #ifdef NDEBUG
119 #define ERR_ON(ch) 0
120 #else
121 #define ERR_ON(ch) 1
122 #endif
123
124 #define WINE_ERR DPRINT1
125 #define WINE_ERR_(ch) DPRINT1
126 #ifdef NDEBUG
127 #define WINE_ERR_ON(ch) 0
128 #else
129 #define WINE_ERR_ON(ch) 1
130 #endif
131
132 #define DECLARE_DEBUG_CHANNEL(ch)
133 #define DEFAULT_DEBUG_CHANNEL(ch)
134
135 #define WINE_DECLARE_DEBUG_CHANNEL(ch) DECLARE_DEBUG_CHANNEL(ch)
136 #define WINE_DEFAULT_DEBUG_CHANNEL(ch) DEFAULT_DEBUG_CHANNEL(ch)
137
138 #define DPRINTF DPRINT
139 #define MESSAGE DPRINT
140
141 #endif /* __WINE_DEBUG_H */