blob: b23d38b43a407ff3593132171dcb6b3294ca5772 [file] [log] [blame]
Guy Schalnat51f0eb41995-09-26 05:22:39 -05001
Glenn Randers-Pehrson0f881d61998-02-07 10:20:57 -06002/* pngconf.h - machine configurable file for libpng
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06003 *
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -05004 * libpng 1.0.4 - September 18, 1999
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06005 * For conditions of distribution and use, see copyright notice in png.h
6 * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
7 * Copyright (c) 1996, 1997 Andreas Dilger
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -06008 * Copyright (c) 1998, 1999 Glenn Randers-Pehrson
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -06009 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050010
11/* Any machine specific code is near the front of this file, so if you
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060012 * are configuring libpng for a machine, you may want to read the section
13 * starting here down to where it starts to typedef png_color, png_text,
14 * and png_info.
15 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050016
17#ifndef PNGCONF_H
18#define PNGCONF_H
19
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060020
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060021/* This is the size of the compression buffer, and thus the size of
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060022 * an IDAT chunk. Make this whatever size you feel is best for your
23 * machine. One of these will be allocated per png_struct. When this
24 * is full, it writes the data to the disk, and does some other
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -060025 * calculations. Making this an extremely small size will slow
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060026 * the library down, but you may want to experiment to determine
27 * where it becomes significant, if you are concerned with memory
28 * usage. Note that zlib allocates at least 32Kb also. For readers,
29 * this describes the size of the buffer available to read the data in.
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -060030 * Unless this gets smaller than the size of a row (compressed),
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060031 * it should not make much difference how big this is.
32 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050033
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -060034#ifndef PNG_ZBUF_SIZE
Guy Schalnatb2e01bd1996-01-26 01:38:47 -060035#define PNG_ZBUF_SIZE 8192
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -060036#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -050037
Andreas Dilger47a0c421997-05-16 02:46:07 -050038/* If you are running on a machine where you cannot allocate more
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060039 * than 64K of memory at once, uncomment this. While libpng will not
40 * normally need that much memory in a chunk (unless you load up a very
41 * large file), zlib needs to know how big of a chunk it can use, and
42 * libpng thus makes sure to check any memory allocation to verify it
43 * will fit into memory.
Andreas Dilger47a0c421997-05-16 02:46:07 -050044#define PNG_MAX_MALLOC_64K
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060045 */
Andreas Dilger47a0c421997-05-16 02:46:07 -050046#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
47#define PNG_MAX_MALLOC_64K
Guy Schalnat51f0eb41995-09-26 05:22:39 -050048#endif
49
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -050050/* This protects us against compilers that run on a windowing system
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060051 * and thus don't have or would rather us not use the stdio types:
52 * stdin, stdout, and stderr. The only one currently used is stderr
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060053 * in png_error() and png_warning(). #defining PNG_NO_CONSOLE_IO will
54 * prevent these from being compiled and used. #defining PNG_NO_STDIO
55 * will also prevent these, plus will prevent the entire set of stdio
56 * macros and functions (FILE *, printf, etc.) from being compiled and used,
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050057 * unless (PNG_DEBUG > 0) has been #defined.
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060058 *
59 * #define PNG_NO_CONSOLE_IO
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060060 * #define PNG_NO_STDIO
61 */
Guy Schalnat6d764711995-12-19 03:22:19 -060062
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060063# ifdef PNG_NO_STDIO
64# ifndef PNG_NO_CONSOLE_IO
65# define PNG_NO_CONSOLE_IO
66# endif
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050067# ifdef PNG_DEBUG
68# if (PNG_DEBUG > 0)
69# include <stdio.h>
70# endif
71# endif
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060072# else
73# include <stdio.h>
74# endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -060075
76/* This macro protects us against machines that don't have function
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060077 * prototypes (ie K&R style headers). If your compiler does not handle
78 * function prototypes, define this macro and use the included ansi2knr.
79 * I've always been able to use _NO_PROTO as the indicator, but you may
80 * need to drag the empty declaration out in front of here, or change the
81 * ifdef to suit your own needs.
82 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050083#ifndef PNGARG
84
Andreas Dilger47a0c421997-05-16 02:46:07 -050085#ifdef OF /* zlib prototype munger */
Guy Schalnat51f0eb41995-09-26 05:22:39 -050086#define PNGARG(arglist) OF(arglist)
87#else
88
89#ifdef _NO_PROTO
Guy Schalnat6d764711995-12-19 03:22:19 -060090#define PNGARG(arglist) ()
Guy Schalnat51f0eb41995-09-26 05:22:39 -050091#else
92#define PNGARG(arglist) arglist
93#endif /* _NO_PROTO */
94
95#endif /* OF */
96
97#endif /* PNGARG */
98
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -060099/* Try to determine if we are compiling on a Mac. Note that testing for
100 * just __MWERKS__ is not good enough, because the Codewarrior is now used
101 * on non-Mac platforms.
102 */
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600103#ifndef MACOS
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600104#if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600105 defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600106#define MACOS
107#endif
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600108#endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600109
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500110/* enough people need this for various reasons to include it here */
Guy Schalnate5a37791996-06-05 15:50:50 -0500111#if !defined(MACOS) && !defined(RISCOS)
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500112#include <sys/types.h>
113#endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600114
Andreas Dilger47a0c421997-05-16 02:46:07 -0500115/* This is an attempt to force a single setjmp behaviour on Linux. If
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600116 * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
117 */
118#ifdef __linux__
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600119#ifdef _BSD_SOURCE
120#define _PNG_SAVE_BSD_SOURCE
121#undef _BSD_SOURCE
122#endif
123#ifdef _SETJMP_H
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600124__png.h__ already includes setjmp.h
125__dont__ include it again
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600126#endif
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600127#endif /* __linux__ */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500128
129/* include setjmp.h for error handling */
130#include <setjmp.h>
131
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600132#ifdef __linux__
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600133#ifdef _PNG_SAVE_BSD_SOURCE
134#define _BSD_SOURCE
135#undef _PNG_SAVE_BSD_SOURCE
136#endif
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600137#endif /* __linux__ */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600138
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500139#ifdef BSD
140#include <strings.h>
141#else
142#include <string.h>
143#endif
144
Andreas Dilger47a0c421997-05-16 02:46:07 -0500145/* Other defines for things like memory and the like can go here. */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500146#ifdef PNG_INTERNAL
147#include <stdlib.h>
Andreas Dilger47a0c421997-05-16 02:46:07 -0500148
149/* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
150 * aren't usually used outside the library (as far as I know), so it is
151 * debatable if they should be exported at all. In the future, when it is
152 * possible to have run-time registry of chunk-handling functions, some of
153 * these will be made available again.
154#define PNG_EXTERN extern
155 */
156#define PNG_EXTERN
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500157
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600158/* Other defines specific to compilers can go here. Try to keep
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600159 * them inside an appropriate ifdef/endif pair for portability.
160 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500161
Andreas Dilger47a0c421997-05-16 02:46:07 -0500162#if defined(MACOS)
163/* We need to check that <math.h> hasn't already been included earlier
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600164 * as it seems it doesn't agree with <fp.h>, yet we should really use
165 * <fp.h> if possible.
166 */
Andreas Dilger47a0c421997-05-16 02:46:07 -0500167#if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600168#include <fp.h>
Andreas Dilger47a0c421997-05-16 02:46:07 -0500169#endif
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600170#else
171#include <math.h>
172#endif
173
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600174/* Codewarrior on NT has linking problems without this. */
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500175#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600176#define PNG_ALWAYS_EXTERN
177#endif
178
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600179/* For some reason, Borland C++ defines memcmp, etc. in mem.h, not
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600180 * stdlib.h like it should (I think). Or perhaps this is a C++
181 * "feature"?
182 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500183#ifdef __TURBOC__
184#include <mem.h>
185#include "alloc.h"
186#endif
187
188#ifdef _MSC_VER
189#include <malloc.h>
190#endif
191
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600192/* This controls how fine the dithering gets. As this allocates
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600193 * a largish chunk of memory (32K), those who are not as concerned
194 * with dithering quality can decrease some or all of these.
195 */
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600196#ifndef PNG_DITHER_RED_BITS
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500197#define PNG_DITHER_RED_BITS 5
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600198#endif
199#ifndef PNG_DITHER_GREEN_BITS
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500200#define PNG_DITHER_GREEN_BITS 5
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600201#endif
202#ifndef PNG_DITHER_BLUE_BITS
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500203#define PNG_DITHER_BLUE_BITS 5
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600204#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500205
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600206/* This controls how fine the gamma correction becomes when you
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600207 * are only interested in 8 bits anyway. Increasing this value
208 * results in more memory being used, and more pow() functions
209 * being called to fill in the gamma tables. Don't set this value
210 * less then 8, and even that may not work (I haven't tested it).
211 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500212
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600213#ifndef PNG_MAX_GAMMA_8
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500214#define PNG_MAX_GAMMA_8 11
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600215#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500216
Andreas Dilger47a0c421997-05-16 02:46:07 -0500217/* This controls how much a difference in gamma we can tolerate before
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600218 * we actually start doing gamma conversion.
219 */
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600220#ifndef PNG_GAMMA_THRESHOLD
Andreas Dilger47a0c421997-05-16 02:46:07 -0500221#define PNG_GAMMA_THRESHOLD 0.05
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600222#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -0500223
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500224#endif /* PNG_INTERNAL */
225
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600226/* The following uses const char * instead of char * for error
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600227 * and warning message functions, so some compilers won't complain.
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600228 * If you do not want to use const, define PNG_NO_CONST here.
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600229 */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600230
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600231#ifndef PNG_NO_CONST
Guy Schalnat6d764711995-12-19 03:22:19 -0600232# define PNG_CONST const
233#else
234# define PNG_CONST
235#endif
236
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600237/* The following defines give you the ability to remove code from the
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600238 * library that you will not be using. I wish I could figure out how to
239 * automate this, but I can't do that without making it seriously hard
240 * on the users. So if you are not using an ability, change the #define
241 * to and #undef, and that part of the library will not be compiled. If
242 * your linker can't find a function, you may want to make sure the
243 * ability is defined here. Some of these depend upon some others being
244 * defined. I haven't figured out all the interactions here, so you may
245 * have to experiment awhile to get everything to compile. If you are
246 * creating or using a shared library, you probably shouldn't touch this,
247 * as it will affect the size of the structures, and this will cause bad
248 * things to happen if the library and/or application ever change.
249 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500250
251/* Any transformations you will not be using can be undef'ed here */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600252
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600253/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500254 to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
255 on the compile line, then pick and choose which ones to define without
256 having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
257 if you only want to have a png-compliant reader/writer but don't need
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600258 any of the extra transformations. This saves about 80 kbytes in a
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500259 typical installation of the library. (PNG_NO_* form added in version
260 1.0.1c, for consistency)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600261 */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600262
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600263
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500264#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
265 !defined(PNG_NO_READ_TRANSFORMS)
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600266#define PNG_READ_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600267#endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500268#if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
269 !defined(PNG_NO_WRITE_TRANSFORMS)
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600270#define PNG_WRITE_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600271#endif
272
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600273#ifdef PNG_READ_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500274#ifndef PNG_NO_READ_EXPAND
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500275#define PNG_READ_EXPAND_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500276#endif
277#ifndef PNG_NO_READ_SHIFT
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500278#define PNG_READ_SHIFT_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500279#endif
280#ifndef PNG_NO_READ_PACK
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500281#define PNG_READ_PACK_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500282#endif
283#ifndef PNG_NO_READ_BGR
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500284#define PNG_READ_BGR_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500285#endif
286#ifndef PNG_NO_READ_SWAP
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500287#define PNG_READ_SWAP_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500288#endif
289#ifndef PNG_NO_READ_PACKSWAP
Andreas Dilger47a0c421997-05-16 02:46:07 -0500290#define PNG_READ_PACKSWAP_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500291#endif
292#ifndef PNG_NO_READ_INVERT
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500293#define PNG_READ_INVERT_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500294#endif
295#ifndef PNG_NO_READ_DITHER
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500296#define PNG_READ_DITHER_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500297#endif
298#ifndef PNG_NO_READ_BACKGROUND
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500299#define PNG_READ_BACKGROUND_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500300#endif
301#ifndef PNG_NO_READ_16_TO_8
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500302#define PNG_READ_16_TO_8_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500303#endif
304#ifndef PNG_NO_READ_FILLER
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500305#define PNG_READ_FILLER_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500306#endif
307#ifndef PNG_NO_READ_GAMMA
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500308#define PNG_READ_GAMMA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500309#endif
310#ifndef PNG_NO_READ_GRAY_TO_RGB
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500311#define PNG_READ_GRAY_TO_RGB_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500312#endif
313#ifndef PNG_NO_READ_SWAP_ALPHA
Andreas Dilger47a0c421997-05-16 02:46:07 -0500314#define PNG_READ_SWAP_ALPHA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500315#endif
316#ifndef PNG_NO_READ_INVERT_ALPHA
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600317#define PNG_READ_INVERT_ALPHA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500318#endif
319#ifndef PNG_NO_READ_STRIP_ALPHA
Andreas Dilger47a0c421997-05-16 02:46:07 -0500320#define PNG_READ_STRIP_ALPHA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500321#endif
322#ifndef PNG_NO_READ_USER_TRANSFORM
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600323#define PNG_READ_USER_TRANSFORM_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500324#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500325#ifndef PNG_NO_READ_RGB_TO_GRAY
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600326#define PNG_READ_RGB_TO_GRAY_SUPPORTED
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500327#endif
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600328#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600329
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500330#if !defined(PNG_NO_PROGRESSIVE_READ) && \
331 !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600332#define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
333#endif /* about interlacing capability! You'll */
334 /* still have interlacing unless you change the following line: */
335#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500336
337#ifndef PNG_NO_READ_COMPOSITED_NODIV
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600338#define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel and SGI */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500339#endif
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500340
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500341#ifndef PNG_NO_READ_EMPTY_PLTE
342#define PNG_READ_EMPTY_PLTE_SUPPORTED /* useful for MNG applications */
343#endif
344
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600345#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500346#ifndef PNG_NO_WRITE_SHIFT
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500347#define PNG_WRITE_SHIFT_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500348#endif
349#ifndef PNG_NO_WRITE_PACK
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500350#define PNG_WRITE_PACK_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500351#endif
352#ifndef PNG_NO_WRITE_BGR
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500353#define PNG_WRITE_BGR_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500354#endif
355#ifndef PNG_NO_WRITE_SWAP
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500356#define PNG_WRITE_SWAP_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500357#endif
358#ifndef PNG_NO_WRITE_PACKSWAP
Andreas Dilger47a0c421997-05-16 02:46:07 -0500359#define PNG_WRITE_PACKSWAP_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500360#endif
361#ifndef PNG_NO_WRITE_INVERT
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500362#define PNG_WRITE_INVERT_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500363#endif
364#ifndef PNG_NO_WRITE_FILLER
Andreas Dilger47a0c421997-05-16 02:46:07 -0500365#define PNG_WRITE_FILLER_SUPPORTED /* This is the same as WRITE_STRIP_ALPHA */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500366#endif
367#ifndef PNG_NO_WRITE_SWAP_ALPHA
Andreas Dilger47a0c421997-05-16 02:46:07 -0500368#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500369#endif
370#ifndef PNG_NO_WRITE_INVERT_ALPHA
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600371#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500372#endif
373#ifndef PNG_NO_WRITE_USER_TRANSFORM
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600374#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500375#endif
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600376#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600377
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600378#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
379 encoders, but can cause trouble
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600380 if left undefined */
381
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500382#ifndef PNG_NO_WRITE_WEIGHTED_FILTER
383#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
384#endif
385
386#ifndef PNG_NO_WRITE_FLUSH
387#define PNG_WRITE_FLUSH_SUPPORTED
388#endif
389
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500390#ifndef PNG_NO_WRITE_EMPTY_PLTE
391#define PNG_WRITE_EMPTY_PLTE_SUPPORTED /* useful for MNG applications */
392#endif
393
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500394#ifndef PNG_NO_STDIO
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600395#define PNG_TIME_RFC1123_SUPPORTED
Glenn Randers-Pehrson70e3f541998-01-03 22:40:55 -0600396#endif
Andreas Dilger47a0c421997-05-16 02:46:07 -0500397
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600398/* This adds extra functions in pngget.c for accessing data from the
399 * info pointer (added in version 0.99)
400 * png_get_image_width()
401 * png_get_image_height()
402 * png_get_bit_depth()
403 * png_get_color_type()
404 * png_get_compression_type()
405 * png_get_filter_type()
406 * png_get_interlace_type()
407 * png_get_pixel_aspect_ratio()
408 * png_get_pixels_per_meter()
409 * png_get_x_offset_pixels()
410 * png_get_y_offset_pixels()
411 * png_get_x_offset_microns()
412 * png_get_y_offset_microns()
413 */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500414#ifndef PNG_NO_EASY_ACCESS
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600415#define PNG_EASY_ACCESS_SUPPORTED
416#endif
417
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500418#ifndef PNG_NO_ASSEMBLER_CODE
419#define PNG_ASSEMBLER_CODE_SUPPORTED
420#endif
421
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600422/* These are currently experimental features, define them if you want */
423
424/* very little testing */
425/*
Glenn Randers-Pehrsoncbe52d81998-02-28 07:00:24 -0600426#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
Glenn Randers-Pehrsonf7d1a171998-06-06 15:31:35 -0500427#define PNG_USER_MEM_SUPPORTED
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600428*/
Andreas Dilger47a0c421997-05-16 02:46:07 -0500429
430/* This is only for PowerPC big-endian and 680x0 systems */
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600431/* some testing */
432/*
433#define PNG_READ_BIG_ENDIAN_SUPPORTED
434*/
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500435
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600436/* These functions are turned off by default, as they will be phased out. */
Glenn Randers-Pehrsonc4a2ae61998-01-16 22:06:18 -0600437/*
438#define PNG_USELESS_TESTS_SUPPORTED
439#define PNG_CORRECT_PALETTE_SUPPORTED
440*/
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600441
Andreas Dilger47a0c421997-05-16 02:46:07 -0500442/* Any chunks you are not interested in, you can undef here. The
443 * ones that allocate memory may be expecially important (hIST,
444 * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600445 * a bit smaller.
Andreas Dilger47a0c421997-05-16 02:46:07 -0500446 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500447
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500448#if !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
449 !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600450#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
451#endif
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500452#if !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
453 !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600454#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
455#endif
456
457#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500458#ifndef PNG_NO_READ_bKGD
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500459#define PNG_READ_bKGD_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500460#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500461#ifndef PNG_NO_READ_cHRM
Andreas Dilger47a0c421997-05-16 02:46:07 -0500462#define PNG_READ_cHRM_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500463#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500464#ifndef PNG_NO_READ_gAMA
Andreas Dilger47a0c421997-05-16 02:46:07 -0500465#define PNG_READ_gAMA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500466#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500467#ifndef PNG_NO_READ_hIST
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500468#define PNG_READ_hIST_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500469#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500470#ifndef PNG_NO_READ_oFFs
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500471#define PNG_READ_oFFs_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500472#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500473#ifndef PNG_NO_READ_pCAL
Andreas Dilger47a0c421997-05-16 02:46:07 -0500474#define PNG_READ_pCAL_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500475#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500476#ifndef PNG_NO_READ_pHYs
Andreas Dilger47a0c421997-05-16 02:46:07 -0500477#define PNG_READ_pHYs_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500478#endif
479#ifndef PNG_NO_READ_sBIT
Andreas Dilger47a0c421997-05-16 02:46:07 -0500480#define PNG_READ_sBIT_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500481#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500482#ifndef PNG_NO_READ_sRGB
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600483#define PNG_READ_sRGB_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500484#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500485#ifndef PNG_NO_READ_tEXt
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500486#define PNG_READ_tEXt_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500487#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500488#ifndef PNG_NO_READ_tIME
Andreas Dilger47a0c421997-05-16 02:46:07 -0500489#define PNG_READ_tIME_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500490#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500491#ifndef PNG_NO_READ_tRNS
Andreas Dilger47a0c421997-05-16 02:46:07 -0500492#define PNG_READ_tRNS_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500493#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500494#ifndef PNG_NO_READ_zTXt
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500495#define PNG_READ_zTXt_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500496#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500497#ifndef PNG_NO_READ_OPT_PLTE
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600498#define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the optional */
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500499#endif /* PLTE chunk in RGB and RGBA images */
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600500#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500501
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600502#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500503#ifndef PNG_NO_WRITE_bKGD
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500504#define PNG_WRITE_bKGD_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500505#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500506#ifndef PNG_NO_WRITE_cHRM
Andreas Dilger47a0c421997-05-16 02:46:07 -0500507#define PNG_WRITE_cHRM_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500508#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500509#ifndef PNG_NO_WRITE_gAMA
Andreas Dilger47a0c421997-05-16 02:46:07 -0500510#define PNG_WRITE_gAMA_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500511#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500512#ifndef PNG_NO_WRITE_hIST
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500513#define PNG_WRITE_hIST_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500514#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500515#ifndef PNG_NO_WRITE_oFFs
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500516#define PNG_WRITE_oFFs_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500517#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500518#ifndef PNG_NO_WRITE_pCAL
Andreas Dilger47a0c421997-05-16 02:46:07 -0500519#define PNG_WRITE_pCAL_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500520#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500521#ifndef PNG_NO_WRITE_pHYs
Andreas Dilger47a0c421997-05-16 02:46:07 -0500522#define PNG_WRITE_pHYs_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500523#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500524#ifndef PNG_NO_WRITE_sBIT
Andreas Dilger47a0c421997-05-16 02:46:07 -0500525#define PNG_WRITE_sBIT_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500526#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500527#ifndef PNG_NO_WRITE_sRGB
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600528#define PNG_WRITE_sRGB_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500529#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500530#ifndef PNG_NO_WRITE_tEXt
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500531#define PNG_WRITE_tEXt_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500532#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500533#ifndef PNG_NO_WRITE_tIME
Andreas Dilger47a0c421997-05-16 02:46:07 -0500534#define PNG_WRITE_tIME_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500535#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500536#ifndef PNG_NO_WRITE_tRNS
Andreas Dilger47a0c421997-05-16 02:46:07 -0500537#define PNG_WRITE_tRNS_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500538#endif
Glenn Randers-Pehrson8686fff1998-05-21 09:27:50 -0500539#ifndef PNG_NO_WRITE_zTXt
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500540#define PNG_WRITE_zTXt_SUPPORTED
Glenn Randers-Pehrsond0dce401998-05-09 10:02:29 -0500541#endif
Glenn Randers-Pehrson46f61e21998-01-30 21:45:12 -0600542#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500543
Andreas Dilger47a0c421997-05-16 02:46:07 -0500544/* need the time information for reading tIME chunks */
545#if defined(PNG_READ_tIME_SUPPORTED) || defined(PNG_WRITE_tIME_SUPPORTED)
546#include <time.h>
547#endif
548
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600549/* Some typedefs to get us started. These should be safe on most of the
Andreas Dilger47a0c421997-05-16 02:46:07 -0500550 * common platforms. The typedefs should be at least as large as the
551 * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
552 * don't have to be exactly that size. Some compilers dislike passing
553 * unsigned shorts as function parameters, so you may be better off using
554 * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may
555 * want to have unsigned int for png_uint_32 instead of unsigned long.
556 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500557
558typedef unsigned long png_uint_32;
559typedef long png_int_32;
560typedef unsigned short png_uint_16;
561typedef short png_int_16;
562typedef unsigned char png_byte;
563
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600564/* This is usually size_t. It is typedef'ed just in case you need it to
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500565 change (I'm not sure if you will or not, so I thought I'd be safe) */
566typedef size_t png_size_t;
567
Andreas Dilger47a0c421997-05-16 02:46:07 -0500568/* The following is needed for medium model support. It cannot be in the
569 * PNG_INTERNAL section. Needs modification for other compilers besides
570 * MSC. Model independent support declares all arrays and pointers to be
571 * large using the far keyword. The zlib version used must also support
572 * model independent data. As of version zlib 1.0.4, the necessary changes
573 * have been made in zlib. The USE_FAR_KEYWORD define triggers other
574 * changes that are needed. (Tim Wegner)
575 */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500576
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600577/* Separate compiler dependencies (problem here is that zlib.h always
578 defines FAR. (SJT) */
Guy Schalnat6d764711995-12-19 03:22:19 -0600579#ifdef __BORLANDC__
580#if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
581#define LDATA 1
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500582#else
Guy Schalnat6d764711995-12-19 03:22:19 -0600583#define LDATA 0
584#endif
585
586#if !defined(__WIN32__) && !defined(__FLAT__)
587#define PNG_MAX_MALLOC_64K
588#if (LDATA != 1)
589#ifndef FAR
590#define FAR __far
591#endif
592#define USE_FAR_KEYWORD
Guy Schalnatb2e01bd1996-01-26 01:38:47 -0600593#endif /* LDATA != 1 */
Guy Schalnat6d764711995-12-19 03:22:19 -0600594
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600595/* Possibly useful for moving data out of default segment.
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600596 * Uncomment it if you want. Could also define FARDATA as
597 * const if your compiler supports it. (SJT)
Guy Schalnat6d764711995-12-19 03:22:19 -0600598# define FARDATA FAR
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600599 */
Guy Schalnat6d764711995-12-19 03:22:19 -0600600#endif /* __WIN32__, __FLAT__ */
601
Guy Schalnatb2e01bd1996-01-26 01:38:47 -0600602#endif /* __BORLANDC__ */
Guy Schalnat6d764711995-12-19 03:22:19 -0600603
604
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600605/* Suggest testing for specific compiler first before testing for
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600606 * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
607 * making reliance oncertain keywords suspect. (SJT)
608 */
Guy Schalnat6d764711995-12-19 03:22:19 -0600609
610/* MSC Medium model */
611#if defined(FAR)
612# if defined(M_I86MM)
613# define USE_FAR_KEYWORD
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600614# define FARDATA FAR
615# include <dos.h>
Guy Schalnat6d764711995-12-19 03:22:19 -0600616# endif
617#endif
618
619/* SJT: default case */
620#ifndef FAR
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500621# define FAR
622#endif
623
Andreas Dilger47a0c421997-05-16 02:46:07 -0500624/* At this point FAR is always defined */
Guy Schalnat6d764711995-12-19 03:22:19 -0600625#ifndef FARDATA
626#define FARDATA
627#endif
628
Andreas Dilger47a0c421997-05-16 02:46:07 -0500629/* Add typedefs for pointers */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600630typedef void FAR * png_voidp;
Guy Schalnat6d764711995-12-19 03:22:19 -0600631typedef png_byte FAR * png_bytep;
632typedef png_uint_32 FAR * png_uint_32p;
633typedef png_int_32 FAR * png_int_32p;
634typedef png_uint_16 FAR * png_uint_16p;
635typedef png_int_16 FAR * png_int_16p;
636typedef PNG_CONST char FAR * png_const_charp;
637typedef char FAR * png_charp;
Andreas Dilger47a0c421997-05-16 02:46:07 -0500638typedef double FAR * png_doublep;
Guy Schalnat6d764711995-12-19 03:22:19 -0600639
Andreas Dilger47a0c421997-05-16 02:46:07 -0500640/* Pointers to pointers; i.e. arrays */
Guy Schalnat6d764711995-12-19 03:22:19 -0600641typedef png_byte FAR * FAR * png_bytepp;
642typedef png_uint_32 FAR * FAR * png_uint_32pp;
643typedef png_int_32 FAR * FAR * png_int_32pp;
644typedef png_uint_16 FAR * FAR * png_uint_16pp;
645typedef png_int_16 FAR * FAR * png_int_16pp;
646typedef PNG_CONST char FAR * FAR * png_const_charpp;
647typedef char FAR * FAR * png_charpp;
Andreas Dilger47a0c421997-05-16 02:46:07 -0500648typedef double FAR * FAR * png_doublepp;
Guy Schalnat6d764711995-12-19 03:22:19 -0600649
Andreas Dilger47a0c421997-05-16 02:46:07 -0500650/* Pointers to pointers to pointers; i.e. pointer to array */
651typedef char FAR * FAR * FAR * png_charppp;
Guy Schalnat6d764711995-12-19 03:22:19 -0600652
Andreas Dilger47a0c421997-05-16 02:46:07 -0500653/* libpng typedefs for types in zlib. If zlib changes
654 * or another compression library is used, then change these.
655 * Eliminates need to change all the source files.
656 */
Guy Schalnat6d764711995-12-19 03:22:19 -0600657typedef charf * png_zcharp;
658typedef charf * FAR * png_zcharpp;
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600659typedef z_stream FAR * png_zstreamp;
Guy Schalnat6d764711995-12-19 03:22:19 -0600660
Andreas Dilger47a0c421997-05-16 02:46:07 -0500661
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -0500662#ifndef PNG_EXPORT
663 /* allow for compilation as dll under MS Windows */
664# ifdef __WIN32DLL__
665# define PNG_EXPORT(type,symbol) __declspec(dllexport) type symbol
666# endif
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600667
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -0500668 /* this variant is used in Mozilla; may correspond to MSVC++ 6.0 changes */
669# ifdef ALT_WIN32_DLL
670# define PNG_EXPORT(type,symbol) type __attribute__((dllexport)) symbol
671# endif
672
673 /* allow for compilation as dll with Borland C++ 5.0 */
674# if defined(__BORLANDC__) && defined(_Windows) && defined(__DLL__)
675# define PNG_EXPORT(type,symbol) type _export symbol
676# endif
677
678 /* allow for compilation as shared lib under BeOS */
679# ifdef __BEOSDLL__
680# define PNG_EXPORT(type,symbol) __declspec(export) type symbol
681# endif
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600682#endif
683
Andreas Dilger47a0c421997-05-16 02:46:07 -0500684#ifndef PNG_EXPORT
Glenn Randers-Pehrsonf8b008c1999-09-18 10:54:36 -0500685# define PNG_EXPORT(type,symbol) type symbol
Andreas Dilger47a0c421997-05-16 02:46:07 -0500686#endif
687
688
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500689/* User may want to use these so not in PNG_INTERNAL. Any library functions
Glenn Randers-Pehrsonb6ce43d1998-01-01 07:13:13 -0600690 * that are passed far data must be model independent.
691 */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600692
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500693#if defined(USE_FAR_KEYWORD) /* memory model independent fns */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600694/* use this to make far-to-near assignments */
695# define CHECK 1
696# define NOCHECK 0
Glenn Randers-Pehrsona357b991998-02-08 20:56:40 -0600697# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
698# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
Glenn Randers-Pehrsonf7d1a171998-06-06 15:31:35 -0500699# define png_strcpy _fstrcpy
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500700# define png_strlen _fstrlen
Guy Schalnatb2e01bd1996-01-26 01:38:47 -0600701# define png_memcmp _fmemcmp /* SJT: added */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500702# define png_memcpy _fmemcpy
703# define png_memset _fmemset
704#else /* use the usual functions */
Andreas Dilger02ad0ef1997-01-17 01:34:35 -0600705# define CVT_PTR(ptr) (ptr)
706# define CVT_PTR_NOCHECK(ptr) (ptr)
Glenn Randers-Pehrsonf7d1a171998-06-06 15:31:35 -0500707# define png_strcpy strcpy
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500708# define png_strlen strlen
Guy Schalnatb2e01bd1996-01-26 01:38:47 -0600709# define png_memcmp memcmp /* SJT: added */
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500710# define png_memcpy memcpy
711# define png_memset memset
712#endif
713/* End of memory model independent support */
714
Andreas Dilger47a0c421997-05-16 02:46:07 -0500715/* Just a double check that someone hasn't tried to define something
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -0600716 * contradictory.
Andreas Dilger47a0c421997-05-16 02:46:07 -0500717 */
718#if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K)
719#undef PNG_ZBUF_SIZE
720#define PNG_ZBUF_SIZE 65536
721#endif
722
Guy Schalnat51f0eb41995-09-26 05:22:39 -0500723#endif /* PNGCONF_H */
724