ImPlatform.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. /* Check that we have an ANSI compliant compiler */
  11. #ifndef HAVE_PROTOTYPES
  12. #error Sorry, this library requires support for ANSI prototypes.
  13. #endif
  14. #ifndef STDC_HEADERS
  15. #error Sorry, this library requires ANSI header files.
  16. #endif
  17. #if defined(PIL_NO_INLINE)
  18. #define inline
  19. #else
  20. #if defined(_MSC_VER) && !defined(__GNUC__)
  21. #define inline __inline
  22. #endif
  23. #endif
  24. #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
  25. #define WIN32_LEAN_AND_MEAN
  26. #include <Windows.h>
  27. #ifdef __CYGWIN__
  28. #undef _WIN64
  29. #undef _WIN32
  30. #undef __WIN32__
  31. #undef WIN32
  32. #endif
  33. #else /* not WIN */
  34. /* For System that are not Windows, we'll need to define these. */
  35. /* We have to define them instead of using typedef because the JPEG lib also
  36. defines their own types with the same names, so we need to be able to undef
  37. ours before including the JPEG code. */
  38. #if __STDC_VERSION__ >= 199901L /* C99+ */
  39. #include <stdint.h>
  40. #define INT8 int8_t
  41. #define UINT8 uint8_t
  42. #define INT16 int16_t
  43. #define UINT16 uint16_t
  44. #define INT32 int32_t
  45. #define UINT32 uint32_t
  46. #else /* < C99 */
  47. #define INT8 signed char
  48. #if SIZEOF_SHORT == 2
  49. #define INT16 short
  50. #elif SIZEOF_INT == 2
  51. #define INT16 int
  52. #else
  53. #error Cannot find required 16-bit integer type
  54. #endif
  55. #if SIZEOF_SHORT == 4
  56. #define INT32 short
  57. #elif SIZEOF_INT == 4
  58. #define INT32 int
  59. #elif SIZEOF_LONG == 4
  60. #define INT32 long
  61. #else
  62. #error Cannot find required 32-bit integer type
  63. #endif
  64. #define UINT8 unsigned char
  65. #define UINT16 unsigned INT16
  66. #define UINT32 unsigned INT32
  67. #endif /* < C99 */
  68. #endif /* not WIN */
  69. /* assume IEEE; tweak if necessary (patches are welcome) */
  70. #define FLOAT16 UINT16
  71. #define FLOAT32 float
  72. #define FLOAT64 double
  73. #ifdef _MSC_VER
  74. typedef signed __int64 int64_t;
  75. #endif
  76. #ifdef __GNUC__
  77. #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
  78. #endif