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.

caca_types.h.in 2.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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: <windows.h> indicates Win32, only (u)intptr_t is present
  31. * FIXME: Win64 probably doesn't work that way */
  32. #elif CACA_TYPES == 3
  33. #include <windows.h>
  34. typedef signed char int8_t;
  35. typedef signed short int16_t;
  36. typedef signed long int int32_t;
  37. typedef signed long long int int64_t;
  38. typedef unsigned char uint8_t;
  39. typedef unsigned short uint16_t;
  40. typedef unsigned long int uint32_t;
  41. typedef unsigned long long int uint64_t;
  42. typedef int ssize_t;
  43. typedef unsigned int size_t;
  44. /* fallback: nothing is known, we assume the platform is 32-bit and
  45. * sizeof(long) == sizeof(void *). We don't typedef directly because we
  46. * have no idea what other typedefs have already been made. */
  47. #else
  48. typedef signed char _caca_int8_t;
  49. typedef signed short _caca_int16_t;
  50. typedef signed long int _caca_int32_t;
  51. typedef signed long long int _caca_int64_t;
  52. # undef int8_t
  53. # define int8_t _caca_int8_t
  54. # undef int16_t
  55. # define int16_t _caca_int16_t
  56. # undef int32_t
  57. # define int32_t _caca_int32_t
  58. # undef int64_t
  59. # define int64_t _caca_int64_t
  60. typedef unsigned char _caca_uint8_t;
  61. typedef unsigned short _caca_uint16_t;
  62. typedef unsigned long int _caca_uint32_t;
  63. typedef unsigned long long int _caca_uint64_t;
  64. # undef uint8_t
  65. # define uint8_t _caca_uint8_t
  66. # undef uint16_t
  67. # define uint16_t _caca_uint16_t
  68. # undef uint32_t
  69. # define uint32_t _caca_uint32_t
  70. # undef uint64_t
  71. # define uint64_t _caca_uint64_t
  72. typedef long int _caca_intptr_t;
  73. typedef unsigned long int _caca_uintptr_t;
  74. # undef intptr_t
  75. # define intptr_t _caca_intptr_t
  76. # undef uintptr_t
  77. # define uintptr_t _caca_uintptr_t
  78. typedef int _caca_ssize_t;
  79. typedef unsigned int _caca_size_t;
  80. # undef ssize_t
  81. # define ssize_t _caca_ssize_t
  82. # undef size_t
  83. # define size_t _caca_size_t
  84. #endif
  85. #endif /* __CACA_TYPES_H__ */