2013-07-01 02:42:19 +04:00
|
|
|
/*
|
2010-07-31 06:52:47 +04:00
|
|
|
* The Python Imaging Library
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* platform declarations for the imaging core library
|
|
|
|
*
|
|
|
|
* Copyright (c) Fredrik Lundh 1995-2003.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "Python.h"
|
|
|
|
|
|
|
|
/* Check that we have an ANSI compliant compiler */
|
|
|
|
#ifndef HAVE_PROTOTYPES
|
|
|
|
#error Sorry, this library requires support for ANSI prototypes.
|
|
|
|
#endif
|
|
|
|
#ifndef STDC_HEADERS
|
|
|
|
#error Sorry, this library requires ANSI header files.
|
|
|
|
#endif
|
|
|
|
|
2014-07-01 02:26:41 +04:00
|
|
|
#if defined(PIL_NO_INLINE)
|
2016-06-17 13:03:21 +03:00
|
|
|
#define inline
|
2014-06-25 09:23:17 +04:00
|
|
|
#else
|
2014-05-09 23:05:30 +04:00
|
|
|
#if defined(_MSC_VER) && !defined(__GNUC__)
|
2010-07-31 06:52:47 +04:00
|
|
|
#define inline __inline
|
2014-05-09 22:14:46 +04:00
|
|
|
#endif
|
2010-07-31 06:52:47 +04:00
|
|
|
#endif
|
|
|
|
|
2022-10-07 02:02:41 +03:00
|
|
|
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
|
2014-05-09 23:05:30 +04:00
|
|
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <Windows.h>
|
|
|
|
|
2021-11-03 20:03:55 +03:00
|
|
|
#ifdef __CYGWIN__
|
|
|
|
#undef _WIN64
|
|
|
|
#undef _WIN32
|
|
|
|
#undef __WIN32__
|
|
|
|
#undef WIN32
|
|
|
|
#endif
|
|
|
|
|
2022-10-07 02:02:41 +03:00
|
|
|
#else /* WIN */
|
2014-05-09 23:05:30 +04:00
|
|
|
/* For System that are not Windows, we'll need to define these. */
|
2022-10-07 02:04:10 +03:00
|
|
|
/* We have to define them instead of using typedef because the JPEG lib also
|
|
|
|
defines their own types with the same names, so we need to be able to undef
|
|
|
|
ours before including the JPEG code. */
|
2014-05-09 23:05:30 +04:00
|
|
|
|
2022-10-07 02:11:02 +03:00
|
|
|
#if __STDC_VERSION__ >= 199901L /* C99+ */
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#define INT8 int8_t
|
|
|
|
#define UINT8 uint8_t
|
|
|
|
#define INT16 int16_t
|
|
|
|
#define UINT16 uint16_t
|
|
|
|
#define INT32 int32_t
|
|
|
|
#define UINT32 uint32_t
|
|
|
|
#ifdef INT64_MAX
|
|
|
|
#define INT64 int64_t
|
|
|
|
#define UINT64 uint64_t
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#else /* C99+ */
|
|
|
|
|
2022-10-07 02:13:50 +03:00
|
|
|
#define INT8 signed char
|
|
|
|
|
2010-07-31 06:52:47 +04:00
|
|
|
#if SIZEOF_SHORT == 2
|
2020-05-01 15:08:57 +03:00
|
|
|
#define INT16 short
|
2010-07-31 06:52:47 +04:00
|
|
|
#elif SIZEOF_INT == 2
|
2020-05-01 15:08:57 +03:00
|
|
|
#define INT16 int
|
2010-07-31 06:52:47 +04:00
|
|
|
#else
|
2020-05-01 15:08:57 +03:00
|
|
|
#define INT16 short /* most things works just fine anyway... */
|
2010-07-31 06:52:47 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if SIZEOF_SHORT == 4
|
2020-05-01 15:08:57 +03:00
|
|
|
#define INT32 short
|
2010-07-31 06:52:47 +04:00
|
|
|
#elif SIZEOF_INT == 4
|
2020-05-01 15:08:57 +03:00
|
|
|
#define INT32 int
|
2010-07-31 06:52:47 +04:00
|
|
|
#elif SIZEOF_LONG == 4
|
2020-05-01 15:08:57 +03:00
|
|
|
#define INT32 long
|
2010-07-31 06:52:47 +04:00
|
|
|
#else
|
|
|
|
#error Cannot find required 32-bit integer type
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if SIZEOF_LONG == 8
|
2020-05-01 15:08:57 +03:00
|
|
|
#define INT64 long
|
2010-07-31 06:52:47 +04:00
|
|
|
#elif SIZEOF_LONG_LONG == 8
|
2022-10-07 01:59:33 +03:00
|
|
|
#define INT64 long long
|
|
|
|
#else
|
|
|
|
#warning Cannot find required 64-bit integer type
|
2010-07-31 06:52:47 +04:00
|
|
|
#endif
|
|
|
|
|
2020-05-01 15:08:57 +03:00
|
|
|
#define UINT8 unsigned char
|
|
|
|
#define UINT16 unsigned INT16
|
|
|
|
#define UINT32 unsigned INT32
|
2022-10-07 02:00:45 +03:00
|
|
|
#ifdef INT64
|
|
|
|
#define UINT64 unsigned INT64
|
|
|
|
#endif
|
2014-05-09 23:05:30 +04:00
|
|
|
|
2022-10-07 02:11:02 +03:00
|
|
|
#endif /* C99+ */
|
|
|
|
|
2022-10-07 02:02:41 +03:00
|
|
|
#endif /* WIN */
|
2014-05-09 23:05:30 +04:00
|
|
|
|
|
|
|
/* assume IEEE; tweak if necessary (patches are welcome) */
|
2020-05-01 15:08:57 +03:00
|
|
|
#define FLOAT16 UINT16
|
|
|
|
#define FLOAT32 float
|
|
|
|
#define FLOAT64 double
|
2014-05-09 23:05:30 +04:00
|
|
|
|
2014-07-06 02:06:17 +04:00
|
|
|
#ifdef _MSC_VER
|
2021-01-03 06:17:51 +03:00
|
|
|
typedef signed __int64 int64_t;
|
2014-07-06 02:06:17 +04:00
|
|
|
#endif
|
2014-10-27 18:09:45 +03:00
|
|
|
|
|
|
|
#ifdef __GNUC__
|
2021-01-03 06:17:51 +03:00
|
|
|
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
2014-10-27 18:09:45 +03:00
|
|
|
#endif
|