1 #ifndef MPLAYER_DEBUGTOOLS_H
2 #define MPLAYER_DEBUGTOOLS_H
10 /* Internal definitions (do not use these directly) */
12 enum DEBUG_CLASS
{ DBCL_FIXME
, DBCL_ERR
, DBCL_WARN
, DBCL_TRACE
, DBCL_COUNT
};
15 # define GET_DEBUGGING_trace(dbch) ((dbch)[0] & (1 << DBCL_TRACE))
17 # define GET_DEBUGGING_trace(dbch) 0
21 # define GET_DEBUGGING_warn(dbch) ((dbch)[0] & (1 << DBCL_WARN))
22 # define GET_DEBUGGING_fixme(dbch) ((dbch)[0] & (1 << DBCL_FIXME))
24 # define GET_DEBUGGING_warn(dbch) 0
25 # define GET_DEBUGGING_fixme(dbch) 0
28 /* define error macro regardless of what is configured */
29 #define GET_DEBUGGING_err(dbch) ((dbch)[0] & (1 << DBCL_ERR))
31 #define GET_DEBUGGING(dbcl,dbch) GET_DEBUGGING_##dbcl(dbch)
32 #define SET_DEBUGGING(dbcl,dbch,on) \
33 ((on) ? ((dbch)[0] |= 1 << (dbcl)) : ((dbch)[0] &= ~(1 << (dbcl))))
35 /* Exported definitions and macros */
37 /* These function return a printable version of a string, including
38 quotes. The string will be valid for some time, but not indefinitely
39 as strings are re-used. */
40 LPCSTR
debugstr_an( LPCSTR s
, int n
);
41 LPCSTR
debugstr_wn( LPCWSTR s
, int n
);
42 LPCSTR
debugres_a( LPCSTR res
);
43 LPCSTR
debugres_w( LPCWSTR res
);
44 LPCSTR
debugstr_guid( const struct GUID
*id
);
45 LPCSTR
debugstr_hex_dump( const void *ptr
, int len
);
46 int dbg_header_err( const char *dbg_channel
, const char *func
);
47 int dbg_header_warn( const char *dbg_channel
, const char *func
);
48 int dbg_header_fixme( const char *dbg_channel
, const char *func
);
49 int dbg_header_trace( const char *dbg_channel
, const char *func
);
50 int dbg_vprintf( const char *format
, va_list args
);
52 static inline LPCSTR
debugstr_a( LPCSTR s
) { return debugstr_an( s
, 80 ); }
53 static inline LPCSTR
debugstr_w( LPCWSTR s
) { return debugstr_wn( s
, 80 ); }
55 #define TRACE_(X) TRACE
56 #define WARN_(X) TRACE
58 #define ERR_(X) printf
60 #define FIXME_(X) TRACE
66 #define DECLARE_DEBUG_CHANNEL(ch) \
67 extern char dbch_##ch[];
68 #define DEFAULT_DEBUG_CHANNEL(ch) \
69 extern char dbch_##ch[]; static char * const __dbch_default = dbch_##ch;
71 #endif /* MPLAYER_DEBUGTOOLS_H */