4418N/A/*
4418N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4418N/A *
4418N/A * This code is free software; you can redistribute it and/or modify it
4418N/A * under the terms of the GNU General Public License version 2 only, as
4418N/A * published by the Free Software Foundation. Oracle designates this
4418N/A * particular file as subject to the "Classpath" exception as provided
4418N/A * by Oracle in the LICENSE file that accompanied this code.
4418N/A *
4418N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4418N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4418N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4418N/A * version 2 for more details (a copy is included in the LICENSE file that
4418N/A * accompanied this code).
4418N/A *
4418N/A * You should have received a copy of the GNU General Public License version
4418N/A * 2 along with this work; if not, write to the Free Software Foundation,
4418N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4418N/A *
4418N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4418N/A * or visit www.oracle.com if you need additional information or have any
4418N/A * questions.
4418N/A */
4418N/A
4418N/A/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
4418N/A *
4418N/A * This file is available under and governed by the GNU General Public
4418N/A * License version 2 only, as published by the Free Software Foundation.
4418N/A * However, the following notice accompanied the original version of this
4418N/A * file and, per its terms, should not be removed:
4418N/A *
4418N/A * Copyright (c) 1998-2011 Glenn Randers-Pehrson
4418N/A * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
4418N/A * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
4418N/A *
4418N/A * Last changed in libpng 1.5.0 [January 6, 2011]
4418N/A *
4418N/A * This code is released under the libpng license.
4418N/A * For conditions of distribution and use, see the disclaimer
4418N/A * and license in png.h
4418N/A */
4418N/A
4418N/A/* Define PNG_DEBUG at compile time for debugging information. Higher
4418N/A * numbers for PNG_DEBUG mean more debugging information. This has
4418N/A * only been added since version 0.95 so it is not implemented throughout
4418N/A * libpng yet, but more support will be added as needed.
4418N/A *
4418N/A * png_debug[1-2]?(level, message ,arg{0-2})
4418N/A * Expands to a statement (either a simple expression or a compound
4418N/A * do..while(0) statement) that outputs a message with parameter
4418N/A * substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG
4418N/A * is undefined, 0 or 1 every png_debug expands to a simple expression
4418N/A * (actually ((void)0)).
4418N/A *
4418N/A * level: level of detail of message, starting at 0. A level 'n'
4418N/A * message is preceded by 'n' tab characters (not implemented
4418N/A * on Microsoft compilers unless PNG_DEBUG_FILE is also
4418N/A * defined, to allow debug DLL compilation with no standard IO).
4418N/A * message: a printf(3) style text string. A trailing '\n' is added
4418N/A * to the message.
4418N/A * arg: 0 to 2 arguments for printf(3) style substitution in message.
4418N/A */
4418N/A#ifndef PNGDEBUG_H
4418N/A#define PNGDEBUG_H
4418N/A/* These settings control the formatting of messages in png.c and pngerror.c */
4418N/A/* Moved to pngdebug.h at 1.5.0 */
4418N/A# ifndef PNG_LITERAL_SHARP
4418N/A# define PNG_LITERAL_SHARP 0x23
4418N/A# endif
4418N/A# ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
4418N/A# define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
4418N/A# endif
4418N/A# ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
4418N/A# define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
4418N/A# endif
4418N/A# ifndef PNG_STRING_NEWLINE
4418N/A# define PNG_STRING_NEWLINE "\n"
4418N/A# endif
4418N/A
4418N/A#ifdef PNG_DEBUG
4418N/A# if (PNG_DEBUG > 0)
4418N/A# if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
4418N/A# include <crtdbg.h>
4418N/A# if (PNG_DEBUG > 1)
4418N/A# ifndef _DEBUG
4418N/A# define _DEBUG
4418N/A# endif
4418N/A# ifndef png_debug
4418N/A# define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
4418N/A# endif
4418N/A# ifndef png_debug1
4418N/A# define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
4418N/A# endif
4418N/A# ifndef png_debug2
4418N/A# define png_debug2(l,m,p1,p2) \
4418N/A _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
4418N/A# endif
4418N/A# endif
4418N/A# else /* PNG_DEBUG_FILE || !_MSC_VER */
4418N/A# ifndef PNG_STDIO_SUPPORTED
4418N/A# include <stdio.h> /* not included yet */
4418N/A# endif
4418N/A# ifndef PNG_DEBUG_FILE
4418N/A# define PNG_DEBUG_FILE stderr
4418N/A# endif /* PNG_DEBUG_FILE */
4418N/A
4418N/A# if (PNG_DEBUG > 1)
4418N/A/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
4418N/A * non-ISO compilers
4418N/A */
4418N/A# ifdef __STDC__
4418N/A# ifndef png_debug
4418N/A# define png_debug(l,m) \
4418N/A do { \
4418N/A int num_tabs=l; \
4418N/A fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
4418N/A (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
4418N/A } while (0)
4418N/A# endif
4418N/A# ifndef png_debug1
4418N/A# define png_debug1(l,m,p1) \
4418N/A do { \
4418N/A int num_tabs=l; \
4418N/A fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
4418N/A (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
4418N/A } while (0)
4418N/A# endif
4418N/A# ifndef png_debug2
4418N/A# define png_debug2(l,m,p1,p2) \
4418N/A do { \
4418N/A int num_tabs=l; \
4418N/A fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
4418N/A (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
4418N/A } while (0)
4418N/A# endif
4418N/A# else /* __STDC __ */
4418N/A# ifndef png_debug
4418N/A# define png_debug(l,m) \
4418N/A do { \
4418N/A int num_tabs=l; \
4418N/A char format[256]; \
4418N/A snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
4418N/A (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
4418N/A m,PNG_STRING_NEWLINE); \
4418N/A fprintf(PNG_DEBUG_FILE,format); \
4418N/A } while (0)
4418N/A# endif
4418N/A# ifndef png_debug1
4418N/A# define png_debug1(l,m,p1) \
4418N/A do { \
4418N/A int num_tabs=l; \
4418N/A char format[256]; \
4418N/A snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
4418N/A (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
4418N/A m,PNG_STRING_NEWLINE); \
4418N/A fprintf(PNG_DEBUG_FILE,format,p1); \
4418N/A } while (0)
4418N/A# endif
4418N/A# ifndef png_debug2
4418N/A# define png_debug2(l,m,p1,p2) \
4418N/A do { \
4418N/A int num_tabs=l; \
4418N/A char format[256]; \
4418N/A snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
4418N/A (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
4418N/A m,PNG_STRING_NEWLINE); \
4418N/A fprintf(PNG_DEBUG_FILE,format,p1,p2); \
4418N/A } while (0)
4418N/A# endif
4418N/A# endif /* __STDC __ */
4418N/A# endif /* (PNG_DEBUG > 1) */
4418N/A
4418N/A# endif /* _MSC_VER */
4418N/A# endif /* (PNG_DEBUG > 0) */
4418N/A#endif /* PNG_DEBUG */
4418N/A#ifndef png_debug
4418N/A# define png_debug(l, m) ((void)0)
4418N/A#endif
4418N/A#ifndef png_debug1
4418N/A# define png_debug1(l, m, p1) ((void)0)
4418N/A#endif
4418N/A#ifndef png_debug2
4418N/A# define png_debug2(l, m, p1, p2) ((void)0)
4418N/A#endif
4418N/A#endif /* PNGDEBUG_H */