2 #ifndef __WINE_DEBUGTOOLS_H
3 #define __WINE_DEBUGTOOLS_H
5 #ifdef __WINE__ /* Debugging interface is internal to Wine */
13 /* Internal definitions (do not use these directly) */
15 enum __DEBUG_CLASS
{ __DBCL_FIXME
, __DBCL_ERR
, __DBCL_WARN
, __DBCL_TRACE
, __DBCL_COUNT
};
17 extern char __debug_msg_enabled
[][__DBCL_COUNT
];
19 extern const char * const debug_cl_name
[__DBCL_COUNT
];
20 extern const char * const debug_ch_name
[];
22 #define __GET_DEBUGGING(dbcl,dbch) (__debug_msg_enabled[(dbch)][(dbcl)])
23 #define __SET_DEBUGGING(dbcl,dbch,on) (__debug_msg_enabled[(dbch)][(dbcl)] = (on))
26 #define __FUNCTION__ ""
29 #define __DPRINTF(dbcl,dbch) \
30 (!__GET_DEBUGGING(dbcl,dbch) || \
31 (dbg_printf("%s:%s:%s ", debug_cl_name[(dbcl)], debug_ch_name[(dbch)], __FUNCTION__),0)) \
34 #define __DUMMY_DPRINTF 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
37 /* Exported definitions and macros */
39 /* use configure to allow user to compile out debugging messages */
41 #define TRACE __DPRINTF(__DBCL_TRACE,*DBCH_DEFAULT)
42 #define TRACE_(ch) __DPRINTF(__DBCL_TRACE,dbch_##ch)
43 #define TRACE_ON(ch) __GET_DEBUGGING(__DBCL_TRACE,dbch_##ch)
45 #define TRACE __DUMMY_DPRINTF
46 #define TRACE_(ch) __DUMMY_DPRINTF
47 #define TRACE_ON(ch) 0
48 #endif /* NO_TRACE_MSGS */
51 #define WARN __DPRINTF(__DBCL_WARN,*DBCH_DEFAULT)
52 #define WARN_(ch) __DPRINTF(__DBCL_WARN,dbch_##ch)
53 #define WARN_ON(ch) __GET_DEBUGGING(__DBCL_WARN,dbch_##ch)
54 #define FIXME __DPRINTF(__DBCL_FIXME,*DBCH_DEFAULT)
55 #define FIXME_(ch) __DPRINTF(__DBCL_FIXME,dbch_##ch)
56 #define FIXME_ON(ch) __GET_DEBUGGING(__DBCL_FIXME,dbch_##ch)
58 #define WARN __DUMMY_DPRINTF
59 #define WARN_(ch) __DUMMY_DPRINTF
61 #define FIXME __DUMMY_DPRINTF
62 #define FIXME_(ch) __DUMMY_DPRINTF
63 #define FIXME_ON(ch) 0
64 #endif /* NO_DEBUG_MSGS */
66 /* define error macro regardless of what is configured */
67 /* Solaris got an 'ERR' define in <sys/reg.h> */
69 #define ERR __DPRINTF(__DBCL_ERR,*DBCH_DEFAULT)
70 #define ERR_(ch) __DPRINTF(__DBCL_ERR,dbch_##ch)
71 #define ERR_ON(ch) __GET_DEBUGGING(__DBCL_ERR,dbch_##ch)
73 #define DECLARE_DEBUG_CHANNEL(ch) \
74 extern const int dbch_##ch;
75 #define DEFAULT_DEBUG_CHANNEL(ch) \
76 extern const int dbch_##ch; static const int *const DBCH_DEFAULT = &dbch_##ch;
78 #define DPRINTF dbg_printf
79 #define MESSAGE dbg_printf
83 #endif /* __WINE_DEBUGTOOLS_H */