home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 May / PCWorld_2002-05_cd.bin / Software / TemaCD / activetcltk / ActiveTcl8.3.4.1-8.win32-ix86.exe / ActiveTcl8.3.4.1-win32-ix86 / include / pngconf.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-22  |  34.3 KB  |  1,192 lines

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