syslinux-3.08-2 sources from FC4
[bootcd.git] / syslinux / com32 / include / pngconf.h
1
2 /* pngconf.h - machine configurable file for libpng
3  *
4  * libpng version 1.2.8 - December 3, 2004
5  * For conditions of distribution and use, see copyright notice in png.h
6  * Copyright (c) 1998-2004 Glenn Randers-Pehrson
7  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
8  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
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
20 #define PNG_1_2_X
21
22 /* 
23  * PNG_USER_CONFIG has to be defined on the compiler command line. This
24  * includes the resource compiler for Windows DLL configurations.
25  */
26 #ifdef PNG_USER_CONFIG
27 #include "pngusr.h"
28 #endif
29
30 /*
31  * Added at libpng-1.2.8
32  *  
33  * If you create a private DLL you need to define in "pngusr.h" the followings:
34  * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
35  *        the DLL was built>
36  *  e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
37  * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to
38  *        distinguish your DLL from those of the official release. These
39  *        correspond to the trailing letters that come after the version
40  *        number and must match your private DLL name>
41  *  e.g. // private DLL "libpng13gx.dll"
42  *       #define PNG_USER_DLLFNAME_POSTFIX "gx"
43  * 
44  * The following macros are also at your disposal if you want to complete the 
45  * DLL VERSIONINFO structure.
46  * - PNG_USER_VERSIONINFO_COMMENTS
47  * - PNG_USER_VERSIONINFO_COMPANYNAME
48  * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS
49  */
50
51 #ifdef __STDC__
52 #ifdef SPECIALBUILD
53 #  pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\
54  are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.")
55 #endif
56
57 #ifdef PRIVATEBUILD
58 # pragma message("PRIVATEBUILD is deprecated. Use\
59  PNG_USER_PRIVATEBUILD instead.")
60 # define PNG_USER_PRIVATEBUILD PRIVATEBUILD
61 #endif
62 #endif /* __STDC__ */
63
64 #ifndef PNG_VERSION_INFO_ONLY
65
66 /* End of material added to libpng-1.2.8 */
67
68 /* This is the size of the compression buffer, and thus the size of
69  * an IDAT chunk.  Make this whatever size you feel is best for your
70  * machine.  One of these will be allocated per png_struct.  When this
71  * is full, it writes the data to the disk, and does some other
72  * calculations.  Making this an extremely small size will slow
73  * the library down, but you may want to experiment to determine
74  * where it becomes significant, if you are concerned with memory
75  * usage.  Note that zlib allocates at least 32Kb also.  For readers,
76  * this describes the size of the buffer available to read the data in.
77  * Unless this gets smaller than the size of a row (compressed),
78  * it should not make much difference how big this is.
79  */
80
81 #ifndef PNG_ZBUF_SIZE
82 #  define PNG_ZBUF_SIZE 8192
83 #endif
84
85 /* Enable if you want a write-only libpng */
86
87 #ifndef PNG_NO_READ_SUPPORTED
88 #  define PNG_READ_SUPPORTED
89 #endif
90
91 /* Enable if you want a read-only libpng */
92
93 #ifndef PNG_NO_WRITE_SUPPORTED
94 #  define PNG_WRITE_SUPPORTED
95 #endif
96
97 /* Enabled by default in 1.2.0.  You can disable this if you don't need to
98    support PNGs that are embedded in MNG datastreams */
99 #if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
100 #  ifndef PNG_MNG_FEATURES_SUPPORTED
101 #    define PNG_MNG_FEATURES_SUPPORTED
102 #  endif
103 #endif
104
105 #ifndef PNG_NO_FLOATING_POINT_SUPPORTED
106 #  ifndef PNG_FLOATING_POINT_SUPPORTED
107 #    define PNG_FLOATING_POINT_SUPPORTED
108 #  endif
109 #endif
110
111 /* If you are running on a machine where you cannot allocate more
112  * than 64K of memory at once, uncomment this.  While libpng will not
113  * normally need that much memory in a chunk (unless you load up a very
114  * large file), zlib needs to know how big of a chunk it can use, and
115  * libpng thus makes sure to check any memory allocation to verify it
116  * will fit into memory.
117 #define PNG_MAX_MALLOC_64K
118  */
119 #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
120 #  define PNG_MAX_MALLOC_64K
121 #endif
122
123 /* Special munging to support doing things the 'cygwin' way:
124  * 'Normal' png-on-win32 defines/defaults:
125  *   PNG_BUILD_DLL -- building dll
126  *   PNG_USE_DLL   -- building an application, linking to dll
127  *   (no define)   -- building static library, or building an
128  *                    application and linking to the static lib
129  * 'Cygwin' defines/defaults:
130  *   PNG_BUILD_DLL -- (ignored) building the dll
131  *   (no define)   -- (ignored) building an application, linking to the dll
132  *   PNG_STATIC    -- (ignored) building the static lib, or building an 
133  *                    application that links to the static lib.
134  *   ALL_STATIC    -- (ignored) building various static libs, or building an 
135  *                    application that links to the static libs.
136  * Thus,
137  * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
138  * this bit of #ifdefs will define the 'correct' config variables based on
139  * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
140  * unnecessary.
141  *
142  * Also, the precedence order is:
143  *   ALL_STATIC (since we can't #undef something outside our namespace)
144  *   PNG_BUILD_DLL
145  *   PNG_STATIC
146  *   (nothing) == PNG_USE_DLL
147  * 
148  * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
149  *   of auto-import in binutils, we no longer need to worry about 
150  *   __declspec(dllexport) / __declspec(dllimport) and friends.  Therefore,
151  *   we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
152  *   to __declspec() stuff.  However, we DO need to worry about 
153  *   PNG_BUILD_DLL and PNG_STATIC because those change some defaults
154  *   such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
155  */
156 #if defined(__CYGWIN__)
157 #  if defined(ALL_STATIC)
158 #    if defined(PNG_BUILD_DLL)
159 #      undef PNG_BUILD_DLL
160 #    endif
161 #    if defined(PNG_USE_DLL)
162 #      undef PNG_USE_DLL
163 #    endif
164 #    if defined(PNG_DLL)
165 #      undef PNG_DLL
166 #    endif
167 #    if !defined(PNG_STATIC)
168 #      define PNG_STATIC
169 #    endif
170 #  else
171 #    if defined (PNG_BUILD_DLL)
172 #      if defined(PNG_STATIC)
173 #        undef PNG_STATIC
174 #      endif
175 #      if defined(PNG_USE_DLL)
176 #        undef PNG_USE_DLL
177 #      endif
178 #      if !defined(PNG_DLL)
179 #        define PNG_DLL
180 #      endif
181 #    else
182 #      if defined(PNG_STATIC)
183 #        if defined(PNG_USE_DLL)
184 #          undef PNG_USE_DLL
185 #        endif
186 #        if defined(PNG_DLL)
187 #          undef PNG_DLL
188 #        endif
189 #      else
190 #        if !defined(PNG_USE_DLL)
191 #          define PNG_USE_DLL
192 #        endif
193 #        if !defined(PNG_DLL)
194 #          define PNG_DLL
195 #        endif
196 #      endif  
197 #    endif  
198 #  endif
199 #endif
200
201 /* This protects us against compilers that run on a windowing system
202  * and thus don't have or would rather us not use the stdio types:
203  * stdin, stdout, and stderr.  The only one currently used is stderr
204  * in png_error() and png_warning().  #defining PNG_NO_CONSOLE_IO will
205  * prevent these from being compiled and used. #defining PNG_NO_STDIO
206  * will also prevent these, plus will prevent the entire set of stdio
207  * macros and functions (FILE *, printf, etc.) from being compiled and used,
208  * unless (PNG_DEBUG > 0) has been #defined.
209  *
210  * #define PNG_NO_CONSOLE_IO
211  * #define PNG_NO_STDIO
212  */
213
214 #if defined(_WIN32_WCE)
215 #  include <windows.h>
216    /* Console I/O functions are not supported on WindowsCE */
217 #  define PNG_NO_CONSOLE_IO
218 #  ifdef PNG_DEBUG
219 #    undef PNG_DEBUG
220 #  endif
221 #endif
222
223 #ifdef PNG_BUILD_DLL
224 #  ifndef PNG_CONSOLE_IO_SUPPORTED
225 #    ifndef PNG_NO_CONSOLE_IO
226 #      define PNG_NO_CONSOLE_IO
227 #    endif
228 #  endif
229 #endif
230
231 #  ifdef PNG_NO_STDIO
232 #    ifndef PNG_NO_CONSOLE_IO
233 #      define PNG_NO_CONSOLE_IO
234 #    endif
235 #    ifdef PNG_DEBUG
236 #      if (PNG_DEBUG > 0)
237 #        include <stdio.h>
238 #      endif
239 #    endif
240 #  else
241 #    if !defined(_WIN32_WCE)
242 /* "stdio.h" functions are not supported on WindowsCE */
243 #      include <stdio.h>
244 #    endif
245 #  endif
246
247 /* This macro protects us against machines that don't have function
248  * prototypes (ie K&R style headers).  If your compiler does not handle
249  * function prototypes, define this macro and use the included ansi2knr.
250  * I've always been able to use _NO_PROTO as the indicator, but you may
251  * need to drag the empty declaration out in front of here, or change the
252  * ifdef to suit your own needs.
253  */
254 #ifndef PNGARG
255
256 #ifdef OF /* zlib prototype munger */
257 #  define PNGARG(arglist) OF(arglist)
258 #else
259
260 #ifdef _NO_PROTO
261 #  define PNGARG(arglist) ()
262 #  ifndef PNG_TYPECAST_NULL
263 #     define PNG_TYPECAST_NULL
264 #  endif
265 #else
266 #  define PNGARG(arglist) arglist
267 #endif /* _NO_PROTO */
268
269 #endif /* OF */
270
271 #endif /* PNGARG */
272
273 /* Try to determine if we are compiling on a Mac.  Note that testing for
274  * just __MWERKS__ is not good enough, because the Codewarrior is now used
275  * on non-Mac platforms.
276  */
277 #ifndef MACOS
278 #  if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
279       defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
280 #    define MACOS
281 #  endif
282 #endif
283
284 /* enough people need this for various reasons to include it here */
285 #if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
286 #  include <sys/types.h>
287 #endif
288
289 #if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
290 #  define PNG_SETJMP_SUPPORTED
291 #endif
292
293 #ifdef PNG_SETJMP_SUPPORTED
294 /* This is an attempt to force a single setjmp behaviour on Linux.  If
295  * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
296  */
297
298 #  ifdef __linux__
299 #    ifdef _BSD_SOURCE
300 #      define PNG_SAVE_BSD_SOURCE
301 #      undef _BSD_SOURCE
302 #    endif
303 #    ifdef _SETJMP_H
304      /* If you encounter a compiler error here, see the explanation
305       * near the end of INSTALL.
306       */
307          __png.h__ already includes setjmp.h;
308          __dont__ include it again.;
309 #    endif
310 #  endif /* __linux__ */
311
312    /* include setjmp.h for error handling */
313 #  include <setjmp.h>
314
315 #  ifdef __linux__
316 #    ifdef PNG_SAVE_BSD_SOURCE
317 #      define _BSD_SOURCE
318 #      undef PNG_SAVE_BSD_SOURCE
319 #    endif
320 #  endif /* __linux__ */
321 #endif /* PNG_SETJMP_SUPPORTED */
322
323 #ifdef BSD
324 #  include <strings.h>
325 #else
326 #  include <string.h>
327 #endif
328
329 /* Other defines for things like memory and the like can go here.  */
330 #ifdef PNG_INTERNAL
331
332 #include <stdlib.h>
333
334 /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
335  * aren't usually used outside the library (as far as I know), so it is
336  * debatable if they should be exported at all.  In the future, when it is
337  * possible to have run-time registry of chunk-handling functions, some of
338  * these will be made available again.
339 #define PNG_EXTERN extern
340  */
341 #define PNG_EXTERN
342
343 /* Other defines specific to compilers can go here.  Try to keep
344  * them inside an appropriate ifdef/endif pair for portability.
345  */
346
347 #if defined(PNG_FLOATING_POINT_SUPPORTED)
348 #  if defined(MACOS)
349      /* We need to check that <math.h> hasn't already been included earlier
350       * as it seems it doesn't agree with <fp.h>, yet we should really use
351       * <fp.h> if possible.
352       */
353 #    if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
354 #      include <fp.h>
355 #    endif
356 #  else
357 #    include <math.h>
358 #  endif
359 #  if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
360      /* Amiga SAS/C: We must include builtin FPU functions when compiling using
361       * MATH=68881
362       */
363 #    include <m68881.h>
364 #  endif
365 #endif
366
367 /* Codewarrior on NT has linking problems without this. */
368 #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
369 #  define PNG_ALWAYS_EXTERN
370 #endif
371
372 /* This provides the non-ANSI (far) memory allocation routines. */
373 #if defined(__TURBOC__) && defined(__MSDOS__)
374 #  include <mem.h>
375 #  include <alloc.h>
376 #endif
377
378 /* I have no idea why is this necessary... */
379 #if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \
380     defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__))
381 #  include <malloc.h>
382 #endif
383
384 /* This controls how fine the dithering gets.  As this allocates
385  * a largish chunk of memory (32K), those who are not as concerned
386  * with dithering quality can decrease some or all of these.
387  */
388 #ifndef PNG_DITHER_RED_BITS
389 #  define PNG_DITHER_RED_BITS 5
390 #endif
391 #ifndef PNG_DITHER_GREEN_BITS
392 #  define PNG_DITHER_GREEN_BITS 5
393 #endif
394 #ifndef PNG_DITHER_BLUE_BITS
395 #  define PNG_DITHER_BLUE_BITS 5
396 #endif
397
398 /* This controls how fine the gamma correction becomes when you
399  * are only interested in 8 bits anyway.  Increasing this value
400  * results in more memory being used, and more pow() functions
401  * being called to fill in the gamma tables.  Don't set this value
402  * less then 8, and even that may not work (I haven't tested it).
403  */
404
405 #ifndef PNG_MAX_GAMMA_8
406 #  define PNG_MAX_GAMMA_8 11
407 #endif
408
409 /* This controls how much a difference in gamma we can tolerate before
410  * we actually start doing gamma conversion.
411  */
412 #ifndef PNG_GAMMA_THRESHOLD
413 #  define PNG_GAMMA_THRESHOLD 0.05
414 #endif
415
416 #endif /* PNG_INTERNAL */
417
418 /* The following uses const char * instead of char * for error
419  * and warning message functions, so some compilers won't complain.
420  * If you do not want to use const, define PNG_NO_CONST here.
421  */
422
423 #ifndef PNG_NO_CONST
424 #  define PNG_CONST const
425 #else
426 #  define PNG_CONST
427 #endif
428
429 /* The following defines give you the ability to remove code from the
430  * library that you will not be using.  I wish I could figure out how to
431  * automate this, but I can't do that without making it seriously hard
432  * on the users.  So if you are not using an ability, change the #define
433  * to and #undef, and that part of the library will not be compiled.  If
434  * your linker can't find a function, you may want to make sure the
435  * ability is defined here.  Some of these depend upon some others being
436  * defined.  I haven't figured out all the interactions here, so you may
437  * have to experiment awhile to get everything to compile.  If you are
438  * creating or using a shared library, you probably shouldn't touch this,
439  * as it will affect the size of the structures, and this will cause bad
440  * things to happen if the library and/or application ever change.
441  */
442
443 /* Any features you will not be using can be undef'ed here */
444
445 /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
446  * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
447  * on the compile line, then pick and choose which ones to define without
448  * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
449  * if you only want to have a png-compliant reader/writer but don't need
450  * any of the extra transformations.  This saves about 80 kbytes in a
451  * typical installation of the library. (PNG_NO_* form added in version
452  * 1.0.1c, for consistency)
453  */
454
455 /* The size of the png_text structure changed in libpng-1.0.6 when
456  * iTXt is supported.  It is turned off by default, to support old apps
457  * that malloc the png_text structure instead of calling png_set_text()
458  * and letting libpng malloc it.  It will be turned on by default in
459  * libpng-1.3.0.
460  */
461
462 #ifndef PNG_iTXt_SUPPORTED
463 #  if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
464 #    define PNG_NO_READ_iTXt
465 #  endif
466 #  if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
467 #    define PNG_NO_WRITE_iTXt
468 #  endif
469 #endif
470
471 /* The following support, added after version 1.0.0, can be turned off here en
472  * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
473  * with old applications that require the length of png_struct and png_info
474  * to remain unchanged.
475  */
476
477 #ifdef PNG_LEGACY_SUPPORTED
478 #  define PNG_NO_FREE_ME
479 #  define PNG_NO_READ_UNKNOWN_CHUNKS
480 #  define PNG_NO_WRITE_UNKNOWN_CHUNKS
481 #  define PNG_NO_READ_USER_CHUNKS
482 #  define PNG_NO_READ_iCCP
483 #  define PNG_NO_WRITE_iCCP
484 #  define PNG_NO_READ_iTXt
485 #  define PNG_NO_WRITE_iTXt
486 #  define PNG_NO_READ_sCAL
487 #  define PNG_NO_WRITE_sCAL
488 #  define PNG_NO_READ_sPLT
489 #  define PNG_NO_WRITE_sPLT
490 #  define PNG_NO_INFO_IMAGE
491 #  define PNG_NO_READ_RGB_TO_GRAY
492 #  define PNG_NO_READ_USER_TRANSFORM
493 #  define PNG_NO_WRITE_USER_TRANSFORM
494 #  define PNG_NO_USER_MEM
495 #  define PNG_NO_READ_EMPTY_PLTE
496 #  define PNG_NO_MNG_FEATURES
497 #  define PNG_NO_FIXED_POINT_SUPPORTED
498 #endif
499
500 /* Ignore attempt to turn off both floating and fixed point support */
501 #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
502     !defined(PNG_NO_FIXED_POINT_SUPPORTED)
503 #  define PNG_FIXED_POINT_SUPPORTED
504 #endif
505
506 #ifndef PNG_NO_FREE_ME
507 #  define PNG_FREE_ME_SUPPORTED
508 #endif
509
510 #if defined(PNG_READ_SUPPORTED)
511
512 #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
513       !defined(PNG_NO_READ_TRANSFORMS)
514 #  define PNG_READ_TRANSFORMS_SUPPORTED
515 #endif
516
517 #ifdef PNG_READ_TRANSFORMS_SUPPORTED
518 #  ifndef PNG_NO_READ_EXPAND
519 #    define PNG_READ_EXPAND_SUPPORTED
520 #  endif
521 #  ifndef PNG_NO_READ_SHIFT
522 #    define PNG_READ_SHIFT_SUPPORTED
523 #  endif
524 #  ifndef PNG_NO_READ_PACK
525 #    define PNG_READ_PACK_SUPPORTED
526 #  endif
527 #  ifndef PNG_NO_READ_BGR
528 #    define PNG_READ_BGR_SUPPORTED
529 #  endif
530 #  ifndef PNG_NO_READ_SWAP
531 #    define PNG_READ_SWAP_SUPPORTED
532 #  endif
533 #  ifndef PNG_NO_READ_PACKSWAP
534 #    define PNG_READ_PACKSWAP_SUPPORTED
535 #  endif
536 #  ifndef PNG_NO_READ_INVERT
537 #    define PNG_READ_INVERT_SUPPORTED
538 #  endif
539 #  ifndef PNG_NO_READ_DITHER
540 #    define PNG_READ_DITHER_SUPPORTED
541 #  endif
542 #  ifndef PNG_NO_READ_BACKGROUND
543 #    define PNG_READ_BACKGROUND_SUPPORTED
544 #  endif
545 #  ifndef PNG_NO_READ_16_TO_8
546 #    define PNG_READ_16_TO_8_SUPPORTED
547 #  endif
548 #  ifndef PNG_NO_READ_FILLER
549 #    define PNG_READ_FILLER_SUPPORTED
550 #  endif
551 #  ifndef PNG_NO_READ_GAMMA
552 #    define PNG_READ_GAMMA_SUPPORTED
553 #  endif
554 #  ifndef PNG_NO_READ_GRAY_TO_RGB
555 #    define PNG_READ_GRAY_TO_RGB_SUPPORTED
556 #  endif
557 #  ifndef PNG_NO_READ_SWAP_ALPHA
558 #    define PNG_READ_SWAP_ALPHA_SUPPORTED
559 #  endif
560 #  ifndef PNG_NO_READ_INVERT_ALPHA
561 #    define PNG_READ_INVERT_ALPHA_SUPPORTED
562 #  endif
563 #  ifndef PNG_NO_READ_STRIP_ALPHA
564 #    define PNG_READ_STRIP_ALPHA_SUPPORTED
565 #  endif
566 #  ifndef PNG_NO_READ_USER_TRANSFORM
567 #    define PNG_READ_USER_TRANSFORM_SUPPORTED
568 #  endif
569 #  ifndef PNG_NO_READ_RGB_TO_GRAY
570 #    define PNG_READ_RGB_TO_GRAY_SUPPORTED
571 #  endif
572 #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
573
574 #if !defined(PNG_NO_PROGRESSIVE_READ) && \
575  !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED)  /* if you don't do progressive */
576 #  define PNG_PROGRESSIVE_READ_SUPPORTED     /* reading.  This is not talking */
577 #endif                               /* about interlacing capability!  You'll */
578               /* still have interlacing unless you change the following line: */
579
580 #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
581
582 #ifndef PNG_NO_READ_COMPOSITE_NODIV
583 #  ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */
584 #    define PNG_READ_COMPOSITE_NODIV_SUPPORTED   /* well tested on Intel, SGI */
585 #  endif
586 #endif
587
588 /* Deprecated, will be removed from version 2.0.0.
589    Use PNG_MNG_FEATURES_SUPPORTED instead. */
590 #ifndef PNG_NO_READ_EMPTY_PLTE
591 #  define PNG_READ_EMPTY_PLTE_SUPPORTED
592 #endif
593
594 #endif /* PNG_READ_SUPPORTED */
595
596 #if defined(PNG_WRITE_SUPPORTED)
597
598 # if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
599     !defined(PNG_NO_WRITE_TRANSFORMS)
600 #  define PNG_WRITE_TRANSFORMS_SUPPORTED
601 #endif
602
603 #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
604 #  ifndef PNG_NO_WRITE_SHIFT
605 #    define PNG_WRITE_SHIFT_SUPPORTED
606 #  endif
607 #  ifndef PNG_NO_WRITE_PACK
608 #    define PNG_WRITE_PACK_SUPPORTED
609 #  endif
610 #  ifndef PNG_NO_WRITE_BGR
611 #    define PNG_WRITE_BGR_SUPPORTED
612 #  endif
613 #  ifndef PNG_NO_WRITE_SWAP
614 #    define PNG_WRITE_SWAP_SUPPORTED
615 #  endif
616 #  ifndef PNG_NO_WRITE_PACKSWAP
617 #    define PNG_WRITE_PACKSWAP_SUPPORTED
618 #  endif
619 #  ifndef PNG_NO_WRITE_INVERT
620 #    define PNG_WRITE_INVERT_SUPPORTED
621 #  endif
622 #  ifndef PNG_NO_WRITE_FILLER
623 #    define PNG_WRITE_FILLER_SUPPORTED   /* same as WRITE_STRIP_ALPHA */
624 #  endif
625 #  ifndef PNG_NO_WRITE_SWAP_ALPHA
626 #    define PNG_WRITE_SWAP_ALPHA_SUPPORTED
627 #  endif
628 #  ifndef PNG_NO_WRITE_INVERT_ALPHA
629 #    define PNG_WRITE_INVERT_ALPHA_SUPPORTED
630 #  endif
631 #  ifndef PNG_NO_WRITE_USER_TRANSFORM
632 #    define PNG_WRITE_USER_TRANSFORM_SUPPORTED
633 #  endif
634 #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
635
636 #define PNG_WRITE_INTERLACING_SUPPORTED  /* not required for PNG-compliant
637                                             encoders, but can cause trouble
638                                             if left undefined */
639
640 #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
641      defined(PNG_FLOATING_POINT_SUPPORTED)
642 #  define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
643 #endif
644
645 #ifndef PNG_NO_WRITE_FLUSH
646 #  define PNG_WRITE_FLUSH_SUPPORTED
647 #endif
648
649 /* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
650 #ifndef PNG_NO_WRITE_EMPTY_PLTE
651 #  define PNG_WRITE_EMPTY_PLTE_SUPPORTED
652 #endif
653
654 #endif /* PNG_WRITE_SUPPORTED */
655
656 #ifndef PNG_1_0_X
657 #  ifndef PNG_NO_ERROR_NUMBERS
658 #    define PNG_ERROR_NUMBERS_SUPPORTED
659 #  endif
660 #endif /* PNG_1_0_X */
661
662 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
663     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
664 #  ifndef PNG_NO_USER_TRANSFORM_PTR
665 #    define PNG_USER_TRANSFORM_PTR_SUPPORTED
666 #  endif
667 #endif
668
669 #ifndef PNG_NO_STDIO
670 #  define PNG_TIME_RFC1123_SUPPORTED
671 #endif
672
673 /* This adds extra functions in pngget.c for accessing data from the
674  * info pointer (added in version 0.99)
675  * png_get_image_width()
676  * png_get_image_height()
677  * png_get_bit_depth()
678  * png_get_color_type()
679  * png_get_compression_type()
680  * png_get_filter_type()
681  * png_get_interlace_type()
682  * png_get_pixel_aspect_ratio()
683  * png_get_pixels_per_meter()
684  * png_get_x_offset_pixels()
685  * png_get_y_offset_pixels()
686  * png_get_x_offset_microns()
687  * png_get_y_offset_microns()
688  */
689 #if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
690 #  define PNG_EASY_ACCESS_SUPPORTED
691 #endif
692
693 /* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0 
694    even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */
695 #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
696 #  ifndef PNG_ASSEMBLER_CODE_SUPPORTED
697 #    define PNG_ASSEMBLER_CODE_SUPPORTED
698 #  endif
699 #  if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
700 #    define PNG_MMX_CODE_SUPPORTED
701 #  endif
702 #endif
703
704 /* If you are sure that you don't need thread safety and you are compiling
705    with PNG_USE_PNGCCRD for an MMX application, you can define this for
706    faster execution.  See pnggccrd.c.
707 #define PNG_THREAD_UNSAFE_OK
708 */
709
710 #if !defined(PNG_1_0_X)
711 #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
712 #  define PNG_USER_MEM_SUPPORTED
713 #endif
714 #endif /* PNG_1_0_X */
715
716 /* Added at libpng-1.2.6 */
717 #if !defined(PNG_1_0_X)
718 #ifndef PNG_SET_USER_LIMITS_SUPPORTED
719 #if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
720 #  define PNG_SET_USER_LIMITS_SUPPORTED
721 #endif
722 #endif
723 #endif /* PNG_1_0_X */
724
725 /* Added at libpng-1.0.16 and 1.2.6.  To accept all valid PNGS no matter
726  * how large, set these limits to 0x7fffffffL
727  */
728 #ifndef PNG_USER_WIDTH_MAX
729 #  define PNG_USER_WIDTH_MAX 1000000L
730 #endif
731 #ifndef PNG_USER_HEIGHT_MAX
732 #  define PNG_USER_HEIGHT_MAX 1000000L
733 #endif
734
735 /* These are currently experimental features, define them if you want */
736
737 /* very little testing */
738 /*
739 #ifdef PNG_READ_SUPPORTED
740 #  ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
741 #    define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
742 #  endif
743 #endif
744 */
745
746 /* This is only for PowerPC big-endian and 680x0 systems */
747 /* some testing */
748 /*
749 #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
750 #  define PNG_READ_BIG_ENDIAN_SUPPORTED
751 #endif
752 */
753
754 /* Buggy compilers (e.g., gcc 2.7.2.2) need this */
755 /*
756 #define PNG_NO_POINTER_INDEXING
757 */
758
759 /* These functions are turned off by default, as they will be phased out. */
760 /*
761 #define  PNG_USELESS_TESTS_SUPPORTED
762 #define  PNG_CORRECT_PALETTE_SUPPORTED
763 */
764
765 /* Any chunks you are not interested in, you can undef here.  The
766  * ones that allocate memory may be expecially important (hIST,
767  * tEXt, zTXt, tRNS, pCAL).  Others will just save time and make png_info
768  * a bit smaller.
769  */
770
771 #if defined(PNG_READ_SUPPORTED) && \
772     !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
773     !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
774 #  define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
775 #endif
776
777 #if defined(PNG_WRITE_SUPPORTED) && \
778     !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
779     !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
780 #  define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
781 #endif
782
783 #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
784
785 #ifdef PNG_NO_READ_TEXT
786 #  define PNG_NO_READ_iTXt
787 #  define PNG_NO_READ_tEXt
788 #  define PNG_NO_READ_zTXt
789 #endif
790 #ifndef PNG_NO_READ_bKGD
791 #  define PNG_READ_bKGD_SUPPORTED
792 #  define PNG_bKGD_SUPPORTED
793 #endif
794 #ifndef PNG_NO_READ_cHRM
795 #  define PNG_READ_cHRM_SUPPORTED
796 #  define PNG_cHRM_SUPPORTED
797 #endif
798 #ifndef PNG_NO_READ_gAMA
799 #  define PNG_READ_gAMA_SUPPORTED
800 #  define PNG_gAMA_SUPPORTED
801 #endif
802 #ifndef PNG_NO_READ_hIST
803 #  define PNG_READ_hIST_SUPPORTED
804 #  define PNG_hIST_SUPPORTED
805 #endif
806 #ifndef PNG_NO_READ_iCCP
807 #  define PNG_READ_iCCP_SUPPORTED
808 #  define PNG_iCCP_SUPPORTED
809 #endif
810 #ifndef PNG_NO_READ_iTXt
811 #  ifndef PNG_READ_iTXt_SUPPORTED
812 #    define PNG_READ_iTXt_SUPPORTED
813 #  endif
814 #  ifndef PNG_iTXt_SUPPORTED
815 #    define PNG_iTXt_SUPPORTED
816 #  endif
817 #endif
818 #ifndef PNG_NO_READ_oFFs
819 #  define PNG_READ_oFFs_SUPPORTED
820 #  define PNG_oFFs_SUPPORTED
821 #endif
822 #ifndef PNG_NO_READ_pCAL
823 #  define PNG_READ_pCAL_SUPPORTED
824 #  define PNG_pCAL_SUPPORTED
825 #endif
826 #ifndef PNG_NO_READ_sCAL
827 #  define PNG_READ_sCAL_SUPPORTED
828 #  define PNG_sCAL_SUPPORTED
829 #endif
830 #ifndef PNG_NO_READ_pHYs
831 #  define PNG_READ_pHYs_SUPPORTED
832 #  define PNG_pHYs_SUPPORTED
833 #endif
834 #ifndef PNG_NO_READ_sBIT
835 #  define PNG_READ_sBIT_SUPPORTED
836 #  define PNG_sBIT_SUPPORTED
837 #endif
838 #ifndef PNG_NO_READ_sPLT
839 #  define PNG_READ_sPLT_SUPPORTED
840 #  define PNG_sPLT_SUPPORTED
841 #endif
842 #ifndef PNG_NO_READ_sRGB
843 #  define PNG_READ_sRGB_SUPPORTED
844 #  define PNG_sRGB_SUPPORTED
845 #endif
846 #ifndef PNG_NO_READ_tEXt
847 #  define PNG_READ_tEXt_SUPPORTED
848 #  define PNG_tEXt_SUPPORTED
849 #endif
850 #ifndef PNG_NO_READ_tIME
851 #  define PNG_READ_tIME_SUPPORTED
852 #  define PNG_tIME_SUPPORTED
853 #endif
854 #ifndef PNG_NO_READ_tRNS
855 #  define PNG_READ_tRNS_SUPPORTED
856 #  define PNG_tRNS_SUPPORTED
857 #endif
858 #ifndef PNG_NO_READ_zTXt
859 #  define PNG_READ_zTXt_SUPPORTED
860 #  define PNG_zTXt_SUPPORTED
861 #endif
862 #ifndef PNG_NO_READ_UNKNOWN_CHUNKS
863 #  define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
864 #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
865 #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
866 #  endif
867 #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
868 #    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
869 #  endif
870 #endif
871 #if !defined(PNG_NO_READ_USER_CHUNKS) && \
872      defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
873 #  define PNG_READ_USER_CHUNKS_SUPPORTED
874 #  define PNG_USER_CHUNKS_SUPPORTED
875 #  ifdef PNG_NO_READ_UNKNOWN_CHUNKS
876 #    undef PNG_NO_READ_UNKNOWN_CHUNKS
877 #  endif
878 #  ifdef PNG_NO_HANDLE_AS_UNKNOWN
879 #    undef PNG_NO_HANDLE_AS_UNKNOWN
880 #  endif
881 #endif
882 #ifndef PNG_NO_READ_OPT_PLTE
883 #  define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
884 #endif                      /* optional PLTE chunk in RGB and RGBA images */
885 #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
886     defined(PNG_READ_zTXt_SUPPORTED)
887 #  define PNG_READ_TEXT_SUPPORTED
888 #  define PNG_TEXT_SUPPORTED
889 #endif
890
891 #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
892
893 #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
894
895 #ifdef PNG_NO_WRITE_TEXT
896 #  define PNG_NO_WRITE_iTXt
897 #  define PNG_NO_WRITE_tEXt
898 #  define PNG_NO_WRITE_zTXt
899 #endif
900 #ifndef PNG_NO_WRITE_bKGD
901 #  define PNG_WRITE_bKGD_SUPPORTED
902 #  ifndef PNG_bKGD_SUPPORTED
903 #    define PNG_bKGD_SUPPORTED
904 #  endif
905 #endif
906 #ifndef PNG_NO_WRITE_cHRM
907 #  define PNG_WRITE_cHRM_SUPPORTED
908 #  ifndef PNG_cHRM_SUPPORTED
909 #    define PNG_cHRM_SUPPORTED
910 #  endif
911 #endif
912 #ifndef PNG_NO_WRITE_gAMA
913 #  define PNG_WRITE_gAMA_SUPPORTED
914 #  ifndef PNG_gAMA_SUPPORTED
915 #    define PNG_gAMA_SUPPORTED
916 #  endif
917 #endif
918 #ifndef PNG_NO_WRITE_hIST
919 #  define PNG_WRITE_hIST_SUPPORTED
920 #  ifndef PNG_hIST_SUPPORTED
921 #    define PNG_hIST_SUPPORTED
922 #  endif
923 #endif
924 #ifndef PNG_NO_WRITE_iCCP
925 #  define PNG_WRITE_iCCP_SUPPORTED
926 #  ifndef PNG_iCCP_SUPPORTED
927 #    define PNG_iCCP_SUPPORTED
928 #  endif
929 #endif
930 #ifndef PNG_NO_WRITE_iTXt
931 #  ifndef PNG_WRITE_iTXt_SUPPORTED
932 #    define PNG_WRITE_iTXt_SUPPORTED
933 #  endif
934 #  ifndef PNG_iTXt_SUPPORTED
935 #    define PNG_iTXt_SUPPORTED
936 #  endif
937 #endif
938 #ifndef PNG_NO_WRITE_oFFs
939 #  define PNG_WRITE_oFFs_SUPPORTED
940 #  ifndef PNG_oFFs_SUPPORTED
941 #    define PNG_oFFs_SUPPORTED
942 #  endif
943 #endif
944 #ifndef PNG_NO_WRITE_pCAL
945 #  define PNG_WRITE_pCAL_SUPPORTED
946 #  ifndef PNG_pCAL_SUPPORTED
947 #    define PNG_pCAL_SUPPORTED
948 #  endif
949 #endif
950 #ifndef PNG_NO_WRITE_sCAL
951 #  define PNG_WRITE_sCAL_SUPPORTED
952 #  ifndef PNG_sCAL_SUPPORTED
953 #    define PNG_sCAL_SUPPORTED
954 #  endif
955 #endif
956 #ifndef PNG_NO_WRITE_pHYs
957 #  define PNG_WRITE_pHYs_SUPPORTED
958 #  ifndef PNG_pHYs_SUPPORTED
959 #    define PNG_pHYs_SUPPORTED
960 #  endif
961 #endif
962 #ifndef PNG_NO_WRITE_sBIT
963 #  define PNG_WRITE_sBIT_SUPPORTED
964 #  ifndef PNG_sBIT_SUPPORTED
965 #    define PNG_sBIT_SUPPORTED
966 #  endif
967 #endif
968 #ifndef PNG_NO_WRITE_sPLT
969 #  define PNG_WRITE_sPLT_SUPPORTED
970 #  ifndef PNG_sPLT_SUPPORTED
971 #    define PNG_sPLT_SUPPORTED
972 #  endif
973 #endif
974 #ifndef PNG_NO_WRITE_sRGB
975 #  define PNG_WRITE_sRGB_SUPPORTED
976 #  ifndef PNG_sRGB_SUPPORTED
977 #    define PNG_sRGB_SUPPORTED
978 #  endif
979 #endif
980 #ifndef PNG_NO_WRITE_tEXt
981 #  define PNG_WRITE_tEXt_SUPPORTED
982 #  ifndef PNG_tEXt_SUPPORTED
983 #    define PNG_tEXt_SUPPORTED
984 #  endif
985 #endif
986 #ifndef PNG_NO_WRITE_tIME
987 #  define PNG_WRITE_tIME_SUPPORTED
988 #  ifndef PNG_tIME_SUPPORTED
989 #    define PNG_tIME_SUPPORTED
990 #  endif
991 #endif
992 #ifndef PNG_NO_WRITE_tRNS
993 #  define PNG_WRITE_tRNS_SUPPORTED
994 #  ifndef PNG_tRNS_SUPPORTED
995 #    define PNG_tRNS_SUPPORTED
996 #  endif
997 #endif
998 #ifndef PNG_NO_WRITE_zTXt
999 #  define PNG_WRITE_zTXt_SUPPORTED
1000 #  ifndef PNG_zTXt_SUPPORTED
1001 #    define PNG_zTXt_SUPPORTED
1002 #  endif
1003 #endif
1004 #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
1005 #  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
1006 #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
1007 #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
1008 #  endif
1009 #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
1010 #     ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
1011 #       define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
1012 #     endif
1013 #  endif
1014 #endif
1015 #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
1016     defined(PNG_WRITE_zTXt_SUPPORTED)
1017 #  define PNG_WRITE_TEXT_SUPPORTED
1018 #  ifndef PNG_TEXT_SUPPORTED
1019 #    define PNG_TEXT_SUPPORTED
1020 #  endif
1021 #endif
1022
1023 #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
1024
1025 /* Turn this off to disable png_read_png() and
1026  * png_write_png() and leave the row_pointers member
1027  * out of the info structure.
1028  */
1029 #ifndef PNG_NO_INFO_IMAGE
1030 #  define PNG_INFO_IMAGE_SUPPORTED
1031 #endif
1032
1033 /* need the time information for reading tIME chunks */
1034 #if defined(PNG_tIME_SUPPORTED)
1035 #  if !defined(_WIN32_WCE) && !defined(__COM32__)
1036      /* "time.h" functions are not supported on WindowsCE */
1037 #    include <time.h>
1038 #  endif
1039 #endif
1040
1041 /* Some typedefs to get us started.  These should be safe on most of the
1042  * common platforms.  The typedefs should be at least as large as the
1043  * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
1044  * don't have to be exactly that size.  Some compilers dislike passing
1045  * unsigned shorts as function parameters, so you may be better off using
1046  * unsigned int for png_uint_16.  Likewise, for 64-bit systems, you may
1047  * want to have unsigned int for png_uint_32 instead of unsigned long.
1048  */
1049
1050 typedef unsigned long png_uint_32;
1051 typedef long png_int_32;
1052 typedef unsigned short png_uint_16;
1053 typedef short png_int_16;
1054 typedef unsigned char png_byte;
1055
1056 /* This is usually size_t.  It is typedef'ed just in case you need it to
1057    change (I'm not sure if you will or not, so I thought I'd be safe) */
1058 #ifdef PNG_SIZE_T
1059    typedef PNG_SIZE_T png_size_t;
1060 #  define png_sizeof(x) png_convert_size(sizeof (x))
1061 #else
1062    typedef size_t png_size_t;
1063 #  define png_sizeof(x) sizeof (x)
1064 #endif
1065
1066 /* The following is needed for medium model support.  It cannot be in the
1067  * PNG_INTERNAL section.  Needs modification for other compilers besides
1068  * MSC.  Model independent support declares all arrays and pointers to be
1069  * large using the far keyword.  The zlib version used must also support
1070  * model independent data.  As of version zlib 1.0.4, the necessary changes
1071  * have been made in zlib.  The USE_FAR_KEYWORD define triggers other
1072  * changes that are needed. (Tim Wegner)
1073  */
1074
1075 /* Separate compiler dependencies (problem here is that zlib.h always
1076    defines FAR. (SJT) */
1077 #ifdef __BORLANDC__
1078 #  if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
1079 #    define LDATA 1
1080 #  else
1081 #    define LDATA 0
1082 #  endif
1083    /* GRR:  why is Cygwin in here?  Cygwin is not Borland C... */
1084 #  if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
1085 #    define PNG_MAX_MALLOC_64K
1086 #    if (LDATA != 1)
1087 #      ifndef FAR
1088 #        define FAR __far
1089 #      endif
1090 #      define USE_FAR_KEYWORD
1091 #    endif   /* LDATA != 1 */
1092      /* Possibly useful for moving data out of default segment.
1093       * Uncomment it if you want. Could also define FARDATA as
1094       * const if your compiler supports it. (SJT)
1095 #    define FARDATA FAR
1096       */
1097 #  endif  /* __WIN32__, __FLAT__, __CYGWIN__ */
1098 #endif   /* __BORLANDC__ */
1099
1100
1101 /* Suggest testing for specific compiler first before testing for
1102  * FAR.  The Watcom compiler defines both __MEDIUM__ and M_I86MM,
1103  * making reliance oncertain keywords suspect. (SJT)
1104  */
1105
1106 /* MSC Medium model */
1107 #if defined(FAR)
1108 #  if defined(M_I86MM)
1109 #    define USE_FAR_KEYWORD
1110 #    define FARDATA FAR
1111 #    include <dos.h>
1112 #  endif
1113 #endif
1114
1115 /* SJT: default case */
1116 #ifndef FAR
1117 #  define FAR
1118 #endif
1119
1120 /* At this point FAR is always defined */
1121 #ifndef FARDATA
1122 #  define FARDATA
1123 #endif
1124
1125 /* Typedef for floating-point numbers that are converted
1126    to fixed-point with a multiple of 100,000, e.g., int_gamma */
1127 typedef png_int_32 png_fixed_point;
1128
1129 /* Add typedefs for pointers */
1130 typedef void            FAR * png_voidp;
1131 typedef png_byte        FAR * png_bytep;
1132 typedef png_uint_32     FAR * png_uint_32p;
1133 typedef png_int_32      FAR * png_int_32p;
1134 typedef png_uint_16     FAR * png_uint_16p;
1135 typedef png_int_16      FAR * png_int_16p;
1136 typedef PNG_CONST char  FAR * png_const_charp;
1137 typedef char            FAR * png_charp;
1138 typedef png_fixed_point FAR * png_fixed_point_p;
1139
1140 #ifndef PNG_NO_STDIO
1141 #if defined(_WIN32_WCE)
1142 typedef HANDLE                png_FILE_p;
1143 #else
1144 typedef FILE                * png_FILE_p;
1145 #endif
1146 #endif
1147
1148 #ifdef PNG_FLOATING_POINT_SUPPORTED
1149 typedef double          FAR * png_doublep;
1150 #endif
1151
1152 /* Pointers to pointers; i.e. arrays */
1153 typedef png_byte        FAR * FAR * png_bytepp;
1154 typedef png_uint_32     FAR * FAR * png_uint_32pp;
1155 typedef png_int_32      FAR * FAR * png_int_32pp;
1156 typedef png_uint_16     FAR * FAR * png_uint_16pp;
1157 typedef png_int_16      FAR * FAR * png_int_16pp;
1158 typedef PNG_CONST char  FAR * FAR * png_const_charpp;
1159 typedef char            FAR * FAR * png_charpp;
1160 typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
1161 #ifdef PNG_FLOATING_POINT_SUPPORTED
1162 typedef double          FAR * FAR * png_doublepp;
1163 #endif
1164
1165 /* Pointers to pointers to pointers; i.e., pointer to array */
1166 typedef char            FAR * FAR * FAR * png_charppp;
1167
1168 #if defined(PNG_1_0_X) || defined(PNG_1_2_X)
1169 /* SPC -  Is this stuff deprecated? */
1170 /* It'll be removed as of libpng-1.3.0 - GR-P */
1171 /* libpng typedefs for types in zlib. If zlib changes
1172  * or another compression library is used, then change these.
1173  * Eliminates need to change all the source files.
1174  */
1175 typedef charf *         png_zcharp;
1176 typedef charf * FAR *   png_zcharpp;
1177 typedef z_stream FAR *  png_zstreamp;
1178 #endif /* (PNG_1_0_X) || defined(PNG_1_2_X) */
1179
1180 /*
1181  * Define PNG_BUILD_DLL if the module being built is a Windows
1182  * LIBPNG DLL.
1183  *
1184  * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
1185  * It is equivalent to Microsoft predefined macro _DLL that is
1186  * automatically defined when you compile using the share
1187  * version of the CRT (C Run-Time library)
1188  *
1189  * The cygwin mods make this behavior a little different:
1190  * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
1191  * Define PNG_STATIC if you are building a static library for use with cygwin,
1192  *   -or- if you are building an application that you want to link to the
1193  *   static library.
1194  * PNG_USE_DLL is defined by default (no user action needed) unless one of
1195  *   the other flags is defined.
1196  */
1197
1198 #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
1199 #  define PNG_DLL
1200 #endif
1201 /* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
1202  * When building a static lib, default to no GLOBAL ARRAYS, but allow
1203  * command-line override
1204  */
1205 #if defined(__CYGWIN__)
1206 #  if !defined(PNG_STATIC)
1207 #    if defined(PNG_USE_GLOBAL_ARRAYS)
1208 #      undef PNG_USE_GLOBAL_ARRAYS
1209 #    endif
1210 #    if !defined(PNG_USE_LOCAL_ARRAYS)
1211 #      define PNG_USE_LOCAL_ARRAYS
1212 #    endif
1213 #  else
1214 #    if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
1215 #      if defined(PNG_USE_GLOBAL_ARRAYS)
1216 #        undef PNG_USE_GLOBAL_ARRAYS
1217 #      endif
1218 #    endif
1219 #  endif
1220 #  if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
1221 #    define PNG_USE_LOCAL_ARRAYS
1222 #  endif
1223 #endif
1224
1225 /* Do not use global arrays (helps with building DLL's)
1226  * They are no longer used in libpng itself, since version 1.0.5c,
1227  * but might be required for some pre-1.0.5c applications.
1228  */
1229 #if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
1230 #  if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL))
1231 #    define PNG_USE_LOCAL_ARRAYS
1232 #  else
1233 #    define PNG_USE_GLOBAL_ARRAYS
1234 #  endif
1235 #endif
1236
1237 #if defined(__CYGWIN__)
1238 #  undef PNGAPI
1239 #  define PNGAPI __cdecl
1240 #  undef PNG_IMPEXP
1241 #  define PNG_IMPEXP
1242 #endif  
1243
1244 /* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
1245  * you may get warnings regarding the linkage of png_zalloc and png_zfree.
1246  * Don't ignore those warnings; you must also reset the default calling
1247  * convention in your compiler to match your PNGAPI, and you must build
1248  * zlib and your applications the same way you build libpng.
1249  */
1250
1251 #if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
1252 #  ifndef PNG_NO_MODULEDEF
1253 #    define PNG_NO_MODULEDEF
1254 #  endif
1255 #endif
1256
1257 #if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
1258 #  define PNG_IMPEXP
1259 #endif
1260
1261 #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
1262     (( defined(_Windows) || defined(_WINDOWS) || \
1263        defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
1264
1265 #  ifndef PNGAPI
1266 #     if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
1267 #        define PNGAPI __cdecl
1268 #     else
1269 #        define PNGAPI _cdecl
1270 #     endif
1271 #  endif
1272
1273 #  if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
1274        0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
1275 #     define PNG_IMPEXP
1276 #  endif
1277
1278 #  if !defined(PNG_IMPEXP)
1279
1280 #     define PNG_EXPORT_TYPE1(type,symbol)  PNG_IMPEXP type PNGAPI symbol
1281 #     define PNG_EXPORT_TYPE2(type,symbol)  type PNG_IMPEXP PNGAPI symbol
1282
1283       /* Borland/Microsoft */
1284 #     if defined(_MSC_VER) || defined(__BORLANDC__)
1285 #        if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
1286 #           define PNG_EXPORT PNG_EXPORT_TYPE1
1287 #        else
1288 #           define PNG_EXPORT PNG_EXPORT_TYPE2
1289 #           if defined(PNG_BUILD_DLL)
1290 #              define PNG_IMPEXP __export
1291 #           else
1292 #              define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
1293                                                  VC++ */
1294 #           endif                             /* Exists in Borland C++ for
1295                                                  C++ classes (== huge) */
1296 #        endif
1297 #     endif
1298
1299 #     if !defined(PNG_IMPEXP)
1300 #        if defined(PNG_BUILD_DLL)
1301 #           define PNG_IMPEXP __declspec(dllexport)
1302 #        else
1303 #           define PNG_IMPEXP __declspec(dllimport)
1304 #        endif
1305 #     endif
1306 #  endif  /* PNG_IMPEXP */
1307 #else /* !(DLL || non-cygwin WINDOWS) */
1308 #   if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
1309 #      ifndef PNGAPI
1310 #         define PNGAPI _System
1311 #      endif
1312 #   else
1313 #      if 0 /* ... other platforms, with other meanings */
1314 #      endif
1315 #   endif
1316 #endif
1317
1318 #ifndef PNGAPI
1319 #  define PNGAPI
1320 #endif
1321 #ifndef PNG_IMPEXP
1322 #  define PNG_IMPEXP
1323 #endif
1324
1325 #ifdef PNG_BUILDSYMS
1326 #  ifndef PNG_EXPORT
1327 #    define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END
1328 #  endif
1329 #  ifdef PNG_USE_GLOBAL_ARRAYS
1330 #    ifndef PNG_EXPORT_VAR
1331 #      define PNG_EXPORT_VAR(type) PNG_DATA_EXPORT
1332 #    endif
1333 #  endif
1334 #endif
1335
1336 #ifndef PNG_EXPORT
1337 #  define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
1338 #endif
1339
1340 #ifdef PNG_USE_GLOBAL_ARRAYS
1341 #  ifndef PNG_EXPORT_VAR
1342 #    define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
1343 #  endif
1344 #endif
1345
1346 /* User may want to use these so they are not in PNG_INTERNAL. Any library
1347  * functions that are passed far data must be model independent.
1348  */
1349
1350 #ifndef PNG_ABORT
1351 #  define PNG_ABORT() abort()
1352 #endif
1353
1354 #ifdef PNG_SETJMP_SUPPORTED
1355 #  define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
1356 #else
1357 #  define png_jmpbuf(png_ptr) \
1358    (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
1359 #endif
1360
1361 #if defined(USE_FAR_KEYWORD)  /* memory model independent fns */
1362 /* use this to make far-to-near assignments */
1363 #  define CHECK   1
1364 #  define NOCHECK 0
1365 #  define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
1366 #  define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
1367 #  define png_strcpy  _fstrcpy
1368 #  define png_strncpy _fstrncpy   /* Added to v 1.2.6 */
1369 #  define png_strlen  _fstrlen
1370 #  define png_memcmp  _fmemcmp    /* SJT: added */
1371 #  define png_memcpy  _fmemcpy
1372 #  define png_memset  _fmemset
1373 #else /* use the usual functions */
1374 #  define CVT_PTR(ptr)         (ptr)
1375 #  define CVT_PTR_NOCHECK(ptr) (ptr)
1376 #  define png_strcpy  strcpy
1377 #  define png_strncpy strncpy     /* Added to v 1.2.6 */
1378 #  define png_strlen  strlen
1379 #  define png_memcmp  memcmp      /* SJT: added */
1380 #  define png_memcpy  memcpy
1381 #  define png_memset  memset
1382 #endif
1383 /* End of memory model independent support */
1384
1385 /* Just a little check that someone hasn't tried to define something
1386  * contradictory.
1387  */
1388 #if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
1389 #  undef PNG_ZBUF_SIZE
1390 #  define PNG_ZBUF_SIZE 65536L
1391 #endif
1392
1393 #ifdef PNG_READ_SUPPORTED
1394 /* Prior to libpng-1.0.9, this block was in pngasmrd.h */
1395 #if defined(PNG_INTERNAL)
1396
1397 /* These are the default thresholds before the MMX code kicks in; if either
1398  * rowbytes or bitdepth is below the threshold, plain C code is used.  These
1399  * can be overridden at runtime via the png_set_mmx_thresholds() call in
1400  * libpng 1.2.0 and later.  The values below were chosen by Intel.
1401  */
1402
1403 #ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT
1404 #  define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT  128  /*  >=  */
1405 #endif
1406 #ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT
1407 #  define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT  9    /*  >=  */   
1408 #endif
1409
1410 /* Set this in the makefile for VC++ on Pentium, not here. */
1411 /* Platform must be Pentium.  Makefile must assemble and load pngvcrd.c .
1412  * MMX will be detected at run time and used if present.
1413  */
1414 #ifdef PNG_USE_PNGVCRD
1415 #  define PNG_HAVE_ASSEMBLER_COMBINE_ROW
1416 #  define PNG_HAVE_ASSEMBLER_READ_INTERLACE
1417 #  define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
1418 #endif
1419
1420 /* Set this in the makefile for gcc/as on Pentium, not here. */
1421 /* Platform must be Pentium.  Makefile must assemble and load pnggccrd.c .
1422  * MMX will be detected at run time and used if present.
1423  */
1424 #ifdef PNG_USE_PNGGCCRD
1425 #  define PNG_HAVE_ASSEMBLER_COMBINE_ROW
1426 #  define PNG_HAVE_ASSEMBLER_READ_INTERLACE
1427 #  define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
1428 #endif
1429 /* - see pnggccrd.c for info about what is currently enabled */
1430
1431 #endif /* PNG_INTERNAL */
1432 #endif /* PNG_READ_SUPPORTED */
1433
1434 /* Added at libpng-1.2.8 */
1435 #endif /* PNG_VERSION_INFO_ONLY */
1436
1437 #endif /* PNGCONF_H */