source: trunk/include/win/debugtools.h@ 785

Last change on this file since 785 was 785, checked in by phaller, 26 years ago

Fix: fixes in WINE macros and dependencies

File size: 2.6 KB
Line 
1
2#ifndef __WINE_DEBUGTOOLS_H
3#define __WINE_DEBUGTOOLS_H
4
5#ifdef __WINE__ /* Debugging interface is internal to Wine */
6
7#include <stdio.h>
8#include "config.h"
9#include "debugstr.h"
10
11#define DEBUG_RUNTIME
12
13/* Internal definitions (do not use these directly) */
14
15enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL_COUNT };
16
17extern char __debug_msg_enabled[][__DBCL_COUNT];
18
19extern const char * const debug_cl_name[__DBCL_COUNT];
20extern const char * const debug_ch_name[];
21
22#define __GET_DEBUGGING(dbcl,dbch) (__debug_msg_enabled[(dbch)][(dbcl)])
23#define __SET_DEBUGGING(dbcl,dbch,on) (__debug_msg_enabled[(dbch)][(dbcl)] = (on))
24
25#define __DPRINTF(dbcl,dbch) \
26 (!__GET_DEBUGGING(dbcl,dbch) || \
27 (dprintf(("%s:%s:%s ", debug_cl_name[(dbcl)], debug_ch_name[(dbch)], __line__)),0)) \
28 ? 0 : WriteLog
29
30#define __DUMMY_DPRINTF 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
31
32
33/* Exported definitions and macros */
34
35/* use configure to allow user to compile out debugging messages */
36#ifndef NO_TRACE_MSGS
37#define TRACE __DPRINTF(__DBCL_TRACE,*DBCH_DEFAULT)
38#define TRACE_(ch) __DPRINTF(__DBCL_TRACE,dbch_##ch)
39#define TRACE_ON(ch) __GET_DEBUGGING(__DBCL_TRACE,dbch_##ch)
40#else
41#define TRACE __DUMMY_DPRINTF
42#define TRACE_(ch) __DUMMY_DPRINTF
43#define TRACE_ON(ch) 0
44#endif /* NO_TRACE_MSGS */
45
46#ifndef NO_DEBUG_MSGS
47#define WARN __DPRINTF(__DBCL_WARN,*DBCH_DEFAULT)
48#define WARN_(ch) __DPRINTF(__DBCL_WARN,dbch_##ch)
49#define WARN_ON(ch) __GET_DEBUGGING(__DBCL_WARN,dbch_##ch)
50#define FIXME __DPRINTF(__DBCL_FIXME,*DBCH_DEFAULT)
51#define FIXME_(ch) __DPRINTF(__DBCL_FIXME,dbch_##ch)
52#define FIXME_ON(ch) __GET_DEBUGGING(__DBCL_FIXME,dbch_##ch)
53#else
54#define WARN __DUMMY_DPRINTF
55#define WARN_(ch) __DUMMY_DPRINTF
56#define WARN_ON(ch) 0
57#define FIXME __DUMMY_DPRINTF
58#define FIXME_(ch) __DUMMY_DPRINTF
59#define FIXME_ON(ch) 0
60#endif /* NO_DEBUG_MSGS */
61
62/* define error macro regardless of what is configured */
63/* Solaris got an 'ERR' define in <sys/reg.h> */
64#undef ERR
65#define ERR __DPRINTF(__DBCL_ERR,*DBCH_DEFAULT)
66#define ERR_(ch) __DPRINTF(__DBCL_ERR,dbch_##ch)
67#define ERR_ON(ch) __GET_DEBUGGING(__DBCL_ERR,dbch_##ch)
68
69#define DECLARE_DEBUG_CHANNEL(ch) \
70 extern const int dbch_##ch;
71#define DEFAULT_DEBUG_CHANNEL(ch) \
72 extern const int dbch_##ch; static const int *const DBCH_DEFAULT = &dbch_##ch;
73
74#define DPRINTF dbg_printf
75#define MESSAGE dbg_printf
76
77#endif /* __WINE__ */
78
79#ifdef __WIN32OS2__
80# undef TRACE
81# define TRACE WriteLog
82# undef FIXME
83# define FIXME WriteLog
84# undef WARN
85# define WARN WriteLog
86#endif
87
88
89#endif /* __WINE_DEBUGTOOLS_H */
Note: See TracBrowser for help on using the repository browser.