source: OGRE/trunk/ogre_dependencies/Dependencies/include/zzip/__debug.h @ 692

Revision 692, 3.1 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

Line 
1#ifndef __ZZIP_INTERNAL_DEBUG_H
2#define __ZZIP_INTERNAL_DEBUG_H
3#include <zzip/conf.h>
4#include <zzip/__hints.h>
5
6/* perhaps want to show on syslog(3) ?? */
7
8#ifdef DEBUG
9#include <stdio.h>
10#define DBG1(X1) ZZIP_FOR1 { \
11        fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \
12            ); } ZZIP_END1
13#define DBG2(X1,X2) ZZIP_FOR1 { \
14        fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \
15                ,X2);} ZZIP_END1
16#define DBG3(X1,X2,X3) ZZIP_FOR1 { \
17        fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \
18                 ,X2,X3); } ZZIP_END1
19#define DBG4(X1,X2,X3,X4)   ZZIP_FOR1 { \
20        fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \
21                 ,X2,X3,X4); } ZZIP_END1
22#define DBG5(X1,X2,X3,X4,X5)   ZZIP_FOR1 { \
23        fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \
24                 ,X2,X3,X4,X5); } ZZIP_END1
25#define DBG6(X1,X2,X3,X4,X5,X6)   ZZIP_FOR1 { \
26        fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \
27                 ,X2,X3,X4,X5,X6); } ZZIP_END1
28
29#else
30#define DBG1(X1) {}
31#define DBG2(X1,X2) {}
32#define DBG3(X1,X2,X3) {}
33#define DBG4(X1,X2,X3,X4) {}
34#define DBG5(X1,X2,X3,X4,X5) {}
35#define DBG6(X1,X2,X3,X4,X5,X6) {}
36#endif
37
38#define HINT1(X1)                     DBG1("HINT: " X1)
39#define HINT2(X1,X2)                  DBG2("HINT: " X1,X2)
40#define HINT3(X1,X2,X3)               DBG3("HINT: " X1,X2,X3)
41#define HINT4(X1,X2,X3,X4)            DBG4("HINT: " X1,X2,X3,X4)
42#define HINT5(X1,X2,X3,X4,X5)         DBG5("HINT: " X1,X2,X3,X4,X5)
43#define HINT6(X1,X2,X3,X4,X5,X6)      DBG6("HINT: " X1,X2,X3,X4,X5,X6)
44
45#define NOTE1(X1)                     DBG1("NOTE: " X1)
46#define NOTE2(X1,X2)                  DBG2("NOTE: " X1,X2)
47#define NOTE3(X1,X2,X3)               DBG3("NOTE: " X1,X2,X3)
48#define NOTE4(X1,X2,X3,X4)            DBG4("NOTE: " X1,X2,X3,X4)
49#define NOTE5(X1,X2,X3,X4,X5)         DBG5("NOTE: " X1,X2,X3,X4,X5)
50#define NOTE6(X1,X2,X3,X4,X5,X6)      DBG6("NOTE: " X1,X2,X3,X4,X5,X6)
51
52#define WARN1(X1)                     DBG1("WARN: " X1)
53#define WARN2(X1,X2)                  DBG2("WARN: " X1,X2)
54#define WARN3(X1,X2,X3)               DBG3("WARN: " X1,X2,X3)
55#define WARN4(X1,X2,X3,X4)            DBG4("WARN: " X1,X2,X3,X4)
56#define WARN5(X1,X2,X3,X4,X5)         DBG5("WARN: " X1,X2,X3,X4,X5)
57#define WARN6(X1,X2,X3,X4,X5,X6)      DBG6("WARN: " X1,X2,X3,X4,X5,X6)
58
59#define FAIL1(X1)                     DBG1("FAIL: " X1)
60#define FAIL2(X1,X2)                  DBG2("FAIL: " X1,X2)
61#define FAIL3(X1,X2,X3)               DBG3("FAIL: " X1,X2,X3)
62#define FAIL4(X1,X2,X3,X4)            DBG4("FAIL: " X1,X2,X3,X4)
63#define FAIL5(X1,X2,X3,X4,X5)         DBG5("FAIL: " X1,X2,X3,X4,X5)
64#define FAIL6(X1,X2,X3,X4,X5,X6)      DBG6("FAIL: " X1,X2,X3,X4,X5,X6)
65
66
67
68#ifdef DEBUG
69_zzip_inline static void zzip_debug_xbuf (unsigned char* p, int l)
70    /* ZZIP_GNUC_UNUSED */
71{
72#   define q(a) ((a&0x7F)<32?32:(a&0x7F))
73    while (l > 0)
74    {
75        fprintf (stderr,
76                 "%02x %02x %02x %02x  "
77                 "%02x %02x %02x %02x  "
78                 "%c%c%c%c %c%c%c%c\n",
79                 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
80                 q(p[0]), q(p[1]), q(p[2]), q(p[3]),
81                 q(p[4]), q(p[5]), q(p[6]), q(p[7]));
82        p += 8; l -= 8;
83    }
84#   undef q
85}
86#endif
87
88#endif
Note: See TracBrowser for help on using the repository browser.