14b095722SMarcus Overhagen#ifndef _MEDIA_DEBUG_OLD_H_
24b095722SMarcus Overhagen#define _MEDIA_DEBUG_OLD_H_
34b095722SMarcus Overhagen
44b095722SMarcus Overhagen#ifndef DEBUG
5b84955d4SBarrett  #define DEBUG 0
64b095722SMarcus Overhagen#endif
74b095722SMarcus Overhagen
84b095722SMarcus Overhagen#include <Debug.h>
94b095722SMarcus Overhagen#include <stdio.h>
104b095722SMarcus Overhagen
114b095722SMarcus Overhagen#undef TRACE
124b095722SMarcus Overhagen#undef PRINT
134b095722SMarcus Overhagen
144b095722SMarcus Overhagen#if DEBUG > 0
154b095722SMarcus Overhagen
164b095722SMarcus Overhagen  #define UNIMPLEMENTED()		printf("UNIMPLEMENTED %s\n",__PRETTY_FUNCTION__)
174b095722SMarcus Overhagen  inline void ERROR(const char *fmt, ...) { va_list ap; va_start(ap, fmt); printf("### ERROR: "); vprintf(fmt, ap); va_end(ap); }
184b095722SMarcus Overhagen  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); }
194b095722SMarcus Overhagen
204b095722SMarcus Overhagen  #define PRINT_FORMAT(_text, _fmt)	do { char _buf[300]; string_for_format((_fmt), _buf, sizeof(_buf)); printf("%s %s\n", (_text), (_buf)); } while (0)
21b84955d4SBarrett  #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)
22b84955d4SBarrett  #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)
234b095722SMarcus Overhagen
244b095722SMarcus Overhagen  #if DEBUG >= 2
254b095722SMarcus Overhagen	#define BROKEN()			printf("BROKEN %s\n",__PRETTY_FUNCTION__)
264b095722SMarcus Overhagen	#define TRACE 				printf
274b095722SMarcus Overhagen  #else
284b095722SMarcus Overhagen  	#define BROKEN()			((void)0)
294b095722SMarcus Overhagen	#define TRACE(a...)			((void)0)
304b095722SMarcus Overhagen  #endif
314b095722SMarcus Overhagen
324b095722SMarcus Overhagen  #if DEBUG >= 3
334b095722SMarcus Overhagen	#define CALLED() 			printf("CALLED %s\n",__PRETTY_FUNCTION__)
344b095722SMarcus Overhagen  #else
354b095722SMarcus Overhagen  	#define CALLED() 			((void)0)
364b095722SMarcus Overhagen  #endif
374b095722SMarcus Overhagen
384b095722SMarcus Overhagen#else
394b095722SMarcus Overhagen
404b095722SMarcus Overhagen	#define PRINT_FORMAT(_text, _fmt)	((void)0)
414b095722SMarcus Overhagen	#define PRINT_INPUT(_text, _in)		((void)0)
424b095722SMarcus Overhagen	#define PRINT_OUTPUT(_text, _out)	((void)0)
43b84955d4SBarrett	#define UNIMPLEMENTED() 			printf("UNIMPLEMENTED %s\n",__PRETTY_FUNCTION__)
444b095722SMarcus Overhagen	#define BROKEN()					((void)0)
454b095722SMarcus Overhagen	#define CALLED()					((void)0)
464b095722SMarcus Overhagen	#define PRINT(l, a...)				((void)0)
47b84955d4SBarrett	#define ERROR(a...)					fprintf(stderr, a)
484b095722SMarcus Overhagen	#define TRACE(a...)					((void)0)
494b095722SMarcus Overhagen
504b095722SMarcus Overhagen#endif
514b095722SMarcus Overhagen
524b095722SMarcus Overhagen#endif /* _MEDIA_DEBUG_H_ */
53