2002-12-03 03:59:42 +03:00
|
|
|
#ifndef _MEDIA_DEBUG_H_
|
|
|
|
#define _MEDIA_DEBUG_H_
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2002-12-03 03:59:42 +03:00
|
|
|
#include <Debug.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2003-06-19 18:53:41 +04:00
|
|
|
#undef TRACE
|
|
|
|
#undef PRINT
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2002-12-03 03:59:42 +03:00
|
|
|
#ifndef DEBUG
|
2003-07-26 05:10:55 +04:00
|
|
|
#define DEBUG -1
|
2002-12-03 03:59:42 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef NDEBUG
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
#if DEBUG >= 1
|
2002-12-03 03:59:42 +03:00
|
|
|
#define UNIMPLEMENTED() printf("UNIMPLEMENTED %s\n",__PRETTY_FUNCTION__)
|
2003-06-19 18:53:41 +04:00
|
|
|
inline void ERROR(const char *fmt, ...) { va_list ap; va_start(ap, fmt); printf("### ERROR: "); vprintf(fmt, ap); va_end(ap); }
|
|
|
|
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); }
|
2002-07-09 16:24:59 +04:00
|
|
|
#else
|
|
|
|
#define UNIMPLEMENTED() ((void)0)
|
2003-06-19 18:53:41 +04:00
|
|
|
#define ERROR(a...) ((void)0)
|
|
|
|
#define PRINT(l, a...) ((void)0)
|
2002-07-09 16:24:59 +04:00
|
|
|
#endif
|
2003-06-19 18:53:41 +04:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
#if DEBUG >= 2
|
2002-12-03 03:59:42 +03:00
|
|
|
#define BROKEN() printf("BROKEN %s\n",__PRETTY_FUNCTION__)
|
|
|
|
#define TRACE printf
|
2002-07-09 16:24:59 +04:00
|
|
|
#else
|
|
|
|
#define BROKEN() ((void)0)
|
2003-06-19 18:53:41 +04:00
|
|
|
#define TRACE(a...) ((void)0)
|
2002-07-09 16:24:59 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if DEBUG >= 3
|
2002-12-03 03:59:42 +03:00
|
|
|
#define CALLED() printf("CALLED %s\n",__PRETTY_FUNCTION__)
|
2002-07-09 16:24:59 +04:00
|
|
|
#else
|
|
|
|
#define CALLED() ((void)0)
|
|
|
|
#endif
|
2003-06-03 23:02:14 +04:00
|
|
|
|
|
|
|
#if DEBUG >= 1
|
2003-06-19 18:53:41 +04:00
|
|
|
#define PRINT_FORMAT(_text, _fmt) do { char _buf[300]; string_for_format((_fmt), _buf, sizeof(_buf)); printf("%s %s\n", (_text), (_buf)); } while (0)
|
|
|
|
#define PRINT_INPUT(_text, _in) do { char _buf[300]; string_for_format((_in).format, _buf, sizeof(_buf)); printf("%s node(node %ld, port %ld); source(port %ld, id %ld); dest(port %ld, id %ld); 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)
|
|
|
|
#define PRINT_OUTPUT(_text, _out) do { char _buf[300]; string_for_format((_out).format, _buf, sizeof(_buf)); printf("%s node(node %ld, port %ld); source(port %ld, id %ld); dest(port %ld, id %ld); 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)
|
2003-06-03 23:02:14 +04:00
|
|
|
#else
|
|
|
|
#define PRINT_FORMAT(_text, _fmt) ((void)0)
|
|
|
|
#define PRINT_INPUT(_text, _in) ((void)0)
|
|
|
|
#define PRINT_OUTPUT(_text, _out) ((void)0)
|
|
|
|
#endif
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
#else
|
|
|
|
|
2003-06-03 23:02:14 +04:00
|
|
|
#define PRINT_FORMAT(_text, _fmt) ((void)0)
|
|
|
|
#define PRINT_INPUT(_text, _in) ((void)0)
|
|
|
|
#define PRINT_OUTPUT(_text, _out) ((void)0)
|
2003-06-19 18:53:41 +04:00
|
|
|
#define UNIMPLEMENTED() ((void)0)
|
|
|
|
#define BROKEN() ((void)0)
|
|
|
|
#define CALLED() ((void)0)
|
|
|
|
#define PRINT(l, a...) ((void)0)
|
|
|
|
#define ERROR(a...) ((void)0)
|
|
|
|
#define TRACE(a...) ((void)0)
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
#endif
|
2002-12-03 03:59:42 +03:00
|
|
|
|
|
|
|
#endif /* _MEDIA_DEBUG_H_ */
|