CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

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