]> git.saurik.com Git - wxWidgets.git/blame - src/png/pngconf.h
fixed typos in wxBitmap::ConvertToImage
[wxWidgets.git] / src / png / pngconf.h
CommitLineData
c801d85f
KB
1
2/* pngconf.h - machine configurable file for libpng
3 *
a626cc03 4 * libpng 1.0.3 - January 14, 1999
c801d85f
KB
5 * 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
a626cc03 8 * Copyright (c) 1998, 1999 Glenn Randers-Pehrson
c801d85f
KB
9 */
10
11/* Any machine specific code is near the front of this file, so if you
12 * 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 */
16
17#ifndef PNGCONF_H
18#define PNGCONF_H
19
a626cc03 20
c801d85f
KB
21/* This is the size of the compression buffer, and thus the size of
22 * 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
25 * calculations. Making this an extremely small size will slow
26 * 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.
30 * Unless this gets smaller than the size of a row (compressed),
31 * it should not make much difference how big this is.
32 */
33
34#ifndef PNG_ZBUF_SIZE
35#define PNG_ZBUF_SIZE 8192
36#endif
37
38/* If you are running on a machine where you cannot allocate more
39 * 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.
44#define PNG_MAX_MALLOC_64K
45 */
46#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
47#define PNG_MAX_MALLOC_64K
48#endif
49
a626cc03 50/* This protects us against compilers that run on a windowing system
c801d85f
KB
51 * 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
a626cc03
RR
53 * 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,
57 * unless PNG_DEBUG has been #defined.
58 *
59 * #define PNG_NO_CONSOLE_IO
c801d85f
KB
60 * #define PNG_NO_STDIO
61 */
62
a626cc03
RR
63#ifdef PNG_DEBUG
64# if (PNG_DEBUG > 0)
65# include <stdio.h>
66# endif
67#else
68# ifdef PNG_NO_STDIO
69# ifndef PNG_NO_CONSOLE_IO
70# define PNG_NO_CONSOLE_IO
71# endif
72# else
73# include <stdio.h>
74# endif
c801d85f
KB
75#endif
76
77/* This macro protects us against machines that don't have function
78 * prototypes (ie K&R style headers). If your compiler does not handle
79 * function prototypes, define this macro and use the included ansi2knr.
80 * I've always been able to use _NO_PROTO as the indicator, but you may
81 * need to drag the empty declaration out in front of here, or change the
82 * ifdef to suit your own needs.
83 */
84#ifndef PNGARG
85
86#ifdef OF /* zlib prototype munger */
87#define PNGARG(arglist) OF(arglist)
88#else
89
90#ifdef _NO_PROTO
91#define PNGARG(arglist) ()
92#else
93#define PNGARG(arglist) arglist
94#endif /* _NO_PROTO */
95
96#endif /* OF */
97
98#endif /* PNGARG */
99
100/* Try to determine if we are compiling on a Mac. Note that testing for
101 * just __MWERKS__ is not good enough, because the Codewarrior is now used
102 * on non-Mac platforms.
103 */
104#ifndef MACOS
105#if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
106 defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
107#define MACOS
108#endif
109#endif
110
111/* enough people need this for various reasons to include it here */
112#if !defined(MACOS) && !defined(RISCOS)
113#include <sys/types.h>
114#endif
115
116/* This is an attempt to force a single setjmp behaviour on Linux. If
117 * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
118 */
119#ifdef __linux__
120#ifdef _BSD_SOURCE
121#define _PNG_SAVE_BSD_SOURCE
122#undef _BSD_SOURCE
123#endif
124#ifdef _SETJMP_H
125__png.h__ already includes setjmp.h
126__dont__ include it again
127#endif
128#endif /* __linux__ */
129
130/* include setjmp.h for error handling */
131#include <setjmp.h>
132
133#ifdef __linux__
134#ifdef _PNG_SAVE_BSD_SOURCE
135#define _BSD_SOURCE
136#undef _PNG_SAVE_BSD_SOURCE
137#endif
138#endif /* __linux__ */
139
140#ifdef BSD
141#include <strings.h>
142#else
143#include <string.h>
144#endif
145
146/* Other defines for things like memory and the like can go here. */
147#ifdef PNG_INTERNAL
148#include <stdlib.h>
149
150/* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
151 * aren't usually used outside the library (as far as I know), so it is
152 * debatable if they should be exported at all. In the future, when it is
153 * possible to have run-time registry of chunk-handling functions, some of
154 * these will be made available again.
155#define PNG_EXTERN extern
156 */
157#define PNG_EXTERN
158
159/* Other defines specific to compilers can go here. Try to keep
160 * them inside an appropriate ifdef/endif pair for portability.
161 */
162
163#if defined(MACOS)
164/* We need to check that <math.h> hasn't already been included earlier
165 * as it seems it doesn't agree with <fp.h>, yet we should really use
166 * <fp.h> if possible.
167 */
168#if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
169#include <fp.h>
170#endif
171#else
172#include <math.h>
173#endif
174
175/* Codewarrior on NT has linking problems without this. */
176#if defined(__MWERKS__) && defined(WIN32)
177#define PNG_ALWAYS_EXTERN
178#endif
179
180/* For some reason, Borland C++ defines memcmp, etc. in mem.h, not
181 * stdlib.h like it should (I think). Or perhaps this is a C++
182 * "feature"?
183 */
184#ifdef __TURBOC__
185#include <mem.h>
186#include "alloc.h"
187#endif
188
189#ifdef _MSC_VER
190#include <malloc.h>
191#endif
192
193/* This controls how fine the dithering gets. As this allocates
194 * a largish chunk of memory (32K), those who are not as concerned
195 * with dithering quality can decrease some or all of these.
196 */
197#ifndef PNG_DITHER_RED_BITS
198#define PNG_DITHER_RED_BITS 5
199#endif
200#ifndef PNG_DITHER_GREEN_BITS
201#define PNG_DITHER_GREEN_BITS 5
202#endif
203#ifndef PNG_DITHER_BLUE_BITS
204#define PNG_DITHER_BLUE_BITS 5
205#endif
206
207/* This controls how fine the gamma correction becomes when you
208 * are only interested in 8 bits anyway. Increasing this value
209 * results in more memory being used, and more pow() functions
210 * being called to fill in the gamma tables. Don't set this value
211 * less then 8, and even that may not work (I haven't tested it).
212 */
213
214#ifndef PNG_MAX_GAMMA_8
215#define PNG_MAX_GAMMA_8 11
216#endif
217
218/* This controls how much a difference in gamma we can tolerate before
219 * we actually start doing gamma conversion.
220 */
221#ifndef PNG_GAMMA_THRESHOLD
222#define PNG_GAMMA_THRESHOLD 0.05
223#endif
224
225#endif /* PNG_INTERNAL */
226
227/* The following uses const char * instead of char * for error
228 * and warning message functions, so some compilers won't complain.
229 * If you do not want to use const, define PNG_NO_CONST here.
230 */
231
232#ifndef PNG_NO_CONST
233# define PNG_CONST const
234#else
235# define PNG_CONST
236#endif
237
238/* The following defines give you the ability to remove code from the
239 * library that you will not be using. I wish I could figure out how to
240 * automate this, but I can't do that without making it seriously hard
241 * on the users. So if you are not using an ability, change the #define
242 * to and #undef, and that part of the library will not be compiled. If
243 * your linker can't find a function, you may want to make sure the
244 * ability is defined here. Some of these depend upon some others being
245 * defined. I haven't figured out all the interactions here, so you may
246 * have to experiment awhile to get everything to compile. If you are
247 * creating or using a shared library, you probably shouldn't touch this,
248 * as it will affect the size of the structures, and this will cause bad
249 * things to happen if the library and/or application ever change.
250 */
251
252/* Any transformations you will not be using can be undef'ed here */
253
254/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
a626cc03
RR
255 to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
256 on the compile line, then pick and choose which ones to define without
257 having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
258 if you only want to have a png-compliant reader/writer but don't need
c801d85f 259 any of the extra transformations. This saves about 80 kbytes in a
a626cc03
RR
260 typical installation of the library. (PNG_NO_* form added in version
261 1.0.1c, for consistency)
c801d85f
KB
262 */
263
264
a626cc03
RR
265#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
266 !defined(PNG_NO_READ_TRANSFORMS)
c801d85f
KB
267#define PNG_READ_TRANSFORMS_SUPPORTED
268#endif
a626cc03
RR
269#if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
270 !defined(PNG_NO_WRITE_TRANSFORMS)
c801d85f
KB
271#define PNG_WRITE_TRANSFORMS_SUPPORTED
272#endif
273
274#ifdef PNG_READ_TRANSFORMS_SUPPORTED
a626cc03 275#ifndef PNG_NO_READ_EXPAND
c801d85f 276#define PNG_READ_EXPAND_SUPPORTED
a626cc03
RR
277#endif
278#ifndef PNG_NO_READ_SHIFT
c801d85f 279#define PNG_READ_SHIFT_SUPPORTED
a626cc03
RR
280#endif
281#ifndef PNG_NO_READ_PACK
c801d85f 282#define PNG_READ_PACK_SUPPORTED
a626cc03
RR
283#endif
284#ifndef PNG_NO_READ_BGR
c801d85f 285#define PNG_READ_BGR_SUPPORTED
a626cc03
RR
286#endif
287#ifndef PNG_NO_READ_SWAP
c801d85f 288#define PNG_READ_SWAP_SUPPORTED
a626cc03
RR
289#endif
290#ifndef PNG_NO_READ_PACKSWAP
c801d85f 291#define PNG_READ_PACKSWAP_SUPPORTED
a626cc03
RR
292#endif
293#ifndef PNG_NO_READ_INVERT
c801d85f 294#define PNG_READ_INVERT_SUPPORTED
a626cc03
RR
295#endif
296#ifndef PNG_NO_READ_DITHER
c801d85f 297#define PNG_READ_DITHER_SUPPORTED
a626cc03
RR
298#endif
299#ifndef PNG_NO_READ_BACKGROUND
c801d85f 300#define PNG_READ_BACKGROUND_SUPPORTED
a626cc03
RR
301#endif
302#ifndef PNG_NO_READ_16_TO_8
c801d85f 303#define PNG_READ_16_TO_8_SUPPORTED
a626cc03
RR
304#endif
305#ifndef PNG_NO_READ_FILLER
c801d85f 306#define PNG_READ_FILLER_SUPPORTED
a626cc03
RR
307#endif
308#ifndef PNG_NO_READ_GAMMA
c801d85f 309#define PNG_READ_GAMMA_SUPPORTED
a626cc03
RR
310#endif
311#ifndef PNG_NO_READ_GRAY_TO_RGB
c801d85f 312#define PNG_READ_GRAY_TO_RGB_SUPPORTED
a626cc03
RR
313#endif
314#ifndef PNG_NO_READ_SWAP_ALPHA
c801d85f 315#define PNG_READ_SWAP_ALPHA_SUPPORTED
a626cc03
RR
316#endif
317#ifndef PNG_NO_READ_INVERT_ALPHA
c801d85f 318#define PNG_READ_INVERT_ALPHA_SUPPORTED
a626cc03
RR
319#endif
320#ifndef PNG_NO_READ_STRIP_ALPHA
c801d85f 321#define PNG_READ_STRIP_ALPHA_SUPPORTED
a626cc03
RR
322#endif
323#ifndef PNG_NO_READ_USER_TRANSFORM
c801d85f 324#define PNG_READ_USER_TRANSFORM_SUPPORTED
a626cc03
RR
325#endif
326#ifndef PNG_NO_READ_RGB_TO_GRAY
c801d85f 327#define PNG_READ_RGB_TO_GRAY_SUPPORTED
a626cc03 328#endif
c801d85f
KB
329#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
330
a626cc03
RR
331#if !defined(PNG_NO_PROGRESSIVE_READ) && \
332 !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
c801d85f
KB
333#define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
334#endif /* about interlacing capability! You'll */
335 /* still have interlacing unless you change the following line: */
336#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
a626cc03
RR
337
338#ifndef PNG_NO_READ_COMPOSITED_NODIV
c801d85f 339#define PNG_READ_COMPOSITE_NODIV_SUPPORTED /* well tested on Intel and SGI */
a626cc03 340#endif
c801d85f
KB
341
342#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
a626cc03 343#ifndef PNG_NO_WRITE_SHIFT
c801d85f 344#define PNG_WRITE_SHIFT_SUPPORTED
a626cc03
RR
345#endif
346#ifndef PNG_NO_WRITE_PACK
c801d85f 347#define PNG_WRITE_PACK_SUPPORTED
a626cc03
RR
348#endif
349#ifndef PNG_NO_WRITE_BGR
c801d85f 350#define PNG_WRITE_BGR_SUPPORTED
a626cc03
RR
351#endif
352#ifndef PNG_NO_WRITE_SWAP
c801d85f 353#define PNG_WRITE_SWAP_SUPPORTED
a626cc03
RR
354#endif
355#ifndef PNG_NO_WRITE_PACKSWAP
c801d85f 356#define PNG_WRITE_PACKSWAP_SUPPORTED
a626cc03
RR
357#endif
358#ifndef PNG_NO_WRITE_INVERT
c801d85f 359#define PNG_WRITE_INVERT_SUPPORTED
a626cc03
RR
360#endif
361#ifndef PNG_NO_WRITE_FILLER
c801d85f 362#define PNG_WRITE_FILLER_SUPPORTED /* This is the same as WRITE_STRIP_ALPHA */
a626cc03
RR
363#endif
364#ifndef PNG_NO_WRITE_SWAP_ALPHA
c801d85f 365#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
a626cc03
RR
366#endif
367#ifndef PNG_NO_WRITE_INVERT_ALPHA
c801d85f 368#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
a626cc03
RR
369#endif
370#ifndef PNG_NO_WRITE_USER_TRANSFORM
c801d85f 371#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
a626cc03 372#endif
c801d85f
KB
373#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
374
375#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant
376 encoders, but can cause trouble
377 if left undefined */
378
a626cc03
RR
379#ifndef PNG_NO_WRITE_WEIGHTED_FILTER
380#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
381#endif
382
383#ifndef PNG_NO_WRITE_FLUSH
384#define PNG_WRITE_FLUSH_SUPPORTED
385#endif
386
387#ifndef PNG_NO_STDIO
c801d85f
KB
388#define PNG_TIME_RFC1123_SUPPORTED
389#endif
390
391/* This adds extra functions in pngget.c for accessing data from the
392 * info pointer (added in version 0.99)
393 * png_get_image_width()
394 * png_get_image_height()
395 * png_get_bit_depth()
396 * png_get_color_type()
397 * png_get_compression_type()
398 * png_get_filter_type()
399 * png_get_interlace_type()
400 * png_get_pixel_aspect_ratio()
401 * png_get_pixels_per_meter()
402 * png_get_x_offset_pixels()
403 * png_get_y_offset_pixels()
404 * png_get_x_offset_microns()
405 * png_get_y_offset_microns()
406 */
a626cc03 407#ifndef PNG_NO_EASY_ACCESS
c801d85f
KB
408#define PNG_EASY_ACCESS_SUPPORTED
409#endif
410
411/* These are currently experimental features, define them if you want */
412
413/* very little testing */
414/*
415#define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
a626cc03 416#define PNG_USER_MEM_SUPPORTED
c801d85f
KB
417*/
418
419/* This is only for PowerPC big-endian and 680x0 systems */
420/* some testing */
421/*
422#define PNG_READ_BIG_ENDIAN_SUPPORTED
423*/
424
425/* These functions are turned off by default, as they will be phased out. */
426/*
427#define PNG_USELESS_TESTS_SUPPORTED
428#define PNG_CORRECT_PALETTE_SUPPORTED
429*/
430
431/* Any chunks you are not interested in, you can undef here. The
432 * ones that allocate memory may be expecially important (hIST,
433 * tEXt, zTXt, tRNS, pCAL). Others will just save time and make png_info
434 * a bit smaller.
435 */
436
a626cc03
RR
437#if !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
438 !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
c801d85f
KB
439#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
440#endif
a626cc03
RR
441#if !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
442 !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
c801d85f
KB
443#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
444#endif
445
446#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
a626cc03 447#ifndef PNG_NO_READ_bKGD
c801d85f 448#define PNG_READ_bKGD_SUPPORTED
a626cc03
RR
449#endif
450#ifndef PNG_NO_READ_cHRM
c801d85f 451#define PNG_READ_cHRM_SUPPORTED
a626cc03
RR
452#endif
453#ifndef PNG_NO_READ_gAMA
c801d85f 454#define PNG_READ_gAMA_SUPPORTED
a626cc03
RR
455#endif
456#ifndef PNG_NO_READ_hIST
c801d85f 457#define PNG_READ_hIST_SUPPORTED
a626cc03
RR
458#endif
459#ifndef PNG_NO_READ_oFFs
c801d85f 460#define PNG_READ_oFFs_SUPPORTED
a626cc03
RR
461#endif
462#ifndef PNG_NO_READ_pCAL
c801d85f 463#define PNG_READ_pCAL_SUPPORTED
a626cc03
RR
464#endif
465#ifndef PNG_NO_READ_pHYs
c801d85f 466#define PNG_READ_pHYs_SUPPORTED
a626cc03
RR
467#endif
468#ifndef PNG_NO_READ_sBIT
c801d85f 469#define PNG_READ_sBIT_SUPPORTED
a626cc03
RR
470#endif
471#ifndef PNG_NO_READ_sRGB
c801d85f 472#define PNG_READ_sRGB_SUPPORTED
a626cc03
RR
473#endif
474#ifndef PNG_NO_READ_tEXt
c801d85f 475#define PNG_READ_tEXt_SUPPORTED
a626cc03
RR
476#endif
477#ifndef PNG_NO_READ_tIME
c801d85f 478#define PNG_READ_tIME_SUPPORTED
a626cc03
RR
479#endif
480#ifndef PNG_NO_READ_tRNS
c801d85f 481#define PNG_READ_tRNS_SUPPORTED
a626cc03
RR
482#endif
483#ifndef PNG_NO_READ_zTXt
c801d85f 484#define PNG_READ_zTXt_SUPPORTED
a626cc03
RR
485#endif
486#ifndef PNG_NO_READ_OPT_PLTE
c801d85f 487#define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the optional */
a626cc03 488#endif /* PLTE chunk in RGB and RGBA images */
c801d85f
KB
489#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
490
491#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
a626cc03 492#ifndef PNG_NO_WRITE_bKGD
c801d85f 493#define PNG_WRITE_bKGD_SUPPORTED
a626cc03
RR
494#endif
495#ifndef PNG_NO_WRITE_cHRM
c801d85f 496#define PNG_WRITE_cHRM_SUPPORTED
a626cc03
RR
497#endif
498#ifndef PNG_NO_WRITE_gAMA
c801d85f 499#define PNG_WRITE_gAMA_SUPPORTED
a626cc03
RR
500#endif
501#ifndef PNG_NO_WRITE_hIST
c801d85f 502#define PNG_WRITE_hIST_SUPPORTED
a626cc03
RR
503#endif
504#ifndef PNG_NO_WRITE_oFFs
c801d85f 505#define PNG_WRITE_oFFs_SUPPORTED
a626cc03
RR
506#endif
507#ifndef PNG_NO_WRITE_pCAL
c801d85f 508#define PNG_WRITE_pCAL_SUPPORTED
a626cc03
RR
509#endif
510#ifndef PNG_NO_WRITE_pHYs
c801d85f 511#define PNG_WRITE_pHYs_SUPPORTED
a626cc03
RR
512#endif
513#ifndef PNG_NO_WRITE_sBIT
c801d85f 514#define PNG_WRITE_sBIT_SUPPORTED
a626cc03
RR
515#endif
516#ifndef PNG_NO_WRITE_sRGB
c801d85f 517#define PNG_WRITE_sRGB_SUPPORTED
a626cc03
RR
518#endif
519#ifndef PNG_NO_WRITE_tEXt
c801d85f 520#define PNG_WRITE_tEXt_SUPPORTED
a626cc03
RR
521#endif
522#ifndef PNG_NO_WRITE_tIME
c801d85f 523#define PNG_WRITE_tIME_SUPPORTED
a626cc03
RR
524#endif
525#ifndef PNG_NO_WRITE_tRNS
c801d85f 526#define PNG_WRITE_tRNS_SUPPORTED
a626cc03
RR
527#endif
528#ifndef PNG_NO_WRITE_zTXt
c801d85f 529#define PNG_WRITE_zTXt_SUPPORTED
a626cc03 530#endif
c801d85f
KB
531#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
532
533/* need the time information for reading tIME chunks */
534#if defined(PNG_READ_tIME_SUPPORTED) || defined(PNG_WRITE_tIME_SUPPORTED)
535#include <time.h>
536#endif
537
538/* Some typedefs to get us started. These should be safe on most of the
539 * common platforms. The typedefs should be at least as large as the
540 * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
541 * don't have to be exactly that size. Some compilers dislike passing
542 * unsigned shorts as function parameters, so you may be better off using
543 * unsigned int for png_uint_16. Likewise, for 64-bit systems, you may
544 * want to have unsigned int for png_uint_32 instead of unsigned long.
545 */
546
547typedef unsigned long png_uint_32;
548typedef long png_int_32;
549typedef unsigned short png_uint_16;
550typedef short png_int_16;
551typedef unsigned char png_byte;
552
553/* This is usually size_t. It is typedef'ed just in case you need it to
554 change (I'm not sure if you will or not, so I thought I'd be safe) */
555typedef size_t png_size_t;
556
557/* The following is needed for medium model support. It cannot be in the
558 * PNG_INTERNAL section. Needs modification for other compilers besides
559 * MSC. Model independent support declares all arrays and pointers to be
560 * large using the far keyword. The zlib version used must also support
561 * model independent data. As of version zlib 1.0.4, the necessary changes
562 * have been made in zlib. The USE_FAR_KEYWORD define triggers other
563 * changes that are needed. (Tim Wegner)
564 */
565
566/* Separate compiler dependencies (problem here is that zlib.h always
567 defines FAR. (SJT) */
568#ifdef __BORLANDC__
569#if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
570#define LDATA 1
571#else
572#define LDATA 0
573#endif
574
575#if !defined(__WIN32__) && !defined(__FLAT__)
576#define PNG_MAX_MALLOC_64K
577#if (LDATA != 1)
578#ifndef FAR
579#define FAR __far
580#endif
581#define USE_FAR_KEYWORD
582#endif /* LDATA != 1 */
583
584/* Possibly useful for moving data out of default segment.
585 * Uncomment it if you want. Could also define FARDATA as
586 * const if your compiler supports it. (SJT)
587# define FARDATA FAR
588 */
589#endif /* __WIN32__, __FLAT__ */
590
591#endif /* __BORLANDC__ */
592
593
594/* Suggest testing for specific compiler first before testing for
595 * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
596 * making reliance oncertain keywords suspect. (SJT)
597 */
598
599/* MSC Medium model */
600#if defined(FAR)
601# if defined(M_I86MM)
602# define USE_FAR_KEYWORD
603# define FARDATA FAR
604# include <dos.h>
605# endif
606#endif
607
608/* SJT: default case */
609#ifndef FAR
610# define FAR
611#endif
612
613/* At this point FAR is always defined */
614#ifndef FARDATA
615#define FARDATA
616#endif
617
618/* Add typedefs for pointers */
619typedef void FAR * png_voidp;
620typedef png_byte FAR * png_bytep;
621typedef png_uint_32 FAR * png_uint_32p;
622typedef png_int_32 FAR * png_int_32p;
623typedef png_uint_16 FAR * png_uint_16p;
624typedef png_int_16 FAR * png_int_16p;
625typedef PNG_CONST char FAR * png_const_charp;
626typedef char FAR * png_charp;
627typedef double FAR * png_doublep;
628
629/* Pointers to pointers; i.e. arrays */
630typedef png_byte FAR * FAR * png_bytepp;
631typedef png_uint_32 FAR * FAR * png_uint_32pp;
632typedef png_int_32 FAR * FAR * png_int_32pp;
633typedef png_uint_16 FAR * FAR * png_uint_16pp;
634typedef png_int_16 FAR * FAR * png_int_16pp;
635typedef PNG_CONST char FAR * FAR * png_const_charpp;
636typedef char FAR * FAR * png_charpp;
637typedef double FAR * FAR * png_doublepp;
638
639/* Pointers to pointers to pointers; i.e. pointer to array */
640typedef char FAR * FAR * FAR * png_charppp;
641
642/* libpng typedefs for types in zlib. If zlib changes
643 * or another compression library is used, then change these.
644 * Eliminates need to change all the source files.
645 */
646typedef charf * png_zcharp;
647typedef charf * FAR * png_zcharpp;
a626cc03 648typedef z_stream FAR * png_zstreamp;
c801d85f
KB
649
650/* allow for compilation as dll under MS Windows */
651#ifdef __WIN32DLL__
652#define PNG_EXPORT(type,symbol) __declspec(dllexport) type symbol
653#endif
654
655/* allow for compilation as dll with BORLAND C++ 5.0 */
656#if defined(__BORLANDC__) && defined(_Windows) && defined(__DLL__)
657# define PNG_EXPORT(type,symbol) type _export symbol
658#endif
659
660/* allow for compilation as shared lib under BeOS */
661#ifdef __BEOSDLL__
662#define PNG_EXPORT(type,symbol) __declspec(export) type symbol
663#endif
664
665#ifndef PNG_EXPORT
666#define PNG_EXPORT(type,symbol) type symbol
667#endif
668
669
670/* User may want to use these so not in PNG_INTERNAL. Any library functions
671 * that are passed far data must be model independent.
672 */
673
674#if defined(USE_FAR_KEYWORD) /* memory model independent fns */
675/* use this to make far-to-near assignments */
676# define CHECK 1
677# define NOCHECK 0
678# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
679# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
a626cc03 680# define png_strcpy _fstrcpy
c801d85f
KB
681# define png_strlen _fstrlen
682# define png_memcmp _fmemcmp /* SJT: added */
683# define png_memcpy _fmemcpy
684# define png_memset _fmemset
685#else /* use the usual functions */
686# define CVT_PTR(ptr) (ptr)
687# define CVT_PTR_NOCHECK(ptr) (ptr)
a626cc03 688# define png_strcpy strcpy
c801d85f
KB
689# define png_strlen strlen
690# define png_memcmp memcmp /* SJT: added */
691# define png_memcpy memcpy
692# define png_memset memset
693#endif
694/* End of memory model independent support */
695
696/* Just a double check that someone hasn't tried to define something
a626cc03 697 * contradictory.
c801d85f
KB
698 */
699#if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K)
700#undef PNG_ZBUF_SIZE
701#define PNG_ZBUF_SIZE 65536
702#endif
703
704#endif /* PNGCONF_H */
705