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

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

Fix: broken build in SHELL32

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