CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/ext/libpng17/pngconf.h
Views: 1401
1/* pngconf.h - machine configurable file for libpng2*3* libpng version 1.7.0beta90, August 28, 20174*5* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson6* (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 disclaimer11* and license in png.h12*13* Any machine specific code is near the front of this file, so if you14* are configuring libpng for a machine, you may want to read the section15* starting here down to where it starts to typedef png_color, png_text,16* and png_info.17*/1819#ifndef PNGCONF_H20#define PNGCONF_H2122#ifndef PNG_BUILDING_SYMBOL_TABLE /* else includes may cause problems */2324/* From libpng 1.6.0 libpng requires an ANSI X3.159-1989 ("ISOC90") compliant C25* compiler for correct compilation. The following header files are required by26* the standard. If your compiler doesn't provide these header files, or they27* do not match the standard, you will need to provide/improve them.28*/29#include <limits.h>30#include <stddef.h>3132/* Library header files. These header files are all defined by ISOC90; libpng33* expects conformant implementations, however, an ISOC90 conformant system need34* not provide these header files if the functionality cannot be implemented.35* In this case it will be necessary to disable the relevant parts of libpng in36* the build of pnglibconf.h.37*38* Prior to 1.6.0 string.h was included here; the API changes in 1.6.0 to not39* include this unnecessary header file.40*/4142#ifdef PNG_STDIO_SUPPORTED43/* Required for the definition of FILE: */44# include <stdio.h>45#endif4647#ifdef PNG_SETJMP_SUPPORTED48/* Required for the definition of jmp_buf and the declaration of longjmp: */49# include <setjmp.h>50#endif5152#ifdef PNG_CONVERT_tIME_SUPPORTED53/* Required for struct tm: */54# include <time.h>55#endif5657#endif /* PNG_BUILDING_SYMBOL_TABLE */5859/* Prior to 1.6.0 it was possible to turn off 'const' in declarations using60* PNG_NO_CONST; this is no longer supported except for data declarations which61* apparently still cause problems in 2011 on some compilers.62*/63#define PNG_CONST const /* backward compatibility only */6465/* This controls optimization of the reading of 16 and 32 bit values66* from PNG files. It can be set on a per-app-file basis - it67* just changes whether a macro is used when the function is called.68* The library builder sets the default; if read functions are not69* built into the library the macro implementation is forced on.70*/71#ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED72# define PNG_USE_READ_MACROS73#endif74#if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)75# if PNG_DEFAULT_READ_MACROS76# define PNG_USE_READ_MACROS77# endif78#endif7980/* COMPILER SPECIFIC OPTIONS.81*82* These options are provided so that a variety of difficult compilers83* can be used. Some are fixed at build time (e.g. PNG_API_RULE84* below) but still have compiler specific implementations, others85* may be changed on a per-file basis when compiling against libpng.86*/8788/* The PNGARG macro was used in versions of libpng prior to 1.6.0 to protect89* against legacy (pre ISOC90) compilers that did not understand function90* prototypes. It is not required for modern C compilers.91*/92#ifndef PNGARG93# define PNGARG(arglist) arglist94#endif9596/* Function calling conventions.97* =============================98* Normally it is not necessary to specify to the compiler how to call99* a function - it just does it - however on x86 systems derived from100* Microsoft and Borland C compilers ('IBM PC', 'DOS', 'Windows' systems101* and some others) there are multiple ways to call a function and the102* default can be changed on the compiler command line. For this reason103* libpng specifies the calling convention of every exported function and104* every function called via a user supplied function pointer. This is105* done in this file by defining the following macros:106*107* PNGAPI Calling convention for exported functions.108* PNGCBAPI Calling convention for user provided (callback) functions.109* PNGCAPI Calling convention used by the ANSI-C library (required110* for longjmp callbacks and sometimes used internally to111* specify the calling convention for zlib).112*113* These macros should never be overridden. If it is necessary to114* change calling convention in a private build this can be done115* by setting PNG_API_RULE (which defaults to 0) to one of the values116* below to select the correct 'API' variants.117*118* PNG_API_RULE=0 Use PNGCAPI - the 'C' calling convention - throughout.119* This is correct in every known environment.120* PNG_API_RULE=1 Use the operating system convention for PNGAPI and121* the 'C' calling convention (from PNGCAPI) for122* callbacks (PNGCBAPI). This is no longer required123* in any known environment - if it has to be used124* please post an explanation of the problem to the125* libpng mailing list.126*127* These cases only differ if the operating system does not use the C128* calling convention, at present this just means the above cases129* (x86 DOS/Windows sytems) and, even then, this does not apply to130* Cygwin running on those systems.131*132* Note that the value must be defined in pnglibconf.h so that what133* the application uses to call the library matches the conventions134* set when building the library.135*/136137/* Symbol export138* =============139* When building a shared library it is almost always necessary to tell140* the compiler which symbols to export. The png.h macro 'PNG_EXPORT'141* is used to mark the symbols. On some systems these symbols can be142* extracted at link time and need no special processing by the compiler,143* on other systems the symbols are flagged by the compiler and just144* the declaration requires a special tag applied (unfortunately) in a145* compiler dependent way. Some systems can do either.146*147* A small number of older systems also require a symbol from a DLL to148* be flagged to the program that calls it. This is a problem because149* we do not know in the header file included by application code that150* the symbol will come from a shared library, as opposed to a statically151* linked one. For this reason the application must tell us by setting152* the magic flag PNG_USE_DLL to turn on the special processing before153* it includes png.h.154*155* Four additional macros are used to make this happen:156*157* PNG_IMPEXP The magic (if any) to cause a symbol to be exported from158* the build or imported if PNG_USE_DLL is set - compiler159* and system specific.160*161* PNG_EXPORT_TYPE(type) A macro that pre or appends PNG_IMPEXP to162* 'type', compiler specific.163*164* PNG_DLL_EXPORT Set to the magic to use during a libpng build to165* make a symbol exported from the DLL. Not used in the166* public header files; see pngpriv.h for how it is used167* in the libpng build.168*169* PNG_DLL_IMPORT Set to the magic to force the libpng symbols to come170* from a DLL - used to define PNG_IMPEXP when171* PNG_USE_DLL is set.172*/173174/* System specific discovery.175* ==========================176* This code is used at build time to find PNG_IMPEXP, the API settings177* and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL178* import processing is possible. On Windows systems it also sets179* compiler-specific macros to the values required to change the calling180* conventions of the various functions.181*/182#if defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\183defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)184/* Windows system (DOS doesn't support DLLs). Includes builds under Cygwin or185* MinGW on any architecture currently supported by Windows. Also includes186* Watcom builds but these need special treatment because they are not187* compatible with GCC or Visual C because of different calling conventions.188*/189# if PNG_API_RULE == 2190/* If this line results in an error, either because __watcall is not191* understood or because of a redefine just below you cannot use *this*192* build of the library with the compiler you are using. *This* build was193* build using Watcom and applications must also be built using Watcom!194*/195# define PNGCAPI __watcall196# endif197198# if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 800))199# define PNGCAPI __cdecl200# if PNG_API_RULE == 1201/* If this line results in an error __stdcall is not understood and202* PNG_API_RULE should not have been set to '1'.203*/204# define PNGAPI __stdcall205# endif206# else207/* An older compiler, or one not detected (erroneously) above,208* if necessary override on the command line to get the correct209* variants for the compiler.210*/211# ifndef PNGCAPI212# define PNGCAPI _cdecl213# endif214# if PNG_API_RULE == 1 && !defined(PNGAPI)215# define PNGAPI _stdcall216# endif217# endif /* compiler/api */218219/* NOTE: PNGCBAPI always defaults to PNGCAPI. */220221# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)222# error "PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed"223# endif224225# if (defined(_MSC_VER) && _MSC_VER < 800) ||\226(defined(__BORLANDC__) && __BORLANDC__ < 0x500)227/* older Borland and MSC228* compilers used '__export' and required this to be after229* the type.230*/231# ifndef PNG_EXPORT_TYPE232# define PNG_EXPORT_TYPE(type) type PNG_IMPEXP233# endif234# define PNG_DLL_EXPORT __export235# else /* newer compiler */236# define PNG_DLL_EXPORT __declspec(dllexport)237# ifndef PNG_DLL_IMPORT238# define PNG_DLL_IMPORT __declspec(dllimport)239# endif240# endif /* compiler */241242#else /* !Windows */243# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)244# define PNGAPI _System245# else /* !Windows/x86 && !OS/2 */246/* Use the defaults, or define PNG*API on the command line (but247* this will have to be done for every compile!)248*/249# endif /* other system, !OS/2 */250#endif /* !Windows/x86 */251252/* Now do all the defaulting . */253#ifndef PNGCAPI254# define PNGCAPI255#endif256#ifndef PNGCBAPI257# define PNGCBAPI PNGCAPI258#endif259#ifndef PNGAPI260# define PNGAPI PNGCAPI261#endif262263/* PNG_IMPEXP may be set on the compilation system command line or (if not set)264* then in an internal header file when building the library, otherwise (when265* using the library) it is set here.266*/267#ifndef PNG_IMPEXP268# if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT)269/* This forces use of a DLL, disallowing static linking */270# define PNG_IMPEXP PNG_DLL_IMPORT271# endif272273# ifndef PNG_IMPEXP274# define PNG_IMPEXP275# endif276#endif277278/* In 1.5.2 the definition of PNG_FUNCTION has been changed to always treat279* 'attributes' as a storage class - the attributes go at the start of the280* function definition, and attributes are always appended regardless of the281* compiler. This considerably simplifies these macros but may cause problems282* if any compilers both need function attributes and fail to handle them as283* a storage class (this is unlikely.)284*/285#ifndef PNG_FUNCTION286# define PNG_FUNCTION(type, name, args, attributes) attributes type name args287#endif288289#ifndef PNG_EXPORT_TYPE290# define PNG_EXPORT_TYPE(type) PNG_IMPEXP type291#endif292293/* The ordinal value is only relevant when preprocessing png.h for symbol294* table entries, so we discard it here. See the .dfn files in the295* scripts directory.296*/297#ifndef PNG_EXPORTA298299# define PNG_EXPORTA(ordinal, type, name, args, attributes)\300PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), \301extern attributes)302#endif303304/* ANSI-C (C90) does not permit a macro to be invoked with an empty argument,305* so make something non-empty to satisfy the requirement:306*/307#define PNG_EMPTY /*empty list*/308309#define PNG_EXPORT(ordinal, type, name, args)\310PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY)311312/* Use PNG_REMOVED to comment out a removed interface. */313#ifndef PNG_REMOVED314# define PNG_REMOVED(ordinal, type, name, args, attributes)315#endif316317#ifndef PNG_CALLBACK318# define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) PNGARG(args)319#endif320321/* Support for compiler specific function attributes. These are used322* so that where compiler support is available incorrect use of API323* functions in png.h will generate compiler warnings.324*325* Added at libpng-1.2.41.326*/327328#ifndef PNG_NO_PEDANTIC_WARNINGS329# ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED330# define PNG_PEDANTIC_WARNINGS_SUPPORTED331# endif332#endif333334#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED335/* Support for compiler specific function attributes. These are used336* so that where compiler support is available, incorrect use of API337* functions in png.h will generate compiler warnings. Added at libpng338* version 1.2.41. Disabling these removes the warnings but may also produce339* less efficient code.340*/341# if defined(__clang__) && defined(__has_attribute)342/* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */343# if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__)344# define PNG_USE_RESULT __attribute__((__warn_unused_result__))345# endif346# if !defined(PNG_NORETURN) && __has_attribute(__noreturn__)347# define PNG_NORETURN __attribute__((__noreturn__))348# endif349# if !defined(PNG_ALLOCATED) && __has_attribute(__malloc__)350# define PNG_ALLOCATED __attribute__((__malloc__))351# endif352# if !defined(PNG_DEPRECATED) && __has_attribute(__deprecated__)353# define PNG_DEPRECATED __attribute__((__deprecated__))354# endif355# if !defined(PNG_PRIVATE)356# ifdef __has_extension357# if __has_extension(attribute_unavailable_with_message)358# define PNG_PRIVATE __attribute__((__unavailable__(\359"This function is not exported by libpng.")))360# endif361# endif362# endif363# ifndef PNG_RESTRICT364# define PNG_RESTRICT __restrict365# endif366367# elif defined(__GNUC__)368# ifndef PNG_USE_RESULT369# define PNG_USE_RESULT __attribute__((__warn_unused_result__))370# endif371# ifndef PNG_NORETURN372# define PNG_NORETURN __attribute__((__noreturn__))373# endif374# if __GNUC__ >= 3375# ifndef PNG_ALLOCATED376# define PNG_ALLOCATED __attribute__((__malloc__))377# endif378# ifndef PNG_DEPRECATED379# define PNG_DEPRECATED __attribute__((__deprecated__))380# endif381# ifndef PNG_PRIVATE382# if 0 /* Doesn't work so we use deprecated instead*/383# define PNG_PRIVATE \384__attribute__((warning("This function is not exported by libpng.")))385# else386# define PNG_PRIVATE \387__attribute__((__deprecated__))388# endif389# endif390# if ((__GNUC__ > 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1))391# ifndef PNG_RESTRICT392# define PNG_RESTRICT __restrict393# endif394# endif /* __GNUC__.__GNUC_MINOR__ > 3.0 */395# endif /* __GNUC__ >= 3 */396397# elif defined(_MSC_VER) && (_MSC_VER >= 1300)398# ifndef PNG_USE_RESULT399# define PNG_USE_RESULT /* not supported */400# endif401# ifndef PNG_NORETURN402# define PNG_NORETURN __declspec(noreturn)403# endif404# ifndef PNG_ALLOCATED405# if (_MSC_VER >= 1400)406# define PNG_ALLOCATED __declspec(restrict)407# endif408# endif409# ifndef PNG_DEPRECATED410# define PNG_DEPRECATED __declspec(deprecated)411# endif412# ifndef PNG_PRIVATE413# define PNG_PRIVATE __declspec(deprecated)414# endif415# ifndef PNG_RESTRICT416# if (_MSC_VER >= 1400)417# define PNG_RESTRICT __restrict418# endif419# endif420421# elif defined(__WATCOMC__)422# ifndef PNG_RESTRICT423# define PNG_RESTRICT __restrict424# endif425# endif426#endif /* PNG_PEDANTIC_WARNINGS */427428#ifndef PNG_DEPRECATED429# define PNG_DEPRECATED /* Use of this function is deprecated */430#endif431#ifndef PNG_USE_RESULT432# define PNG_USE_RESULT /* The result of this function must be checked */433#endif434#ifndef PNG_NORETURN435# define PNG_NORETURN /* This function does not return */436#endif437#ifndef PNG_ALLOCATED438# define PNG_ALLOCATED /* The result of the function is new memory */439#endif440#ifndef PNG_PRIVATE441# define PNG_PRIVATE /* This is a private libpng function */442#endif443#ifndef PNG_RESTRICT444# define PNG_RESTRICT /* The C99 "restrict" feature */445#endif446447#ifndef PNG_FP_EXPORT /* A floating point API. */448# ifdef PNG_FLOATING_POINT_SUPPORTED449# define PNG_FP_EXPORT(ordinal, type, name, args)\450PNG_EXPORT(ordinal, type, name, args);451# else /* No floating point APIs */452# define PNG_FP_EXPORT(ordinal, type, name, args)453# endif454#endif455#ifndef PNG_FP_EXPORT /* A floating point API. */456# ifdef PNG_FLOATING_POINT_SUPPORTED457# define PNG_FP_EXPORT(ordinal, type, name, args)\458PNG_EXPORT(ordinal, type, name, args);459# else /* No floating point APIs */460# define PNG_FP_EXPORT(ordinal, type, name, args)461# endif462#endif463#ifndef PNG_FIXED_EXPORT /* A fixed point API. */464# ifdef PNG_FIXED_POINT_SUPPORTED465# define PNG_FIXED_EXPORT(ordinal, type, name, args)\466PNG_EXPORT(ordinal, type, name, args);467# else /* No fixed point APIs */468# define PNG_FIXED_EXPORT(ordinal, type, name, args)469# endif470#endif471472#ifndef PNG_BUILDING_SYMBOL_TABLE473/* Some typedefs to get us started. These should be safe on most of the common474* platforms.475*476* png_uint_32 and png_int_32 may, currently, be larger than required to hold a477* 32-bit value however this is not normally advisable.478*479* png_uint_16 and png_int_16 should always be two bytes in size - this is480* verified at library build time.481*482* png_byte must always be one byte in size.483*484* The checks below use constants from limits.h, as defined by the ISOC90485* standard.486*/487#if CHAR_BIT == 8 && UCHAR_MAX == 255488typedef unsigned char png_byte;489#else490# error "libpng requires 8 bit bytes"491#endif492493#if INT_MIN == -32768 && INT_MAX == 32767494typedef int png_int_16;495#elif SHRT_MIN == -32768 && SHRT_MAX == 32767496typedef short png_int_16;497#else498# error "libpng requires a signed 16 bit type"499#endif500501#if UINT_MAX == 65535502typedef unsigned int png_uint_16;503#elif USHRT_MAX == 65535504typedef unsigned short png_uint_16;505#else506# error "libpng requires an unsigned 16 bit type"507#endif508509#if INT_MIN < -2147483646 && INT_MAX > 2147483646510typedef int png_int_32;511#elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646512typedef long int png_int_32;513#else514# error "libpng requires a signed 32 bit (or more) type"515#endif516517#if UINT_MAX > 4294967294518typedef unsigned int png_uint_32;519#elif ULONG_MAX > 4294967294520typedef unsigned long int png_uint_32;521#else522# error "libpng requires an unsigned 32 bit (or more) type"523#endif524525/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,526* requires an ISOC90 compiler and relies on consistent behavior of sizeof.527*528* DEPRECATED: don't use these types, instead use size_t and ptrdiff_t.529*/530typedef size_t png_size_t;531typedef ptrdiff_t png_ptrdiff_t;532533/* libpng needs to know the maximum value of 'size_t' and this controls the534* definition of png_alloc_size_t, below. This maximum value of size_t limits535* but does not control the maximum allocations the library makes - there is536* direct application control of this through png_set_user_limits().537*/538#ifndef PNG_SMALL_SIZE_T539/* Compiler specific tests for systems where size_t is known to be less than540* 32 bits (some of these systems may no longer work because of the lack of541* 'far' support; see above.)542*/543# if (defined(__TURBOC__) && !defined(__FLAT__)) ||\544(defined(_MSC_VER) && defined(MAXSEG_64K))545# define PNG_SMALL_SIZE_T546# endif547#endif548549/* png_alloc_size_t is guaranteed to be no smaller than size_t, and no550* smaller than png_uint_32. Casts from size_t or png_uint_32 to551* png_alloc_size_t are not necessary; in fact, it is recommended not to use552* them at all so that the compiler can complain when something turns out to be553* problematic.554*555* Casts in the other direction (from png_alloc_size_t to size_t or556* png_uint_32) should be explicitly applied; however, we do not expect to557* encounter practical situations that require such conversions.558*559* PNG_SMALL_SIZE_T must be defined if the maximum value of size_t is less than560* 4294967295 - i.e. less than the maximum value of png_uint_32.561*/562#ifdef PNG_SMALL_SIZE_T563typedef png_uint_32 png_alloc_size_t;564#else565typedef size_t png_alloc_size_t;566#endif567568/* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler569* implementations of Intel CPU specific support of user-mode segmented address570* spaces, where 16-bit pointers address more than 65536 bytes of memory using571* separate 'segment' registers. The implementation requires two different572* types of pointer (only one of which includes the segment value.)573*574* If required this support is available in version 1.2 of libpng and may be575* available in versions through 1.5, although the correctness of the code has576* not been verified recently.577*/578579/* Typedef for floating-point numbers that are converted to fixed-point with a580* multiple of 100,000, e.g., gamma581*/582typedef png_int_32 png_fixed_point;583584/* Add typedefs for pointers */585typedef void * png_voidp;586typedef const void * png_const_voidp;587typedef png_byte * png_bytep;588typedef const png_byte * png_const_bytep;589typedef png_uint_32 * png_uint_32p;590typedef const png_uint_32 * png_const_uint_32p;591typedef png_int_32 * png_int_32p;592typedef const png_int_32 * png_const_int_32p;593typedef png_uint_16 * png_uint_16p;594typedef const png_uint_16 * png_const_uint_16p;595typedef png_int_16 * png_int_16p;596typedef const png_int_16 * png_const_int_16p;597typedef char * png_charp;598typedef const char * png_const_charp;599typedef png_fixed_point * png_fixed_point_p;600typedef const png_fixed_point * png_const_fixed_point_p;601typedef size_t * png_size_tp;602typedef const size_t * png_const_size_tp;603604#ifdef PNG_STDIO_SUPPORTED605typedef FILE * png_FILE_p;606#endif607608#ifdef PNG_FLOATING_POINT_SUPPORTED609typedef double * png_doublep;610typedef const double * png_const_doublep;611#endif612613/* Pointers to pointers; i.e. arrays */614typedef png_byte * * png_bytepp;615typedef png_uint_32 * * png_uint_32pp;616typedef png_int_32 * * png_int_32pp;617typedef png_uint_16 * * png_uint_16pp;618typedef png_int_16 * * png_int_16pp;619typedef const char * * png_const_charpp;620typedef char * * png_charpp;621typedef png_fixed_point * * png_fixed_point_pp;622#ifdef PNG_FLOATING_POINT_SUPPORTED623typedef double * * png_doublepp;624#endif625626/* Pointers to pointers to pointers; i.e., pointer to array */627typedef char * * * png_charppp;628629#endif /* PNG_BUILDING_SYMBOL_TABLE */630631#endif /* PNGCONF_H */632633634