|
|
@@ -1,5 +1,4 @@ |
|
|
|
/* |
|
|
|
* libcaca Colour ASCII-Art library |
|
|
|
* libcaca Colour ASCII-Art library |
|
|
|
* Copyright (c) 2008-2010 Sam Hocevar <sam@hocevar.net> |
|
|
|
* All Rights Reserved |
|
|
@@ -18,57 +17,50 @@ |
|
|
|
#ifndef __CACA_TYPES_H__ |
|
|
|
#define __CACA_TYPES_H__ |
|
|
|
|
|
|
|
#ifndef CACA_TYPES |
|
|
|
# define CACA_TYPES @CACA_TYPES@ |
|
|
|
#endif |
|
|
|
|
|
|
|
/* mode 1: standard <stdint.h> header is present, just include it */ |
|
|
|
#if CACA_TYPES == 1 |
|
|
|
#if !defined _MSC_VER |
|
|
|
/* FIXME: we should detect platforms with <inttypes.h> and no <stdint.h> */ |
|
|
|
# include <stdint.h> |
|
|
|
# include <unistd.h> |
|
|
|
|
|
|
|
/* mode 2: standard <inttypes.h> header is present, just include it */ |
|
|
|
#elif CACA_TYPES == 2 |
|
|
|
# include <inttypes.h> |
|
|
|
# include <unistd.h> |
|
|
|
|
|
|
|
/* mode 3: Win32, only (u)intptr_t is present */ |
|
|
|
#elif CACA_TYPES == 3 |
|
|
|
#include <windows.h> |
|
|
|
|
|
|
|
typedef signed char int8_t; |
|
|
|
typedef signed short int16_t; |
|
|
|
typedef signed int int32_t; |
|
|
|
typedef signed long long int int64_t; |
|
|
|
|
|
|
|
typedef unsigned char uint8_t; |
|
|
|
typedef unsigned short uint16_t; |
|
|
|
typedef unsigned int uint32_t; |
|
|
|
typedef unsigned long long int uint64_t; |
|
|
|
|
|
|
|
typedef int ssize_t; |
|
|
|
typedef unsigned int size_t; |
|
|
|
|
|
|
|
/* mode 4: Win64, only (u)intptr_t and size_t are present */ |
|
|
|
#elif CACA_TYPES == 4 |
|
|
|
#include <windows.h> |
|
|
|
|
|
|
|
typedef signed char int8_t; |
|
|
|
typedef signed short int16_t; |
|
|
|
typedef signed int int32_t; |
|
|
|
typedef signed long long int int64_t; |
|
|
|
|
|
|
|
typedef unsigned char uint8_t; |
|
|
|
typedef unsigned short uint16_t; |
|
|
|
typedef unsigned int uint32_t; |
|
|
|
typedef unsigned long long int uint64_t; |
|
|
|
|
|
|
|
typedef int ssize_t; |
|
|
|
#else |
|
|
|
# if _MSC_VER >= 1600 |
|
|
|
/* Visual Studio 2010 and later */ |
|
|
|
# include <stdint.h> |
|
|
|
# else |
|
|
|
# include <windows.h> |
|
|
|
# if _MSC_VER >= 1300 |
|
|
|
typedef signed __int8 int8_t; |
|
|
|
typedef signed __int16 int16_t; |
|
|
|
typedef signed __int32 int32_t; |
|
|
|
typedef signed __int64 int64_t; |
|
|
|
typedef unsigned __int8 uint8_t; |
|
|
|
typedef unsigned __int16 uint16_t; |
|
|
|
typedef unsigned __int32 uint32_t; |
|
|
|
typedef unsigned __int64 uint64_t; |
|
|
|
# else |
|
|
|
typedef signed char int8_t; |
|
|
|
typedef signed short int16_t; |
|
|
|
typedef signed int int32_t; |
|
|
|
typedef signed long long int int64_t; |
|
|
|
typedef unsigned char uint8_t; |
|
|
|
typedef unsigned short uint16_t; |
|
|
|
typedef unsigned int uint32_t; |
|
|
|
typedef unsigned long long int uint64_t; |
|
|
|
# endif |
|
|
|
# if defined _WIN64 |
|
|
|
/* Win64, only (u)intptr_t and size_t are present */ |
|
|
|
typedef int ssize_t; |
|
|
|
# else |
|
|
|
/* Win32, only (u)intptr_t is present */ |
|
|
|
typedef int ssize_t; |
|
|
|
typedef unsigned int size_t; |
|
|
|
# endif |
|
|
|
# endif |
|
|
|
#endif |
|
|
|
|
|
|
|
/* fallback: nothing is known, we assume the platform is 32-bit and |
|
|
|
* sizeof(long) == sizeof(void *). We don't typedef directly because we |
|
|
|
* have no idea what other typedefs have already been made. */ |
|
|
|
#else |
|
|
|
#if 0 |
|
|
|
typedef signed char _caca_int8_t; |
|
|
|
typedef signed short _caca_int16_t; |
|
|
|
typedef signed long int _caca_int32_t; |
|
|
@@ -81,7 +73,6 @@ typedef signed long long int _caca_int64_t; |
|
|
|
# define int32_t _caca_int32_t |
|
|
|
# undef int64_t |
|
|
|
# define int64_t _caca_int64_t |
|
|
|
|
|
|
|
typedef unsigned char _caca_uint8_t; |
|
|
|
typedef unsigned short _caca_uint16_t; |
|
|
|
typedef unsigned long int _caca_uint32_t; |
|
|
@@ -94,21 +85,19 @@ typedef unsigned long long int _caca_uint64_t; |
|
|
|
# define uint32_t _caca_uint32_t |
|
|
|
# undef uint64_t |
|
|
|
# define uint64_t _caca_uint64_t |
|
|
|
|
|
|
|
typedef long int _caca_intptr_t; |
|
|
|
typedef unsigned long int _caca_uintptr_t; |
|
|
|
# undef intptr_t |
|
|
|
# define intptr_t _caca_intptr_t |
|
|
|
# undef uintptr_t |
|
|
|
# define uintptr_t _caca_uintptr_t |
|
|
|
|
|
|
|
typedef int _caca_ssize_t; |
|
|
|
typedef unsigned int _caca_size_t; |
|
|
|
# undef ssize_t |
|
|
|
# define ssize_t _caca_ssize_t |
|
|
|
# undef size_t |
|
|
|
# define size_t _caca_size_t |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
#endif /* __CACA_TYPES_H__ */ |
|
|
|
|