annotate lib/libpng/pngdebug.h @ 2463:0f17a30149ec

cleaning project part 1
author zipi
date Sun, 17 Aug 2014 15:13:18 +0100
parents 6e178010fc29
children
rev   line source
2296
Ritor1
parents:
diff changeset
1
Ritor1
parents:
diff changeset
2 /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
Ritor1
parents:
diff changeset
3 *
Ritor1
parents:
diff changeset
4 * Copyright (c) 1998-2013 Glenn Randers-Pehrson
Ritor1
parents:
diff changeset
5 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
Ritor1
parents:
diff changeset
6 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
Ritor1
parents:
diff changeset
7 *
Ritor1
parents:
diff changeset
8 * Last changed in libpng 1.6.8 [December 19, 2013]
Ritor1
parents:
diff changeset
9 *
Ritor1
parents:
diff changeset
10 * This code is released under the libpng license.
Ritor1
parents:
diff changeset
11 * For conditions of distribution and use, see the disclaimer
Ritor1
parents:
diff changeset
12 * and license in png.h
Ritor1
parents:
diff changeset
13 */
Ritor1
parents:
diff changeset
14
Ritor1
parents:
diff changeset
15 /* Define PNG_DEBUG at compile time for debugging information. Higher
Ritor1
parents:
diff changeset
16 * numbers for PNG_DEBUG mean more debugging information. This has
Ritor1
parents:
diff changeset
17 * only been added since version 0.95 so it is not implemented throughout
Ritor1
parents:
diff changeset
18 * libpng yet, but more support will be added as needed.
Ritor1
parents:
diff changeset
19 *
Ritor1
parents:
diff changeset
20 * png_debug[1-2]?(level, message ,arg{0-2})
Ritor1
parents:
diff changeset
21 * Expands to a statement (either a simple expression or a compound
Ritor1
parents:
diff changeset
22 * do..while(0) statement) that outputs a message with parameter
Ritor1
parents:
diff changeset
23 * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG
Ritor1
parents:
diff changeset
24 * is undefined, 0 or 1 every png_debug expands to a simple expression
Ritor1
parents:
diff changeset
25 * (actually ((void)0)).
Ritor1
parents:
diff changeset
26 *
Ritor1
parents:
diff changeset
27 * level: level of detail of message, starting at 0. A level 'n'
Ritor1
parents:
diff changeset
28 * message is preceded by 'n' 3-space indentations (not implemented
Ritor1
parents:
diff changeset
29 * on Microsoft compilers unless PNG_DEBUG_FILE is also
Ritor1
parents:
diff changeset
30 * defined, to allow debug DLL compilation with no standard IO).
Ritor1
parents:
diff changeset
31 * message: a printf(3) style text string. A trailing '\n' is added
Ritor1
parents:
diff changeset
32 * to the message.
Ritor1
parents:
diff changeset
33 * arg: 0 to 2 arguments for printf(3) style substitution in message.
Ritor1
parents:
diff changeset
34 */
Ritor1
parents:
diff changeset
35 #ifndef PNGDEBUG_H
Ritor1
parents:
diff changeset
36 #define PNGDEBUG_H
Ritor1
parents:
diff changeset
37 /* These settings control the formatting of messages in png.c and pngerror.c */
Ritor1
parents:
diff changeset
38 /* Moved to pngdebug.h at 1.5.0 */
Ritor1
parents:
diff changeset
39 # ifndef PNG_LITERAL_SHARP
Ritor1
parents:
diff changeset
40 # define PNG_LITERAL_SHARP 0x23
Ritor1
parents:
diff changeset
41 # endif
Ritor1
parents:
diff changeset
42 # ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
Ritor1
parents:
diff changeset
43 # define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
Ritor1
parents:
diff changeset
44 # endif
Ritor1
parents:
diff changeset
45 # ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
Ritor1
parents:
diff changeset
46 # define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
Ritor1
parents:
diff changeset
47 # endif
Ritor1
parents:
diff changeset
48 # ifndef PNG_STRING_NEWLINE
Ritor1
parents:
diff changeset
49 # define PNG_STRING_NEWLINE "\n"
Ritor1
parents:
diff changeset
50 # endif
Ritor1
parents:
diff changeset
51
Ritor1
parents:
diff changeset
52 #ifdef PNG_DEBUG
Ritor1
parents:
diff changeset
53 # if (PNG_DEBUG > 0)
Ritor1
parents:
diff changeset
54 # if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
Ritor1
parents:
diff changeset
55 # include <crtdbg.h>
Ritor1
parents:
diff changeset
56 # if (PNG_DEBUG > 1)
Ritor1
parents:
diff changeset
57 # ifndef _DEBUG
Ritor1
parents:
diff changeset
58 # define _DEBUG
Ritor1
parents:
diff changeset
59 # endif
Ritor1
parents:
diff changeset
60 # ifndef png_debug
Ritor1
parents:
diff changeset
61 # define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
Ritor1
parents:
diff changeset
62 # endif
Ritor1
parents:
diff changeset
63 # ifndef png_debug1
Ritor1
parents:
diff changeset
64 # define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
Ritor1
parents:
diff changeset
65 # endif
Ritor1
parents:
diff changeset
66 # ifndef png_debug2
Ritor1
parents:
diff changeset
67 # define png_debug2(l,m,p1,p2) \
Ritor1
parents:
diff changeset
68 _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
Ritor1
parents:
diff changeset
69 # endif
Ritor1
parents:
diff changeset
70 # endif
Ritor1
parents:
diff changeset
71 # else /* PNG_DEBUG_FILE || !_MSC_VER */
Ritor1
parents:
diff changeset
72 # ifndef PNG_STDIO_SUPPORTED
Ritor1
parents:
diff changeset
73 # include <stdio.h> /* not included yet */
Ritor1
parents:
diff changeset
74 # endif
Ritor1
parents:
diff changeset
75 # ifndef PNG_DEBUG_FILE
Ritor1
parents:
diff changeset
76 # define PNG_DEBUG_FILE stderr
Ritor1
parents:
diff changeset
77 # endif /* PNG_DEBUG_FILE */
Ritor1
parents:
diff changeset
78
Ritor1
parents:
diff changeset
79 # if (PNG_DEBUG > 1)
Ritor1
parents:
diff changeset
80 # ifdef __STDC__
Ritor1
parents:
diff changeset
81 # ifndef png_debug
Ritor1
parents:
diff changeset
82 # define png_debug(l,m) \
Ritor1
parents:
diff changeset
83 do { \
Ritor1
parents:
diff changeset
84 int num_tabs=l; \
Ritor1
parents:
diff changeset
85 fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
Ritor1
parents:
diff changeset
86 (num_tabs==2 ? " " : (num_tabs>2 ? " " : "")))); \
Ritor1
parents:
diff changeset
87 } while (0)
Ritor1
parents:
diff changeset
88 # endif
Ritor1
parents:
diff changeset
89 # ifndef png_debug1
Ritor1
parents:
diff changeset
90 # define png_debug1(l,m,p1) \
Ritor1
parents:
diff changeset
91 do { \
Ritor1
parents:
diff changeset
92 int num_tabs=l; \
Ritor1
parents:
diff changeset
93 fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
Ritor1
parents:
diff changeset
94 (num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1); \
Ritor1
parents:
diff changeset
95 } while (0)
Ritor1
parents:
diff changeset
96 # endif
Ritor1
parents:
diff changeset
97 # ifndef png_debug2
Ritor1
parents:
diff changeset
98 # define png_debug2(l,m,p1,p2) \
Ritor1
parents:
diff changeset
99 do { \
Ritor1
parents:
diff changeset
100 int num_tabs=l; \
Ritor1
parents:
diff changeset
101 fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
Ritor1
parents:
diff changeset
102 (num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1,p2);\
Ritor1
parents:
diff changeset
103 } while (0)
Ritor1
parents:
diff changeset
104 # endif
Ritor1
parents:
diff changeset
105 # else /* __STDC __ */
Ritor1
parents:
diff changeset
106 # ifndef png_debug
Ritor1
parents:
diff changeset
107 # define png_debug(l,m) \
Ritor1
parents:
diff changeset
108 do { \
Ritor1
parents:
diff changeset
109 int num_tabs=l; \
Ritor1
parents:
diff changeset
110 char format[256]; \
Ritor1
parents:
diff changeset
111 snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
Ritor1
parents:
diff changeset
112 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
Ritor1
parents:
diff changeset
113 m,PNG_STRING_NEWLINE); \
Ritor1
parents:
diff changeset
114 fprintf(PNG_DEBUG_FILE,format); \
Ritor1
parents:
diff changeset
115 } while (0)
Ritor1
parents:
diff changeset
116 # endif
Ritor1
parents:
diff changeset
117 # ifndef png_debug1
Ritor1
parents:
diff changeset
118 # define png_debug1(l,m,p1) \
Ritor1
parents:
diff changeset
119 do { \
Ritor1
parents:
diff changeset
120 int num_tabs=l; \
Ritor1
parents:
diff changeset
121 char format[256]; \
Ritor1
parents:
diff changeset
122 snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
Ritor1
parents:
diff changeset
123 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
Ritor1
parents:
diff changeset
124 m,PNG_STRING_NEWLINE); \
Ritor1
parents:
diff changeset
125 fprintf(PNG_DEBUG_FILE,format,p1); \
Ritor1
parents:
diff changeset
126 } while (0)
Ritor1
parents:
diff changeset
127 # endif
Ritor1
parents:
diff changeset
128 # ifndef png_debug2
Ritor1
parents:
diff changeset
129 # define png_debug2(l,m,p1,p2) \
Ritor1
parents:
diff changeset
130 do { \
Ritor1
parents:
diff changeset
131 int num_tabs=l; \
Ritor1
parents:
diff changeset
132 char format[256]; \
Ritor1
parents:
diff changeset
133 snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
Ritor1
parents:
diff changeset
134 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
Ritor1
parents:
diff changeset
135 m,PNG_STRING_NEWLINE); \
Ritor1
parents:
diff changeset
136 fprintf(PNG_DEBUG_FILE,format,p1,p2); \
Ritor1
parents:
diff changeset
137 } while (0)
Ritor1
parents:
diff changeset
138 # endif
Ritor1
parents:
diff changeset
139 # endif /* __STDC __ */
Ritor1
parents:
diff changeset
140 # endif /* (PNG_DEBUG > 1) */
Ritor1
parents:
diff changeset
141
Ritor1
parents:
diff changeset
142 # endif /* _MSC_VER */
Ritor1
parents:
diff changeset
143 # endif /* (PNG_DEBUG > 0) */
Ritor1
parents:
diff changeset
144 #endif /* PNG_DEBUG */
Ritor1
parents:
diff changeset
145 #ifndef png_debug
Ritor1
parents:
diff changeset
146 # define png_debug(l, m) ((void)0)
Ritor1
parents:
diff changeset
147 #endif
Ritor1
parents:
diff changeset
148 #ifndef png_debug1
Ritor1
parents:
diff changeset
149 # define png_debug1(l, m, p1) ((void)0)
Ritor1
parents:
diff changeset
150 #endif
Ritor1
parents:
diff changeset
151 #ifndef png_debug2
Ritor1
parents:
diff changeset
152 # define png_debug2(l, m, p1, p2) ((void)0)
Ritor1
parents:
diff changeset
153 #endif
Ritor1
parents:
diff changeset
154 #endif /* PNGDEBUG_H */