From 0d8d92cf4631f4a0a88fe04817d375f9e73408e4 Mon Sep 17 00:00:00 2001 From: salmoon Date: Wed, 28 Aug 2002 16:10:44 +0000 Subject: Initial revision --- libmpio/debug.h | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 libmpio/debug.h (limited to 'libmpio/debug.h') diff --git a/libmpio/debug.h b/libmpio/debug.h new file mode 100644 index 0000000..4c7df21 --- /dev/null +++ b/libmpio/debug.h @@ -0,0 +1,102 @@ +/* + * debug.h + * + * Author: Dirk Meyer + * Andreas Büsching + * + * $Id: debug.h,v 1.1 2002/08/28 16:10:51 salmoon Exp $ + */ + +#ifndef _MPIO_DEBUG_H_ +#define _MPIO_DEBUG_H_ + +// if DPACKAGE is not definied use PACKAGE or "unknown" + +#ifndef DPACKAGE + +#ifdef PACKAGE +#define DPACKAGE PACKAGE +#else +#define DPACKAGE unknown +#endif + +#endif + +#include + +#ifdef sun +#include +#else +#include +#endif + +#ifndef PBOOL +#define PBOOL(x) (x)?"True":"False" +#endif + +#define UNUSED(x) (x = x) + +#define debugn(n,args...) \ + _debug_n(DPACKAGE, n, __FILE__, __LINE__, __FUNCTION__, args) + +#define debug(args...) \ + _debug(DPACKAGE, __FILE__, __LINE__, __FUNCTION__, args) + +#define debug_error(fatal,args...) \ + _error(DPACKAGE, __FILE__, __LINE__, __FUNCTION__, fatal, args) + +#define hexdump(data,len) \ + _hexdump(DPACKAGE, __FILE__, __LINE__, __FUNCTION__, data, len) + +#define hexdumpn(n,data,len) \ + _hexdump_n(DPACKAGE, n, __FILE__, __LINE__, __FUNCTION__, data, len) + +#define hexdump_text(text,data,len) \ + _hexdump_text(text, DPACKAGE, __FILE__, __LINE__, __FUNCTION__, data, len) + +#define octetstrdump(data,len) \ + _octetstr(DPACKAGE, __FILE__, __LINE__, __FUNCTION__, data, len) + +#define ipadr_dump(data,len,text) \ + _octetstr(DPACKAGE, __FILE__, __LINE__, __FUNCTION__, data, len, text) + +#define use_debug() \ + use_debug(DPACKAGE) + + +#define with_special_debug(what) \ + _use_debug(DPACKAGE, what) + +void debug_init(void); +int debug_file(char *filename); +int debug_level(int level); +int debug_level_get(void); + +void _debug(const char *package, const char* file, int line, + const char* function, const char *format, ...); + +void _debug_n(const char *package, const int n, const char* file, + int line, const char* function, const char *format, ...); + +void _hexdump (const char *package, const char* file, int line, + const char* function, const char* data, int len); + +void _hexdump_n (const char *package, const int n, const char* file, int line, + const char* function, const char* data, int len); + +void _hexdump_text (const char *text, + const char *package, const char* file, int line, + const char* function, const char* data, int len); + +void _error(const char *package, const char* file, int line, + const char* function, int fatal, const char *format, ...); + +void _octetstr(const char *package, const char* file, int line, + const char* function, const uint8_t *str, + const unsigned int len, const char *what); + +int _use_debug(int level); + +#endif /* _MPIO_DEBUG_H_ */ + +/* end of debug.h */ -- cgit v1.2.3