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

Last change on this file since 2341 was 2341, checked in by sandervl, 26 years ago

header updates

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