ImPlatform.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * The Python Imaging Library
  3. * $Id$
  4. *
  5. * platform declarations for the imaging core library
  6. *
  7. * Copyright (c) Fredrik Lundh 1995-2003.
  8. */
  9. #include "Python.h"
  10. /* Workaround issue #2479 */
  11. #if PY_VERSION_HEX < 0x03070000 && defined(PySlice_GetIndicesEx) && !defined(PYPY_VERSION)
  12. #undef PySlice_GetIndicesEx
  13. #endif
  14. /* Check that we have an ANSI compliant compiler */
  15. #ifndef HAVE_PROTOTYPES
  16. #error Sorry, this library requires support for ANSI prototypes.
  17. #endif
  18. #ifndef STDC_HEADERS
  19. #error Sorry, this library requires ANSI header files.
  20. #endif
  21. #if defined(PIL_NO_INLINE)
  22. #define inline
  23. #else
  24. #if defined(_MSC_VER) && !defined(__GNUC__)
  25. #define inline __inline
  26. #endif
  27. #endif
  28. #ifdef _WIN32
  29. #define WIN32_LEAN_AND_MEAN
  30. #include <Windows.h>
  31. #else
  32. /* For System that are not Windows, we'll need to define these. */
  33. #if SIZEOF_SHORT == 2
  34. #define INT16 short
  35. #elif SIZEOF_INT == 2
  36. #define INT16 int
  37. #else
  38. #define INT16 short /* most things works just fine anyway... */
  39. #endif
  40. #if SIZEOF_SHORT == 4
  41. #define INT32 short
  42. #elif SIZEOF_INT == 4
  43. #define INT32 int
  44. #elif SIZEOF_LONG == 4
  45. #define INT32 long
  46. #else
  47. #error Cannot find required 32-bit integer type
  48. #endif
  49. #if SIZEOF_LONG == 8
  50. #define INT64 long
  51. #elif SIZEOF_LONG_LONG == 8
  52. #define INT64 long
  53. #endif
  54. #define INT8 signed char
  55. #define UINT8 unsigned char
  56. #define UINT16 unsigned INT16
  57. #define UINT32 unsigned INT32
  58. #endif
  59. /* assume IEEE; tweak if necessary (patches are welcome) */
  60. #define FLOAT16 UINT16
  61. #define FLOAT32 float
  62. #define FLOAT64 double
  63. #ifdef _MSC_VER
  64. typedef signed __int64 int64_t;
  65. #endif
  66. #ifdef __GNUC__
  67. #define GCC_VERSION (__GNUC__ * 10000 \
  68. + __GNUC_MINOR__ * 100 \
  69. + __GNUC_PATCHLEVEL__)
  70. #endif