xref: /haiku/headers/private/media/MediaDebug.h (revision c237c4ce593ee823d9867fd997e51e4c447f5623)
1 #ifndef _MEDIA_DEBUG_OLD_H_
2 #define _MEDIA_DEBUG_OLD_H_
3 
4 #ifndef DEBUG
5   #define DEBUG 0
6 #endif
7 
8 #include <Debug.h>
9 #include <stdio.h>
10 
11 #undef TRACE
12 #undef PRINT
13 
14 #if DEBUG > 0
15 
16   #define UNIMPLEMENTED()		printf("UNIMPLEMENTED %s\n",__PRETTY_FUNCTION__)
17   inline void ERROR(const char *fmt, ...) { va_list ap; va_start(ap, fmt); printf("### ERROR: "); vprintf(fmt, ap); va_end(ap); }
18   inline void PRINT(int level, const char *fmt, ...) { va_list ap; if (level > DEBUG) return; va_start(ap, fmt); vprintf(fmt, ap); va_end(ap); }
19 
20   #define PRINT_FORMAT(_text, _fmt)	do { char _buf[300]; string_for_format((_fmt), _buf, sizeof(_buf)); printf("%s %s\n", (_text), (_buf)); } while (0)
21   #define PRINT_INPUT(_text, _in) 	do { char _buf[300]; string_for_format((_in).format, _buf, sizeof(_buf)); printf("%s node(node %" B_PRId32 ", port %" B_PRId32 "); source(port %" B_PRId32 ", id %" B_PRId32 "); dest(port %" B_PRId32 ", id %" B_PRId32 "); fmt(%s); name(%s)\n", (_text), (_in).node.node, (_in).node.port, (_in).source.port, (_in).source.id, (_in).destination.port, (_in).destination.id, _buf, (_in).name); } while (0)
22   #define PRINT_OUTPUT(_text, _out)	do { char _buf[300]; string_for_format((_out).format, _buf, sizeof(_buf)); printf("%s node(node %" B_PRId32 ", port %" B_PRId32 "); source(port %" B_PRId32 ", id %" B_PRId32 "); dest(port %" B_PRId32 ", id %" B_PRId32 "); fmt(%s); name(%s)\n", (_text), (_out).node.node, (_out).node.port, (_out).source.port, (_out).source.id, (_out).destination.port, (_out).destination.id, _buf, (_out).name); } while (0)
23 
24   #if DEBUG >= 2
25 	#define BROKEN()			printf("BROKEN %s\n",__PRETTY_FUNCTION__)
26 	#define TRACE 				printf
27   #else
28   	#define BROKEN()			((void)0)
29 	#define TRACE(a...)			((void)0)
30   #endif
31 
32   #if DEBUG >= 3
33 	#define CALLED() 			printf("CALLED %s\n",__PRETTY_FUNCTION__)
34   #else
35   	#define CALLED() 			((void)0)
36   #endif
37 
38 #else
39 
40 	#define PRINT_FORMAT(_text, _fmt)	((void)0)
41 	#define PRINT_INPUT(_text, _in)		((void)0)
42 	#define PRINT_OUTPUT(_text, _out)	((void)0)
43 	#define UNIMPLEMENTED() 			printf("UNIMPLEMENTED %s\n",__PRETTY_FUNCTION__)
44 	#define BROKEN()					((void)0)
45 	#define CALLED()					((void)0)
46 	#define PRINT(l, a...)				((void)0)
47 	#define ERROR(a...)					fprintf(stderr, a)
48 	#define TRACE(a...)					((void)0)
49 
50 #endif
51 
52 #endif /* _MEDIA_DEBUG_H_ */
53