1 #ifndef __ZZIP_INTERNAL_DEBUG_H
2 #define __ZZIP_INTERNAL_DEBUG_H
5 #include <zzip/__hints.h>
7 /* perhaps want to show on syslog(3) ?? */
9 #if 0 && defined(DEBUG)
11 #define DBG1(X1) ZZIP_FOR1 { \
12 fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \
14 #define DBG2(X1,X2) ZZIP_FOR1 { \
15 fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \
17 #define DBG3(X1,X2,X3) ZZIP_FOR1 { \
18 fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \
20 #define DBG4(X1,X2,X3,X4) ZZIP_FOR1 { \
21 fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \
22 ,X2,X3,X4); } ZZIP_END1
23 #define DBG5(X1,X2,X3,X4,X5) ZZIP_FOR1 { \
24 fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \
25 ,X2,X3,X4,X5); } ZZIP_END1
26 #define DBG6(X1,X2,X3,X4,X5,X6) ZZIP_FOR1 { \
27 fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \
28 ,X2,X3,X4,X5,X6); } ZZIP_END1
32 #define DBG2(X1,X2) {}
33 #define DBG3(X1,X2,X3) {}
34 #define DBG4(X1,X2,X3,X4) {}
35 #define DBG5(X1,X2,X3,X4,X5) {}
36 #define DBG6(X1,X2,X3,X4,X5,X6) {}
39 #define HINT1(X1) DBG1("HINT: " X1)
40 #define HINT2(X1,X2) DBG2("HINT: " X1,X2)
41 #define HINT3(X1,X2,X3) DBG3("HINT: " X1,X2,X3)
42 #define HINT4(X1,X2,X3,X4) DBG4("HINT: " X1,X2,X3,X4)
43 #define HINT5(X1,X2,X3,X4,X5) DBG5("HINT: " X1,X2,X3,X4,X5)
44 #define HINT6(X1,X2,X3,X4,X5,X6) DBG6("HINT: " X1,X2,X3,X4,X5,X6)
46 #define NOTE1(X1) DBG1("NOTE: " X1)
47 #define NOTE2(X1,X2) DBG2("NOTE: " X1,X2)
48 #define NOTE3(X1,X2,X3) DBG3("NOTE: " X1,X2,X3)
49 #define NOTE4(X1,X2,X3,X4) DBG4("NOTE: " X1,X2,X3,X4)
50 #define NOTE5(X1,X2,X3,X4,X5) DBG5("NOTE: " X1,X2,X3,X4,X5)
51 #define NOTE6(X1,X2,X3,X4,X5,X6) DBG6("NOTE: " X1,X2,X3,X4,X5,X6)
53 #define WARN1(X1) DBG1("WARN: " X1)
54 #define WARN2(X1,X2) DBG2("WARN: " X1,X2)
55 #define WARN3(X1,X2,X3) DBG3("WARN: " X1,X2,X3)
56 #define WARN4(X1,X2,X3,X4) DBG4("WARN: " X1,X2,X3,X4)
57 #define WARN5(X1,X2,X3,X4,X5) DBG5("WARN: " X1,X2,X3,X4,X5)
58 #define WARN6(X1,X2,X3,X4,X5,X6) DBG6("WARN: " X1,X2,X3,X4,X5,X6)
60 #define FAIL1(X1) DBG1("FAIL: " X1)
61 #define FAIL2(X1,X2) DBG2("FAIL: " X1,X2)
62 #define FAIL3(X1,X2,X3) DBG3("FAIL: " X1,X2,X3)
63 #define FAIL4(X1,X2,X3,X4) DBG4("FAIL: " X1,X2,X3,X4)
64 #define FAIL5(X1,X2,X3,X4,X5) DBG5("FAIL: " X1,X2,X3,X4,X5)
65 #define FAIL6(X1,X2,X3,X4,X5,X6) DBG6("FAIL: " X1,X2,X3,X4,X5,X6)
69 #if 0 && defined(DEBUG)
70 _zzip_inline
static void zzip_debug_xbuf (unsigned char* p
, int l
)
71 /* ZZIP_GNUC_UNUSED */
73 # define q(a) ((a&0x7F)<32?32:(a&0x7F))
77 "%02x %02x %02x %02x "
78 "%02x %02x %02x %02x "
79 "%c%c%c%c %c%c%c%c\n",
80 p
[0], p
[1], p
[2], p
[3], p
[4], p
[5], p
[6], p
[7],
81 q(p
[0]), q(p
[1]), q(p
[2]), q(p
[3]),
82 q(p
[4]), q(p
[5]), q(p
[6]), q(p
[7]));