Chameleon

Chameleon Svn Source Tree

Root/branches/cparm/i386/modules/include/pngconf.h

  • Property svn:executable set to *
1
2/* pngconf.h - machine configurable file for libpng
3 *
4 * libpng version 1.5.13 - September 27, 2012
5 *
6 * Copyright (c) 1998-2012 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 * This code is released under the libpng license.
11 * For conditions of distribution and use, see the disclaimer
12 * and license in png.h
13 *
14 */
15
16/* Any machine specific code is near the front of this file, so if you
17 * are configuring libpng for a machine, you may want to read the section
18 * starting here down to where it starts to typedef png_color, png_text,
19 * and png_info.
20 */
21
22#ifndef PNGCONF_H
23#define PNGCONF_H
24
25#ifndef PNG_BUILDING_SYMBOL_TABLE
26/* PNG_NO_LIMITS_H may be used to turn off the use of the standard C
27 * definition file for machine specific limits, this may impact the
28 * correctness of the definitions below (see uses of INT_MAX).
29 */
30# ifndef PNG_NO_LIMITS_H
31# include <limits.h>
32# endif
33
34#endif
35
36/* This controls optimization of the reading of 16 and 32 bit values
37 * from PNG files. It can be set on a per-app-file basis - it
38 * just changes whether a macro is used when the function is called.
39 * The library builder sets the default; if read functions are not
40 * built into the library the macro implementation is forced on.
41 */
42#ifndef PNG_READ_INT_FUNCTIONS_SUPPORTED
43# define PNG_USE_READ_MACROS
44#endif
45#if !defined(PNG_NO_USE_READ_MACROS) && !defined(PNG_USE_READ_MACROS)
46# if PNG_DEFAULT_READ_MACROS
47# define PNG_USE_READ_MACROS
48# endif
49#endif
50
51/* COMPILER SPECIFIC OPTIONS.
52 *
53 * These options are provided so that a variety of difficult compilers
54 * can be used. Some are fixed at build time (e.g. PNG_API_RULE
55 * below) but still have compiler specific implementations, others
56 * may be changed on a per-file basis when compiling against libpng.
57 */
58
59/* The PNGARG macro protects us against machines that don't have function
60 * prototypes (ie K&R style headers). If your compiler does not handle
61 * function prototypes, define this macro and use the included ansi2knr.
62 * I've always been able to use _NO_PROTO as the indicator, but you may
63 * need to drag the empty declaration out in front of here, or change the
64 * ifdef to suit your own needs.
65 */
66#ifndef PNGARG
67
68# ifdef OF /* zlib prototype munger */
69# define PNGARG(arglist) OF(arglist)
70# else
71
72# ifdef _NO_PROTO
73# define PNGARG(arglist) ()
74# else
75# define PNGARG(arglist) arglist
76# endif /* _NO_PROTO */
77
78# endif /* OF */
79
80#endif /* PNGARG */
81
82/* Function calling conventions.
83 * =============================
84 * Normally it is not necessary to specify to the compiler how to call
85 * a function - it just does it - however on x86 systems derived from
86 * Microsoft and Borland C compilers ('IBM PC', 'DOS', 'Windows' systems
87 * and some others) there are multiple ways to call a function and the
88 * default can be changed on the compiler command line. For this reason
89 * libpng specifies the calling convention of every exported function and
90 * every function called via a user supplied function pointer. This is
91 * done in this file by defining the following macros:
92 *
93 * PNGAPI Calling convention for exported functions.
94 * PNGCBAPI Calling convention for user provided (callback) functions.
95 * PNGCAPI Calling convention used by the ANSI-C library (required
96 * for longjmp callbacks and sometimes used internally to
97 * specify the calling convention for zlib).
98 *
99 * These macros should never be overridden. If it is necessary to
100 * change calling convention in a private build this can be done
101 * by setting PNG_API_RULE (which defaults to 0) to one of the values
102 * below to select the correct 'API' variants.
103 *
104 * PNG_API_RULE=0 Use PNGCAPI - the 'C' calling convention - throughout.
105 * This is correct in every known environment.
106 * PNG_API_RULE=1 Use the operating system convention for PNGAPI and
107 * the 'C' calling convention (from PNGCAPI) for
108 * callbacks (PNGCBAPI). This is no longer required
109 * in any known environment - if it has to be used
110 * please post an explanation of the problem to the
111 * libpng mailing list.
112 *
113 * These cases only differ if the operating system does not use the C
114 * calling convention, at present this just means the above cases
115 * (x86 DOS/Windows sytems) and, even then, this does not apply to
116 * Cygwin running on those systems.
117 *
118 * Note that the value must be defined in pnglibconf.h so that what
119 * the application uses to call the library matches the conventions
120 * set when building the library.
121 */
122
123/* Symbol export
124 * =============
125 * When building a shared library it is almost always necessary to tell
126 * the compiler which symbols to export. The png.h macro 'PNG_EXPORT'
127 * is used to mark the symbols. On some systems these symbols can be
128 * extracted at link time and need no special processing by the compiler,
129 * on other systems the symbols are flagged by the compiler and just
130 * the declaration requires a special tag applied (unfortunately) in a
131 * compiler dependent way. Some systems can do either.
132 *
133 * A small number of older systems also require a symbol from a DLL to
134 * be flagged to the program that calls it. This is a problem because
135 * we do not know in the header file included by application code that
136 * the symbol will come from a shared library, as opposed to a statically
137 * linked one. For this reason the application must tell us by setting
138 * the magic flag PNG_USE_DLL to turn on the special processing before
139 * it includes png.h.
140 *
141 * Four additional macros are used to make this happen:
142 *
143 * PNG_IMPEXP The magic (if any) to cause a symbol to be exported from
144 * the build or imported if PNG_USE_DLL is set - compiler
145 * and system specific.
146 *
147 * PNG_EXPORT_TYPE(type) A macro that pre or appends PNG_IMPEXP to
148 * 'type', compiler specific.
149 *
150 * PNG_DLL_EXPORT Set to the magic to use during a libpng build to
151 * make a symbol exported from the DLL. Not used in the
152 * public header files; see pngpriv.h for how it is used
153 * in the libpng build.
154 *
155 * PNG_DLL_IMPORT Set to the magic to force the libpng symbols to come
156 * from a DLL - used to define PNG_IMPEXP when
157 * PNG_USE_DLL is set.
158 */
159
160/* System specific discovery.
161 * ==========================
162 * This code is used at build time to find PNG_IMPEXP, the API settings
163 * and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL
164 * import processing is possible. On Windows/x86 systems it also sets
165 * compiler-specific macros to the values required to change the calling
166 * conventions of the various functions.
167 */
168#if ( defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\
169 defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) ) &&\
170 ( defined(_X86_) || defined(_X64_) || defined(_M_IX86) ||\
171 defined(_M_X64) || defined(_M_IA64) )
172 /* Windows system (DOS doesn't support DLLs) running on x86/x64. Includes
173 * builds under Cygwin or MinGW. Also includes Watcom builds but these need
174 * special treatment because they are not compatible with GCC or Visual C
175 * because of different calling conventions.
176 */
177# if PNG_API_RULE == 2
178 /* If this line results in an error, either because __watcall is not
179 * understood or because of a redefine just below you cannot use *this*
180 * build of the library with the compiler you are using. *This* build was
181 * build using Watcom and applications must also be built using Watcom!
182 */
183# define PNGCAPI __watcall
184# endif
185
186# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
187# define PNGCAPI __cdecl
188# if PNG_API_RULE == 1
189# define PNGAPI __stdcall
190# endif
191# else
192 /* An older compiler, or one not detected (erroneously) above,
193 * if necessary override on the command line to get the correct
194 * variants for the compiler.
195 */
196# ifndef PNGCAPI
197# define PNGCAPI _cdecl
198# endif
199# if PNG_API_RULE == 1 && !defined(PNGAPI)
200# define PNGAPI _stdcall
201# endif
202# endif /* compiler/api */
203 /* NOTE: PNGCBAPI always defaults to PNGCAPI. */
204
205# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
206 ERROR: PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed
207# endif
208
209# if (defined(_MSC_VER) && _MSC_VER < 800) ||\
210 (defined(__BORLANDC__) && __BORLANDC__ < 0x500)
211 /* older Borland and MSC
212 * compilers used '__export' and required this to be after
213 * the type.
214 */
215# ifndef PNG_EXPORT_TYPE
216# define PNG_EXPORT_TYPE(type) type PNG_IMPEXP
217# endif
218# define PNG_DLL_EXPORT __export
219# else /* newer compiler */
220# define PNG_DLL_EXPORT __declspec(dllexport)
221# ifndef PNG_DLL_IMPORT
222# define PNG_DLL_IMPORT __declspec(dllimport)
223# endif
224# endif /* compiler */
225
226#else /* !Windows/x86 */
227# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
228# define PNGAPI _System
229# else /* !Windows/x86 && !OS/2 */
230 /* Use the defaults, or define PNG*API on the command line (but
231 * this will have to be done for every compile!)
232 */
233# endif /* other system, !OS/2 */
234#endif /* !Windows/x86 */
235
236/* Now do all the defaulting . */
237#ifndef PNGCAPI
238# define PNGCAPI
239#endif
240#ifndef PNGCBAPI
241# define PNGCBAPI PNGCAPI
242#endif
243#ifndef PNGAPI
244# define PNGAPI PNGCAPI
245#endif
246
247/* PNG_IMPEXP may be set on the compilation system command line or (if not set)
248 * then in an internal header file when building the library, otherwise (when
249 * using the library) it is set here.
250 */
251#ifndef PNG_IMPEXP
252# if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT)
253 /* This forces use of a DLL, disallowing static linking */
254# define PNG_IMPEXP PNG_DLL_IMPORT
255# endif
256
257# ifndef PNG_IMPEXP
258# define PNG_IMPEXP
259# endif
260#endif
261
262/* In 1.5.2 the definition of PNG_FUNCTION has been changed to always treat
263 * 'attributes' as a storage class - the attributes go at the start of the
264 * function definition, and attributes are always appended regardless of the
265 * compiler. This considerably simplifies these macros but may cause problems
266 * if any compilers both need function attributes and fail to handle them as
267 * a storage class (this is unlikely.)
268 */
269#ifndef PNG_FUNCTION
270# define PNG_FUNCTION(type, name, args, attributes) attributes type name args
271#endif
272
273#ifndef PNG_EXPORT_TYPE
274# define PNG_EXPORT_TYPE(type) PNG_IMPEXP type
275#endif
276
277 /* The ordinal value is only relevant when preprocessing png.h for symbol
278 * table entries, so we discard it here. See the .dfn files in the
279 * scripts directory.
280 */
281#ifndef PNG_EXPORTA
282
283# define PNG_EXPORTA(ordinal, type, name, args, attributes)\
284 PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), \
285 extern attributes)
286#endif
287
288/* ANSI-C (C90) does not permit a macro to be invoked with an empty argument,
289 * so make something non-empty to satisfy the requirement:
290 */
291#define PNG_EMPTY /*empty list*/
292
293#define PNG_EXPORT(ordinal, type, name, args)\
294 PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY)
295
296/* Use PNG_REMOVED to comment out a removed interface. */
297#ifndef PNG_REMOVED
298# define PNG_REMOVED(ordinal, type, name, args, attributes)
299#endif
300
301#ifndef PNG_CALLBACK
302# define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) PNGARG(args)
303#endif
304
305/* Support for compiler specific function attributes. These are used
306 * so that where compiler support is available incorrect use of API
307 * functions in png.h will generate compiler warnings.
308 *
309 * Added at libpng-1.2.41.
310 */
311
312
313#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
314 /* Support for compiler specific function attributes. These are used
315 * so that where compiler support is available incorrect use of API
316 * functions in png.h will generate compiler warnings. Added at libpng
317 * version 1.2.41.
318 */
319# if defined(__GNUC__)
320# ifndef PNG_USE_RESULT
321# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
322# endif
323# ifndef PNG_NORETURN
324# define PNG_NORETURN __attribute__((__noreturn__))
325# endif
326# if __GNUC__ >= 3
327# ifndef PNG_ALLOCATED
328# define PNG_ALLOCATED __attribute__((__malloc__))
329# endif
330# ifndef PNG_DEPRECATED
331# define PNG_DEPRECATED __attribute__((__deprecated__))
332# endif
333# ifndef PNG_PRIVATE
334# if 0 /* Doesn't work so we use deprecated instead*/
335# define PNG_PRIVATE \
336 __attribute__((warning("This function is not exported by libpng.")))
337# else
338# define PNG_PRIVATE \
339 __attribute__((__deprecated__))
340# endif
341# endif
342# endif /* __GNUC__ >= 3 */
343# endif /* __GNUC__ */
344
345# if defined(_MSC_VER) && (_MSC_VER >= 1300)
346# ifndef PNG_USE_RESULT
347# define PNG_USE_RESULT /* not supported */
348# endif
349# ifndef PNG_NORETURN
350# define PNG_NORETURN __declspec(noreturn)
351# endif
352# ifndef PNG_ALLOCATED
353# if (_MSC_VER >= 1400)
354# define PNG_ALLOCATED __declspec(restrict)
355# endif
356# endif
357# ifndef PNG_DEPRECATED
358# define PNG_DEPRECATED __declspec(deprecated)
359# endif
360# ifndef PNG_PRIVATE
361# define PNG_PRIVATE __declspec(deprecated)
362# endif
363# endif /* _MSC_VER */
364#endif /* PNG_PEDANTIC_WARNINGS */
365
366#ifndef PNG_DEPRECATED
367# define PNG_DEPRECATED /* Use of this function is deprecated */
368#endif
369#ifndef PNG_USE_RESULT
370# define PNG_USE_RESULT /* The result of this function must be checked */
371#endif
372#ifndef PNG_NORETURN
373# define PNG_NORETURN /* This function does not return */
374#endif
375#ifndef PNG_ALLOCATED
376# define PNG_ALLOCATED /* The result of the function is new memory */
377#endif
378#ifndef PNG_PRIVATE
379# define PNG_PRIVATE /* This is a private libpng function */
380#endif
381#ifndef PNG_FP_EXPORT /* A floating point API. */
382# ifdef PNG_FLOATING_POINT_SUPPORTED
383# define PNG_FP_EXPORT(ordinal, type, name, args)\
384 PNG_EXPORT(ordinal, type, name, args);
385# else /* No floating point APIs */
386# define PNG_FP_EXPORT(ordinal, type, name, args)
387# endif
388#endif
389#ifndef PNG_FIXED_EXPORT /* A fixed point API. */
390# ifdef PNG_FIXED_POINT_SUPPORTED
391# define PNG_FIXED_EXPORT(ordinal, type, name, args)\
392 PNG_EXPORT(ordinal, type, name, args);
393# else /* No fixed point APIs */
394# define PNG_FIXED_EXPORT(ordinal, type, name, args)
395# endif
396#endif
397
398/* The following uses const char * instead of char * for error
399 * and warning message functions, so some compilers won't complain.
400 * If you do not want to use const, define PNG_NO_CONST here.
401 *
402 * This should not change how the APIs are called, so it can be done
403 * on a per-file basis in the application.
404 */
405#ifndef PNG_CONST
406# ifndef PNG_NO_CONST
407# define PNG_CONST const
408# else
409# define PNG_CONST
410# endif
411#endif
412
413/* Some typedefs to get us started. These should be safe on most of the
414 * common platforms. The typedefs should be at least as large as the
415 * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
416 * don't have to be exactly that size. Some compilers dislike passing
417 * unsigned shorts as function parameters, so you may be better off using
418 * unsigned int for png_uint_16.
419 */
420
421#if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL)
422typedef unsigned int png_uint_32;
423typedef int png_int_32;
424#else
425typedef unsigned long png_uint_32;
426typedef long png_int_32;
427#endif
428typedef unsigned short png_uint_16;
429typedef short png_int_16;
430typedef unsigned char png_byte;
431
432#ifdef PNG_NO_SIZE_T
433typedef unsigned int png_size_t;
434#else
435typedef size_t png_size_t;
436#endif
437#define png_sizeof(x) (sizeof (x))
438
439/* The following is needed for medium model support. It cannot be in the
440 * pngpriv.h header. Needs modification for other compilers besides
441 * MSC. Model independent support declares all arrays and pointers to be
442 * large using the far keyword. The zlib version used must also support
443 * model independent data. As of version zlib 1.0.4, the necessary changes
444 * have been made in zlib. The USE_FAR_KEYWORD define triggers other
445 * changes that are needed. (Tim Wegner)
446 */
447
448/* Separate compiler dependencies (problem here is that zlib.h always
449 * defines FAR. (SJT)
450 */
451#ifdef __BORLANDC__
452# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
453# define LDATA 1
454# else
455# define LDATA 0
456# endif
457 /* GRR: why is Cygwin in here? Cygwin is not Borland C... */
458# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
459# define PNG_MAX_MALLOC_64K /* only used in build */
460# if (LDATA != 1)
461# ifndef FAR
462# define FAR __far
463# endif
464# define USE_FAR_KEYWORD
465# endif /* LDATA != 1 */
466 /* Possibly useful for moving data out of default segment.
467 * Uncomment it if you want. Could also define FARDATA as
468 * const if your compiler supports it. (SJT)
469# define FARDATA FAR
470 */
471# endif /* __WIN32__, __FLAT__, __CYGWIN__ */
472#endif /* __BORLANDC__ */
473
474
475/* Suggest testing for specific compiler first before testing for
476 * FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
477 * making reliance oncertain keywords suspect. (SJT)
478 */
479
480/* MSC Medium model */
481#ifdef FAR
482# ifdef M_I86MM
483# define USE_FAR_KEYWORD
484# define FARDATA FAR
485# include <dos.h>
486# endif
487#endif
488
489/* SJT: default case */
490#ifndef FAR
491# define FAR
492#endif
493
494/* At this point FAR is always defined */
495#ifndef FARDATA
496# define FARDATA
497#endif
498
499/* Typedef for floating-point numbers that are converted
500 * to fixed-point with a multiple of 100,000, e.g., gamma
501 */
502typedef png_int_32 png_fixed_point;
503
504/* Add typedefs for pointers */
505typedef void FAR * png_voidp;
506typedef PNG_CONST void FAR * png_const_voidp;
507typedef png_byte FAR * png_bytep;
508typedef PNG_CONST png_byte FAR * png_const_bytep;
509typedef png_uint_32 FAR * png_uint_32p;
510typedef PNG_CONST png_uint_32 FAR * png_const_uint_32p;
511typedef png_int_32 FAR * png_int_32p;
512typedef PNG_CONST png_int_32 FAR * png_const_int_32p;
513typedef png_uint_16 FAR * png_uint_16p;
514typedef PNG_CONST png_uint_16 FAR * png_const_uint_16p;
515typedef png_int_16 FAR * png_int_16p;
516typedef PNG_CONST png_int_16 FAR * png_const_int_16p;
517typedef char FAR * png_charp;
518typedef PNG_CONST char FAR * png_const_charp;
519typedef png_fixed_point FAR * png_fixed_point_p;
520typedef PNG_CONST png_fixed_point FAR * png_const_fixed_point_p;
521typedef png_size_t FAR * png_size_tp;
522typedef PNG_CONST png_size_t FAR * png_const_size_tp;
523
524#ifdef PNG_STDIO_SUPPORTED
525typedef FILE * png_FILE_p;
526#endif
527
528#ifdef PNG_FLOATING_POINT_SUPPORTED
529typedef double FAR * png_doublep;
530typedef PNG_CONST double FAR * png_const_doublep;
531#endif
532
533/* Pointers to pointers; i.e. arrays */
534typedef png_byte FAR * FAR * png_bytepp;
535typedef png_uint_32 FAR * FAR * png_uint_32pp;
536typedef png_int_32 FAR * FAR * png_int_32pp;
537typedef png_uint_16 FAR * FAR * png_uint_16pp;
538typedef png_int_16 FAR * FAR * png_int_16pp;
539typedef PNG_CONST char FAR * FAR * png_const_charpp;
540typedef char FAR * FAR * png_charpp;
541typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
542#ifdef PNG_FLOATING_POINT_SUPPORTED
543typedef double FAR * FAR * png_doublepp;
544#endif
545
546/* Pointers to pointers to pointers; i.e., pointer to array */
547typedef char FAR * FAR * FAR * png_charppp;
548
549/* png_alloc_size_t is guaranteed to be no smaller than png_size_t,
550 * and no smaller than png_uint_32. Casts from png_size_t or png_uint_32
551 * to png_alloc_size_t are not necessary; in fact, it is recommended
552 * not to use them at all so that the compiler can complain when something
553 * turns out to be problematic.
554 * Casts in the other direction (from png_alloc_size_t to png_size_t or
555 * png_uint_32) should be explicitly applied; however, we do not expect
556 * to encounter practical situations that require such conversions.
557 */
558#if defined(__TURBOC__) && !defined(__FLAT__)
559 typedef unsigned long png_alloc_size_t;
560#else
561# if defined(_MSC_VER) && defined(MAXSEG_64K)
562 typedef unsigned long png_alloc_size_t;
563# else
564 /* This is an attempt to detect an old Windows system where (int) is
565 * actually 16 bits, in that case png_malloc must have an argument with a
566 * bigger size to accomodate the requirements of the library.
567 */
568# if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) && \
569 (!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
570 typedef DWORD png_alloc_size_t;
571# else
572 typedef png_size_t png_alloc_size_t;
573# endif
574# endif
575#endif
576
577#endif /* PNGCONF_H */
578

Archive Download this file

Revision: 2154