You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

116 lines
3.0 KiB

  1. /*
  2. * libcaca Colour ASCII-Art library
  3. * libcaca Colour ASCII-Art library
  4. * Copyright (c) 2008 Sam Hocevar <sam@zoy.org>
  5. * All Rights Reserved
  6. *
  7. * $Id$
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the Do What The Fuck You Want To
  11. * Public License, Version 2, as published by Sam Hocevar. See
  12. * http://sam.zoy.org/wtfpl/COPYING for more details.
  13. */
  14. /*
  15. * This file contains definitions for the C99 integer types.
  16. */
  17. #ifndef __CACA_TYPES_H__
  18. #define __CACA_TYPES_H__
  19. #ifndef CACA_TYPES
  20. # define CACA_TYPES @CACA_TYPES@
  21. #endif
  22. /* mode 1: standard <stdint.h> header is present, just include it */
  23. #if CACA_TYPES == 1
  24. # include <stdint.h>
  25. # include <unistd.h>
  26. /* mode 2: standard <inttypes.h> header is present, just include it */
  27. #elif CACA_TYPES == 2
  28. # include <inttypes.h>
  29. # include <unistd.h>
  30. /* mode 3: Win32, only (u)intptr_t is present */
  31. #elif CACA_TYPES == 3
  32. #include <windows.h>
  33. typedef signed char int8_t;
  34. typedef signed short int16_t;
  35. typedef signed long int int32_t;
  36. typedef signed long long int int64_t;
  37. typedef unsigned char uint8_t;
  38. typedef unsigned short uint16_t;
  39. typedef unsigned long int uint32_t;
  40. typedef unsigned long long int uint64_t;
  41. typedef int ssize_t;
  42. typedef unsigned int size_t;
  43. /* mode 4: Win64, only (u)intptr_t and size_t are present */
  44. #elif CACA_TYPES == 4
  45. #include <windows.h>
  46. typedef signed char int8_t;
  47. typedef signed short int16_t;
  48. typedef signed long int int32_t;
  49. typedef signed long long int int64_t;
  50. typedef unsigned char uint8_t;
  51. typedef unsigned short uint16_t;
  52. typedef unsigned long int uint32_t;
  53. typedef unsigned long long int uint64_t;
  54. typedef int ssize_t;
  55. /* fallback: nothing is known, we assume the platform is 32-bit and
  56. * sizeof(long) == sizeof(void *). We don't typedef directly because we
  57. * have no idea what other typedefs have already been made. */
  58. #else
  59. typedef signed char _caca_int8_t;
  60. typedef signed short _caca_int16_t;
  61. typedef signed long int _caca_int32_t;
  62. typedef signed long long int _caca_int64_t;
  63. # undef int8_t
  64. # define int8_t _caca_int8_t
  65. # undef int16_t
  66. # define int16_t _caca_int16_t
  67. # undef int32_t
  68. # define int32_t _caca_int32_t
  69. # undef int64_t
  70. # define int64_t _caca_int64_t
  71. typedef unsigned char _caca_uint8_t;
  72. typedef unsigned short _caca_uint16_t;
  73. typedef unsigned long int _caca_uint32_t;
  74. typedef unsigned long long int _caca_uint64_t;
  75. # undef uint8_t
  76. # define uint8_t _caca_uint8_t
  77. # undef uint16_t
  78. # define uint16_t _caca_uint16_t
  79. # undef uint32_t
  80. # define uint32_t _caca_uint32_t
  81. # undef uint64_t
  82. # define uint64_t _caca_uint64_t
  83. typedef long int _caca_intptr_t;
  84. typedef unsigned long int _caca_uintptr_t;
  85. # undef intptr_t
  86. # define intptr_t _caca_intptr_t
  87. # undef uintptr_t
  88. # define uintptr_t _caca_uintptr_t
  89. typedef int _caca_ssize_t;
  90. typedef unsigned int _caca_size_t;
  91. # undef ssize_t
  92. # define ssize_t _caca_ssize_t
  93. # undef size_t
  94. # define size_t _caca_size_t
  95. #endif
  96. #endif /* __CACA_TYPES_H__ */