2 #ifndef __WINE_DEBUGTOOLS_H
3 #define __WINE_DEBUGTOOLS_H
5 #ifdef __WINE__ /* Debugging interface is internal to Wine */
13 #define DEBUG_CLASS_COUNT 4
15 extern short debug_msg_enabled[][DEBUG_CLASS_COUNT];
17 #define dbg_str(name) debug_str_##name
18 #define dbg_buf(name) debug_buf_##name
20 #define dbg_decl_str(name, size) \
21 char dbg_str(name)[size], *dbg_buf(name)=dbg_str(name)
23 #define dbg_reset_str(name) \
24 dbg_buf(name)=dbg_str(name)
26 #define dsprintf(name, format, args...) \
27 dbg_buf(name)+=sprintf(dbg_buf(name), format, ## args)
29 #define dbg_ch_index(ch) (dbch_##ch)
30 #define dbg_cl_index(cl) (dbcl_##cl)
32 #define DEBUGGING(cl, ch) \
33 (dbg_ch_index(ch) >=0 && dbg_cl_index(cl) >= 0 && \
34 debug_msg_enabled[dbg_ch_index(ch)][dbg_cl_index(cl)])
36 #define DPRINTF(format, args...) fprintf(stddeb, format, ## args)
38 #define DPRINTF_(cl, ch, format, args...) \
39 if(!DEBUGGING(cl, ch)) ; \
40 else DPRINTF(# cl ":" # ch ":%s " format, __FUNCTION__ , ## args)
42 #define TRACE(ch, fmt, args...) DPRINTF_(trace, ch, fmt, ## args)
43 #define WARN(ch, fmt, args...) DPRINTF_(warn, ch, fmt, ## args)
44 #define FIXME(ch, fmt, args...) DPRINTF_(fixme, ch, fmt, ## args)
45 #define ERR(ch, fmt, args...) DPRINTF_(err, ch, fmt, ## args)
47 #define DUMP(format, args...) DPRINTF(format, ## args)
48 #define MSG(format, args...) fprintf(stderr, format, ## args)
50 #define FIXME_ON(ch) DEBUGGING(fixme, ch)
51 #define ERR_ON(ch) DEBUGGING(err, ch)
52 #define WARN_ON(ch) DEBUGGING(warn, ch)
53 #define TRACE_ON(ch) DEBUGGING(trace, ch)
57 #endif /* __WINE_DEBUGTOOLS_H */