pngconf.h revision 4418
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * This file is available under and governed by the GNU General Public 0N/A * License version 2 only, as published by the Free Software Foundation. 0N/A * However, the following notice accompanied the original version of this 0N/A * file and, per its terms, should not be removed: 4418N/A * libpng version 1.5.4 - July 7, 2011 4418N/A * Copyright (c) 1998-2011 Glenn Randers-Pehrson 0N/A * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) 0N/A * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) 4418N/A * This code is released under the libpng license. 4418N/A * For conditions of distribution and use, see the disclaimer 0N/A/* Any machine specific code is near the front of this file, so if you 0N/A * are configuring libpng for a machine, you may want to read the section 0N/A * starting here down to where it starts to typedef png_color, png_text, 4418N/A/* PNG_NO_LIMITS_H may be used to turn off the use of the standard C 4418N/A * definition file for machine specific limits, this may impact the 4418N/A * correctness of the definitons below (see uses of INT_MAX). 4418N/A/* For the memory copy APIs (i.e. the standard definitions of these), 4418N/A * because this file defines png_memcpy and so on the base APIs must 4418N/A/* For png_FILE_p - this provides the standard definition of a 4418N/A/* This controls optimization of the reading of 16 and 32 bit values 4418N/A * from PNG files. It can be set on a per-app-file basis - it 4418N/A * just changes whether a macro is used to the function is called. 4418N/A * The library builder sets the default, if read functions are not 4418N/A * built into the library the macro implementation is forced on. 4418N/A/* COMPILER SPECIFIC OPTIONS. 4418N/A * These options are provided so that a variety of difficult compilers 4418N/A * can be used. Some are fixed at build time (e.g. PNG_API_RULE 4418N/A * below) but still have compiler specific implementations, others 4418N/A * may be changed on a per-file basis when compiling against libpng. 4418N/A/* The PNGARG macro protects us against machines that don't have function 0N/A * prototypes (ie K&R style headers). If your compiler does not handle 0N/A * function prototypes, define this macro and use the included ansi2knr. 0N/A * I've always been able to use _NO_PROTO as the indicator, but you may 0N/A * need to drag the empty declaration out in front of here, or change the 0N/A * ifdef to suit your own needs. 4418N/A#
ifdef OF /* zlib prototype munger */ 4418N/A/* Function calling conventions. 4418N/A * ============================= 4418N/A * Normally it is not necessary to specify to the compiler how to call 4418N/A * a function - it just does it - however on x86 systems derived from 4418N/A * Microsoft and Borland C compilers ('IBM PC', 'DOS', 'Windows' systems 4418N/A * and some others) there are multiple ways to call a function and the 4418N/A * default can be changed on the compiler command line. For this reason 4418N/A * libpng specifies the calling convention of every exported function and 4418N/A * every function called via a user supplied function pointer. This is 4418N/A * done in this file by defining the following macros: 4418N/A * PNGAPI Calling convention for exported functions. 4418N/A * PNGCBAPI Calling convention for user provided (callback) functions. 4418N/A * PNGCAPI Calling convention used by the ANSI-C library (required 4418N/A * for longjmp callbacks and sometimes used internally to 4418N/A * specify the calling convention for zlib). 4418N/A * These macros should never be overridden. If it is necessary to 4418N/A * change calling convention in a private build this can be done 4418N/A * by setting PNG_API_RULE (which defaults to 0) to one of the values 4418N/A * below to select the correct 'API' variants. 4418N/A * PNG_API_RULE=0 Use PNGCAPI - the 'C' calling convention - throughout. 4418N/A * This is correct in every known environment. 4418N/A * PNG_API_RULE=1 Use the operating system convention for PNGAPI and 4418N/A * the 'C' calling convention (from PNGCAPI) for 4418N/A * callbacks (PNGCBAPI). This is no longer required 4418N/A * in any known environment - if it has to be used 4418N/A * please post an explanation of the problem to the 4418N/A * These cases only differ if the operating system does not use the C 4418N/A * calling convention, at present this just means the above cases 4418N/A * Cygwin running on those systems. 4418N/A * the application uses to call the library matches the conventions 4418N/A * set when building the library. 4418N/A * When building a shared library it is almost always necessary to tell 4418N/A * the compiler which symbols to export. The png.h macro 'PNG_EXPORT' 4418N/A * is used to mark the symbols. On some systems these symbols can be 4418N/A * extracted at link time and need no special processing by the compiler, 4418N/A * on other systems the symbols are flagged by the compiler and just 4418N/A * the declaration requires a special tag applied (unfortunately) in a 4418N/A * compiler dependent way. Some systems can do either. 4418N/A * A small number of older systems also require a symbol from a DLL to 4418N/A * be flagged to the program that calls it. This is a problem because 4418N/A * we do not know in the header file included by application code that 4418N/A * the symbol will come from a shared library, as opposed to a statically 4418N/A * linked one. For this reason the application must tell us by setting 4418N/A * the magic flag PNG_USE_DLL to turn on the special processing before 4418N/A * Four additional macros are used to make this happen: 4418N/A * PNG_IMPEXP The magic (if any) to cause a symbol to be exported from 4418N/A * the build or imported if PNG_USE_DLL is set - compiler 4418N/A * PNG_EXPORT_TYPE(type) A macro that pre or appends PNG_IMPEXP to 4418N/A * 'type', compiler specific. 4418N/A * PNG_DLL_EXPORT Set to the magic to use during a libpng build to 4418N/A * make a symbol exported from the DLL. 4418N/A * PNG_DLL_IMPORT Set to the magic to force the libpng symbols to come 4418N/A * from a DLL - used to define PNG_IMPEXP when 4418N/A/* System specific discovery. 4418N/A * ========================== 4418N/A * This code is used at build time to find PNG_IMPEXP, the API settings 4418N/A * and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL 4418N/A * compiler-specific macros to the values required to change the calling 4418N/A * conventions of the various functions. 4418N/A /* Windows system (DOS doesn't support DLLs) running on x86/x64. Includes 4418N/A * builds under Cygwin or MinGW. Also includes Watcom builds but these need 4418N/A * special treatment because they are not compatible with GCC or Visual C 4418N/A * because of different calling conventions. 4418N/A /* If this line results in an error, either because __watcall is not 4418N/A * understood or because of a redefine just below you cannot use *this* 4418N/A * build of the library with the compiler you are using. *This* build was 4418N/A * build using Watcom and applications must also be built using Watcom! 4418N/A /* An older compiler, or one not detected (erroneously) above, 4418N/A * if necessary override on the command line to get the correct 4418N/A * variants for the compiler. 4418N/A /* NOTE: PNGCBAPI always defaults to PNGCAPI. */ 4418N/A * compilers used '__export' and required this to be after 4418N/A /* Use the defaults, or define PNG*API on the command line (but 4418N/A * this will have to be done for every compile!) 4418N/A#
endif /* other system, !OS/2 */ 4418N/A/* Now do all the defaulting . */ 4418N/A/* The default for PNG_IMPEXP depends on whether the library is 4418N/A /* This forces use of a DLL, disallowing static linking */ 4418N/A/* In 1.5.2 the definition of PNG_FUNCTION has been changed to always treat 4418N/A * 'attributes' as a storage class - the attributes go at the start of the 4418N/A * function definition, and attributes are always appended regardless of the 4418N/A * compiler. This considerably simplifies these macros but may cause problems 4418N/A * if any compilers both need function attributes and fail to handle them as 4418N/A * a storage class (this is unlikely.) 4418N/A /* The ordinal value is only relevant when preprocessing png.h for symbol 4418N/A * table entries, so we discard it here. See the .dfn files in the 4418N/A/* ANSI-C (C90) does not permit a macro to be invoked with an empty argument, 4418N/A * so make something non-empty to satisfy the requirement: 4418N/A/* Use PNG_REMOVED to comment out a removed interface. */ 4418N/A/* Support for compiler specific function attributes. These are used 4418N/A * so that where compiler support is available incorrect use of API 4418N/A * functions in png.h will generate compiler warnings. 4418N/A /* Support for compiler specific function attributes. These are used 4418N/A * so that where compiler support is available incorrect use of API 4418N/A * functions in png.h will generate compiler warnings. Added at libpng 4418N/A /* This specifically protects structure members that should only be 4418N/A * accessed from within the library, therefore should be empty during 4418N/A#
if 0
/* Doesn't work so we use deprecated instead*/ 4418N/A /* This specifically protects structure members that should only be 4418N/A * accessed from within the library, therefore should be empty during 4418N/A#
endif /* PNG_PEDANTIC_WARNINGS */ 4418N/A#
else /* No floating point APIs */ 4418N/A#
else /* No fixed point APIs */ 0N/A/* The following uses const char * instead of char * for error 0N/A * and warning message functions, so some compilers won't complain. 0N/A * If you do not want to use const, define PNG_NO_CONST here. 4418N/A * This should not change how the APIs are called, so it can be done 4418N/A * on a per-file basis in the application. 0N/A/* Some typedefs to get us started. These should be safe on most of the 0N/A * common platforms. The typedefs should be at least as large as the 0N/A * numbers suggest (a png_uint_32 must be at least 32 bits long), but they 0N/A * don't have to be exactly that size. Some compilers dislike passing 0N/A * unsigned shorts as function parameters, so you may be better off using 4418N/A * unsigned int for png_uint_16. 0N/A/* The following is needed for medium model support. It cannot be in the 0N/A * MSC. Model independent support declares all arrays and pointers to be 0N/A * large using the far keyword. The zlib version used must also support 0N/A * model independent data. As of version zlib 1.0.4, the necessary changes 0N/A * have been made in zlib. The USE_FAR_KEYWORD define triggers other 0N/A * changes that are needed. (Tim Wegner) 0N/A/* Separate compiler dependencies (problem here is that zlib.h always 4418N/A /* GRR: why is Cygwin in here? Cygwin is not Borland C... */ 0N/A#
endif /* LDATA != 1 */ 4418N/A /* Possibly useful for moving data out of default segment. 4418N/A * Uncomment it if you want. Could also define FARDATA as 4418N/A * const if your compiler supports it. (SJT) 0N/A#
endif /* __WIN32__, __FLAT__, __CYGWIN__ */ 0N/A#
endif /* __BORLANDC__ */ 0N/A/* Suggest testing for specific compiler first before testing for 0N/A * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM, 0N/A * making reliance oncertain keywords suspect. (SJT) 0N/A/* MSC Medium model */ 0N/A/* SJT: default case */ 0N/A/* At this point FAR is always defined */ 0N/A/* Typedef for floating-point numbers that are converted 4418N/A * to fixed-point with a multiple of 100,000, e.g., gamma 0N/A/* Add typedefs for pointers */ 0N/A/* Pointers to pointers; i.e. arrays */ 0N/A/* Pointers to pointers to pointers; i.e., pointer to array */ 4418N/A/* png_alloc_size_t is guaranteed to be no smaller than png_size_t, 4418N/A * and no smaller than png_uint_32. Casts from png_size_t or png_uint_32 4418N/A * to png_alloc_size_t are not necessary; in fact, it is recommended 4418N/A * not to use them at all so that the compiler can complain when something 4418N/A * turns out to be problematic. 4418N/A * Casts in the other direction (from png_alloc_size_t to png_size_t or 4418N/A * png_uint_32) should be explicitly applied; however, we do not expect 4418N/A * to encounter practical situations that require such conversions. 4418N/A /* This is an attempt to detect an old Windows system where (int) is 4418N/A * actually 16 bits, in that case png_malloc must have an argument with a 4418N/A * bigger size to accomodate the requirements of the library. 0N/A#
endif /* PNGCONF_H */