2 #ifndef __WINE_DEBUGTOOLS_H
3 #define __WINE_DEBUGTOOLS_H
5 #ifdef __WINE__ /* Debugging interface is internal to Wine */
14 #define DEBUG_CLASS_COUNT 4
16 extern short debug_msg_enabled
[][DEBUG_CLASS_COUNT
];
18 #define dbg_str(name) debug_str_##name
19 #define dbg_buf(name) debug_buf_##name
21 #define dbg_decl_str(name, size) \
22 char dbg_str(name)[size], *dbg_buf(name)=dbg_str(name)
24 #define dbg_reset_str(name) \
25 dbg_buf(name)=dbg_str(name)
27 #define dsprintf(name, format, args...) \
28 dbg_buf(name)+=sprintf(dbg_buf(name), format, ## args)
30 #define dbg_ch_index(ch) (dbch_##ch)
31 #define dbg_cl_index(cl) (dbcl_##cl)
33 #define DEBUGGING(cl, ch) \
34 (dbg_ch_index(ch) >=0 && dbg_cl_index(cl) >= 0 && \
35 debug_msg_enabled[dbg_ch_index(ch)][dbg_cl_index(cl)])
37 #define DPRINTF(format, args...) fprintf(stddeb, format, ## args)
39 #define DPRINTF_(cl, ch, format, args...) \
40 do {if(!DEBUGGING(cl, ch)) ; \
41 else DPRINTF(# cl ":" # ch ":%s " format, __FUNCTION__ , ## args); } while (0)
43 /* use configure to allow user to compile out debugging messages */
46 #define TRACE(ch, fmt, args...) DPRINTF_(trace, ch, fmt, ## args)
48 #define TRACE(ch, fmt, args...) do { } while (0)
49 #endif /* NO_TRACE_MSGS */
52 #define WARN(ch, fmt, args...) DPRINTF_(warn, ch, fmt, ## args)
53 #define FIXME(ch, fmt, args...) DPRINTF_(fixme, ch, fmt, ## args)
54 #define DUMP(format, args...) DPRINTF(format, ## args)
56 #define WARN(ch, fmt, args...) do { } while (0)
57 #define FIXME(ch, fmt, args...) do { } while (0)
58 #define DUMP(format, args...) do { } while (0)
59 #endif /* NO_DEBUG_MSGS */
61 /* define error macro regardless of what is configured */
62 #define ERR(ch, fmt, args...) DPRINTF_(err, ch, fmt, ## args)
63 #define MSG(format, args...) fprintf(stderr, format, ## args)
65 /* if the debug message is compiled out, make these return false */
67 #define TRACE_ON(ch) DEBUGGING(trace, ch)
69 #define TRACE_ON(ch) 0
70 #endif /* NO_TRACE_MSGS */
73 #define WARN_ON(ch) DEBUGGING(warn, ch)
74 #define FIXME_ON(ch) DEBUGGING(fixme, ch)
77 #define FIXME_ON(ch) 0
78 #endif /* NO_DEBUG_MSGS */
80 #define ERR_ON(ch) DEBUGGING(err, ch)
84 #endif /* __WINE_DEBUGTOOLS_H */