Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

caca_types.h 3.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * libcaca Colour ASCII-Art library
  3. * Copyright (c) 2008-2012 Sam Hocevar <sam@hocevar.net>
  4. * All Rights Reserved
  5. *
  6. * This library is free software. It comes without any warranty, to
  7. * the extent permitted by applicable law. You can redistribute it
  8. * and/or modify it under the terms of the Do What the Fuck You Want
  9. * to Public License, Version 2, as published by Sam Hocevar. See
  10. * http://www.wtfpl.net/ for more details.
  11. */
  12. /*
  13. * This file contains definitions for required C99 integer types.
  14. */
  15. #ifndef __CACA_TYPES_H__
  16. #define __CACA_TYPES_H__
  17. #if !defined _MSC_VER
  18. /* FIXME: detect platforms with <inttypes.h> and no <stdint.h> */
  19. # include <stdint.h>
  20. # include <unistd.h>
  21. #elif defined _MSC_STDINT_H_ /* msinttypes */ \
  22. || defined NM_DEFINED_FIXED_WIDTH_TYPEDEFS /* Morpheme */
  23. /* Someone already defined things for us: do nothing */
  24. #else
  25. # if _MSC_VER >= 1600
  26. /* Visual Studio 2010 and later */
  27. # include <stdint.h>
  28. # else
  29. # include <intsafe.h>
  30. # if _MSC_VER >= 1300
  31. typedef signed __int8 int8_t;
  32. typedef signed __int16 int16_t;
  33. typedef signed __int32 int32_t;
  34. typedef signed __int64 int64_t;
  35. typedef unsigned __int8 uint8_t;
  36. typedef unsigned __int16 uint16_t;
  37. typedef unsigned __int32 uint32_t;
  38. typedef unsigned __int64 uint64_t;
  39. # else
  40. typedef signed char int8_t;
  41. typedef signed short int16_t;
  42. typedef signed int int32_t;
  43. typedef signed long long int int64_t;
  44. typedef unsigned char uint8_t;
  45. typedef unsigned short uint16_t;
  46. typedef unsigned int uint32_t;
  47. typedef unsigned long long int uint64_t;
  48. # endif
  49. # endif
  50. # if defined _WIN64
  51. /* Win64, (u)intptr_t and size_t are present */
  52. typedef int ssize_t;
  53. # else
  54. /* Win32, only (u)intptr_t is present */
  55. typedef int ssize_t;
  56. typedef unsigned int size_t;
  57. # endif
  58. #endif
  59. #if 0
  60. /* fallback: nothing is known, we assume the platform is 32-bit and
  61. * sizeof(long) == sizeof(void *). We don't typedef directly because we
  62. * have no idea what other typedefs have already been made. */
  63. typedef signed char _caca_int8_t;
  64. typedef signed short _caca_int16_t;
  65. typedef signed long int _caca_int32_t;
  66. typedef signed long long int _caca_int64_t;
  67. # undef int8_t
  68. # define int8_t _caca_int8_t
  69. # undef int16_t
  70. # define int16_t _caca_int16_t
  71. # undef int32_t
  72. # define int32_t _caca_int32_t
  73. # undef int64_t
  74. # define int64_t _caca_int64_t
  75. typedef unsigned char _caca_uint8_t;
  76. typedef unsigned short _caca_uint16_t;
  77. typedef unsigned long int _caca_uint32_t;
  78. typedef unsigned long long int _caca_uint64_t;
  79. # undef uint8_t
  80. # define uint8_t _caca_uint8_t
  81. # undef uint16_t
  82. # define uint16_t _caca_uint16_t
  83. # undef uint32_t
  84. # define uint32_t _caca_uint32_t
  85. # undef uint64_t
  86. # define uint64_t _caca_uint64_t
  87. typedef long int _caca_intptr_t;
  88. typedef unsigned long int _caca_uintptr_t;
  89. # undef intptr_t
  90. # define intptr_t _caca_intptr_t
  91. # undef uintptr_t
  92. # define uintptr_t _caca_uintptr_t
  93. typedef int _caca_ssize_t;
  94. typedef unsigned int _caca_size_t;
  95. # undef ssize_t
  96. # define ssize_t _caca_ssize_t
  97. # undef size_t
  98. # define size_t _caca_size_t
  99. #endif
  100. #endif /* __CACA_TYPES_H__ */