More Escapes for the PostScript driver.
[wine.git] / include / debugtools.h
blob42167537999b2fdc1a6fb79873e6a0fbc8cf67c7
2 #ifndef __WINE_DEBUGTOOLS_H
3 #define __WINE_DEBUGTOOLS_H
5 #ifdef __WINE__ /* Debugging interface is internal to Wine */
7 #include <stdio.h>
8 #include "config.h"
9 #include "debugstr.h"
11 #define DEBUG_RUNTIME
12 #define stddeb stderr
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 */
45 #ifndef NO_TRACE_MSGS
46 #define TRACE(ch, fmt, args...) DPRINTF_(trace, ch, fmt, ## args)
47 #else
48 #define TRACE(ch, fmt, args...) do { } while (0)
49 #endif /* NO_TRACE_MSGS */
51 #ifndef NO_DEBUG_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)
55 #else
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 /* Solaris got an 'ERR' define in <sys/reg.h> */
63 #undef ERR
64 #define ERR(ch, fmt, args...) DPRINTF_(err, ch, fmt, ## args)
65 #define MSG(format, args...) fprintf(stderr, format, ## args)
67 /* if the debug message is compiled out, make these return false */
68 #ifndef NO_TRACE_MSGS
69 #define TRACE_ON(ch) DEBUGGING(trace, ch)
70 #else
71 #define TRACE_ON(ch) 0
72 #endif /* NO_TRACE_MSGS */
74 #ifndef NO_DEBUG_MSGS
75 #define WARN_ON(ch) DEBUGGING(warn, ch)
76 #define FIXME_ON(ch) DEBUGGING(fixme, ch)
77 #else
78 #define WARN_ON(ch) 0
79 #define FIXME_ON(ch) 0
80 #endif /* NO_DEBUG_MSGS */
82 #define ERR_ON(ch) DEBUGGING(err, ch)
84 #endif /* __WINE__ */
86 #endif /* __WINE_DEBUGTOOLS_H */