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