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