OLD | NEW |
1 | 1 |
2 /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c | 2 /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c |
3 * | 3 * |
4 * Copyright (c) 1998-2011 Glenn Randers-Pehrson | 4 * Last changed in libpng 1.6.8 [December 19, 2013] |
| 5 * Copyright (c) 1998-2013 Glenn Randers-Pehrson |
5 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) | 6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
6 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) | 7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
7 * | 8 * |
8 * Last changed in libpng 1.5.0 [January 6, 2011] | |
9 * | |
10 * This code is released under the libpng license. | 9 * This code is released under the libpng license. |
11 * For conditions of distribution and use, see the disclaimer | 10 * For conditions of distribution and use, see the disclaimer |
12 * and license in png.h | 11 * and license in png.h |
13 */ | 12 */ |
14 | 13 |
15 /* Define PNG_DEBUG at compile time for debugging information. Higher | 14 /* Define PNG_DEBUG at compile time for debugging information. Higher |
16 * numbers for PNG_DEBUG mean more debugging information. This has | 15 * numbers for PNG_DEBUG mean more debugging information. This has |
17 * only been added since version 0.95 so it is not implemented throughout | 16 * only been added since version 0.95 so it is not implemented throughout |
18 * libpng yet, but more support will be added as needed. | 17 * libpng yet, but more support will be added as needed. |
19 * | 18 * |
20 * png_debug[1-2]?(level, message ,arg{0-2}) | 19 * png_debug[1-2]?(level, message ,arg{0-2}) |
21 * Expands to a statement (either a simple expression or a compound | 20 * Expands to a statement (either a simple expression or a compound |
22 * do..while(0) statement) that outputs a message with parameter | 21 * do..while(0) statement) that outputs a message with parameter |
23 * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG | 22 * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG |
24 * is undefined, 0 or 1 every png_debug expands to a simple expression | 23 * is undefined, 0 or 1 every png_debug expands to a simple expression |
25 * (actually ((void)0)). | 24 * (actually ((void)0)). |
26 * | 25 * |
27 * level: level of detail of message, starting at 0. A level 'n' | 26 * level: level of detail of message, starting at 0. A level 'n' |
28 * message is preceded by 'n' tab characters (not implemented | 27 * message is preceded by 'n' 3-space indentations (not implemented |
29 * on Microsoft compilers unless PNG_DEBUG_FILE is also | 28 * on Microsoft compilers unless PNG_DEBUG_FILE is also |
30 * defined, to allow debug DLL compilation with no standard IO). | 29 * defined, to allow debug DLL compilation with no standard IO). |
31 * message: a printf(3) style text string. A trailing '\n' is added | 30 * message: a printf(3) style text string. A trailing '\n' is added |
32 * to the message. | 31 * to the message. |
33 * arg: 0 to 2 arguments for printf(3) style substitution in message. | 32 * arg: 0 to 2 arguments for printf(3) style substitution in message. |
34 */ | 33 */ |
35 #ifndef PNGDEBUG_H | 34 #ifndef PNGDEBUG_H |
36 #define PNGDEBUG_H | 35 #define PNGDEBUG_H |
37 /* These settings control the formatting of messages in png.c and pngerror.c */ | 36 /* These settings control the formatting of messages in png.c and pngerror.c */ |
38 /* Moved to pngdebug.h at 1.5.0 */ | 37 /* Moved to pngdebug.h at 1.5.0 */ |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 # endif | 69 # endif |
71 # else /* PNG_DEBUG_FILE || !_MSC_VER */ | 70 # else /* PNG_DEBUG_FILE || !_MSC_VER */ |
72 # ifndef PNG_STDIO_SUPPORTED | 71 # ifndef PNG_STDIO_SUPPORTED |
73 # include <stdio.h> /* not included yet */ | 72 # include <stdio.h> /* not included yet */ |
74 # endif | 73 # endif |
75 # ifndef PNG_DEBUG_FILE | 74 # ifndef PNG_DEBUG_FILE |
76 # define PNG_DEBUG_FILE stderr | 75 # define PNG_DEBUG_FILE stderr |
77 # endif /* PNG_DEBUG_FILE */ | 76 # endif /* PNG_DEBUG_FILE */ |
78 | 77 |
79 # if (PNG_DEBUG > 1) | 78 # if (PNG_DEBUG > 1) |
80 /* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on | |
81 * non-ISO compilers | |
82 */ | |
83 # ifdef __STDC__ | 79 # ifdef __STDC__ |
84 # ifndef png_debug | 80 # ifndef png_debug |
85 # define png_debug(l,m) \ | 81 # define png_debug(l,m) \ |
86 do { \ | 82 do { \ |
87 int num_tabs=l; \ | 83 int num_tabs=l; \ |
88 fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ | 84 fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \ |
89 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ | 85 (num_tabs==2 ? " " : (num_tabs>2 ? " " : "")))); \ |
90 } while (0) | 86 } while (0) |
91 # endif | 87 # endif |
92 # ifndef png_debug1 | 88 # ifndef png_debug1 |
93 # define png_debug1(l,m,p1) \ | 89 # define png_debug1(l,m,p1) \ |
94 do { \ | 90 do { \ |
95 int num_tabs=l; \ | 91 int num_tabs=l; \ |
96 fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ | 92 fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \ |
97 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \ | 93 (num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1); \ |
98 } while (0) | 94 } while (0) |
99 # endif | 95 # endif |
100 # ifndef png_debug2 | 96 # ifndef png_debug2 |
101 # define png_debug2(l,m,p1,p2) \ | 97 # define png_debug2(l,m,p1,p2) \ |
102 do { \ | 98 do { \ |
103 int num_tabs=l; \ | 99 int num_tabs=l; \ |
104 fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ | 100 fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \ |
105 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \ | 101 (num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1,p2);\ |
106 } while (0) | 102 } while (0) |
107 # endif | 103 # endif |
108 # else /* __STDC __ */ | 104 # else /* __STDC __ */ |
109 # ifndef png_debug | 105 # ifndef png_debug |
110 # define png_debug(l,m) \ | 106 # define png_debug(l,m) \ |
111 do { \ | 107 do { \ |
112 int num_tabs=l; \ | 108 int num_tabs=l; \ |
113 char format[256]; \ | 109 char format[256]; \ |
114 snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \ | 110 snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \ |
115 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \ | 111 (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \ |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 #ifndef png_debug | 144 #ifndef png_debug |
149 # define png_debug(l, m) ((void)0) | 145 # define png_debug(l, m) ((void)0) |
150 #endif | 146 #endif |
151 #ifndef png_debug1 | 147 #ifndef png_debug1 |
152 # define png_debug1(l, m, p1) ((void)0) | 148 # define png_debug1(l, m, p1) ((void)0) |
153 #endif | 149 #endif |
154 #ifndef png_debug2 | 150 #ifndef png_debug2 |
155 # define png_debug2(l, m, p1, p2) ((void)0) | 151 # define png_debug2(l, m, p1, p2) ((void)0) |
156 #endif | 152 #endif |
157 #endif /* PNGDEBUG_H */ | 153 #endif /* PNGDEBUG_H */ |
OLD | NEW |