annotate loader/wine/debugtools.h @ 9968:c372140a1012

mingw32 support patch by Diego Biurrun with some changes made by me
author alex
date Mon, 21 Apr 2003 21:07:35 +0000
parents 3b5f5d1c5041
children 251338cf2f58
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 #ifndef __WINE_DEBUGTOOLS_H
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 #define __WINE_DEBUGTOOLS_H
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 #ifdef __WINE__ /* Debugging interface is internal to Wine */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 #include <stdarg.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 #include "config.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 #include "windef.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 struct _GUID;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 /* Internal definitions (do not use these directly) */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL_COUNT };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 #ifndef NO_TRACE_MSGS
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 # define __GET_DEBUGGING_trace(dbch) ((dbch)[0] & (1 << __DBCL_TRACE))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 #else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 # define __GET_DEBUGGING_trace(dbch) 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 #ifndef NO_DEBUG_MSGS
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 # define __GET_DEBUGGING_warn(dbch) ((dbch)[0] & (1 << __DBCL_WARN))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 # define __GET_DEBUGGING_fixme(dbch) ((dbch)[0] & (1 << __DBCL_FIXME))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 #else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 # define __GET_DEBUGGING_warn(dbch) 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 # define __GET_DEBUGGING_fixme(dbch) 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 /* define error macro regardless of what is configured */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 #define __GET_DEBUGGING_err(dbch) ((dbch)[0] & (1 << __DBCL_ERR))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 #define __GET_DEBUGGING(dbcl,dbch) __GET_DEBUGGING_##dbcl(dbch)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 #define __SET_DEBUGGING(dbcl,dbch,on) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 ((on) ? ((dbch)[0] |= 1 << (dbcl)) : ((dbch)[0] &= ~(1 << (dbcl))))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 #ifndef __GNUC__
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 #define __FUNCTION__ ""
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 #define __DPRINTF(dbcl,dbch) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 (!__GET_DEBUGGING(dbcl,(dbch)) || (dbg_header_##dbcl((dbch),__FUNCTION__),0)) ? \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 (void)0 : (void)dbg_printf
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46 /* Exported definitions and macros */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 /* These function return a printable version of a string, including
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49 quotes. The string will be valid for some time, but not indefinitely
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 as strings are re-used. */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 extern LPCSTR debugstr_an (LPCSTR s, int n);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 extern LPCSTR debugstr_wn (LPCWSTR s, int n);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 extern LPCSTR debugres_a (LPCSTR res);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 extern LPCSTR debugres_w (LPCWSTR res);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 extern LPCSTR debugstr_guid( const struct _GUID *id );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 extern LPCSTR debugstr_hex_dump (const void *ptr, int len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 extern int dbg_header_err( const char *dbg_channel, const char *func );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 extern int dbg_header_warn( const char *dbg_channel, const char *func );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59 extern int dbg_header_fixme( const char *dbg_channel, const char *func );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 extern int dbg_header_trace( const char *dbg_channel, const char *func );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 extern int dbg_vprintf( const char *format, va_list args );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 static inline LPCSTR debugstr_a( LPCSTR s ) { return debugstr_an( s, 80 ); }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 static inline LPCSTR debugstr_w( LPCWSTR s ) { return debugstr_wn( s, 80 ); }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 #ifdef __GNUC__
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 extern int dbg_printf(const char *format, ...) __attribute__((format (printf,1,2)));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 #else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 extern int dbg_printf(const char *format, ...);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 #define TRACE_(X) TRACE
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 #define WARN_(X) TRACE
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 #define WARN TRACE
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 #define ERR_(X) printf
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 #define ERR printf
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 #define FIXME_(X) TRACE
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 #define FIXME TRACE
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 #define TRACE_ON(X) 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 #define ERR_ON(X) 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 #define DECLARE_DEBUG_CHANNEL(ch) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 extern char dbch_##ch[];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 #define DEFAULT_DEBUG_CHANNEL(ch) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 extern char dbch_##ch[]; static char * const __dbch_default = dbch_##ch;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 #define DPRINTF dbg_printf
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 #define MESSAGE dbg_printf
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 #endif /* __WINE__ */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 #endif /* __WINE_DEBUGTOOLS_H */