Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 1 | |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 2 | #ifndef __WINE_DEBUGTOOLS_H |
| 3 | #define __WINE_DEBUGTOOLS_H |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 4 | |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 5 | #ifdef __WINE__ /* Debugging interface is internal to Wine */ |
| 6 | |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 7 | #include <stdio.h> |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 8 | #include "debugstr.h" |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 9 | |
| 10 | #define DEBUG_RUNTIME |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 11 | #define stddeb stderr |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 12 | |
| 13 | #define DEBUG_CLASS_COUNT 4 |
| 14 | |
| 15 | extern short debug_msg_enabled[][DEBUG_CLASS_COUNT]; |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 16 | |
| 17 | #define dbg_str(name) debug_str_##name |
| 18 | #define dbg_buf(name) debug_buf_##name |
| 19 | |
| 20 | #define dbg_decl_str(name, size) \ |
| 21 | char dbg_str(name)[size], *dbg_buf(name)=dbg_str(name) |
| 22 | |
| 23 | #define dbg_reset_str(name) \ |
| 24 | dbg_buf(name)=dbg_str(name) |
| 25 | |
| 26 | #define dsprintf(name, format, args...) \ |
| 27 | dbg_buf(name)+=sprintf(dbg_buf(name), format, ## args) |
| 28 | |
| 29 | #define dbg_ch_index(ch) (dbch_##ch) |
| 30 | #define dbg_cl_index(cl) (dbcl_##cl) |
| 31 | |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 32 | #define DEBUGGING(cl, ch) \ |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 33 | (dbg_ch_index(ch) >=0 && dbg_cl_index(cl) >= 0 && \ |
| 34 | debug_msg_enabled[dbg_ch_index(ch)][dbg_cl_index(cl)]) |
| 35 | |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 36 | #define DPRINTF(format, args...) fprintf(stddeb, format, ## args) |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 37 | |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 38 | #define DPRINTF_(cl, ch, format, args...) \ |
| 39 | if(!DEBUGGING(cl, ch)) ; \ |
| 40 | else DPRINTF(# cl ":" # ch ":%s " format, __FUNCTION__ , ## args) |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 41 | |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 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) |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 46 | |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 47 | #define DUMP(format, args...) DPRINTF(format, ## args) |
| 48 | #define MSG(format, args...) fprintf(stderr, format, ## args) |
| 49 | |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 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) |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 54 | |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 55 | #endif /* __WINE__ */ |
| 56 | |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 57 | #endif /* __WINE_DEBUGTOOLS_H */ |