| [2299] | 1 | /* |
|---|
| 2 | * libcucul Canvas for ultrafast compositing of Unicode letters |
|---|
| 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 | /* |
|---|
| 16 | * This file contains definitions for the C99 integer types. |
|---|
| 17 | */ |
|---|
| 18 | |
|---|
| 19 | #ifndef __CUCUL_TYPES_H__ |
|---|
| 20 | #define __CUCUL_TYPES_H__ |
|---|
| 21 | |
|---|
| 22 | #ifndef CUCUL_TYPES |
|---|
| 23 | # define CUCUL_TYPES @CUCUL_TYPES@ |
|---|
| 24 | #endif |
|---|
| 25 | |
|---|
| [2308] | 26 | /* mode 1: standard <stdint.h> header is present, just include it */ |
|---|
| [2299] | 27 | #if CUCUL_TYPES == 1 |
|---|
| [2308] | 28 | # include <stdint.h> |
|---|
| 29 | # include <unistd.h> |
|---|
| [2299] | 30 | |
|---|
| [2308] | 31 | /* mode 2: standard <inttypes.h> header is present, just include it */ |
|---|
| [2299] | 32 | #elif CUCUL_TYPES == 2 |
|---|
| [2308] | 33 | # include <inttypes.h> |
|---|
| 34 | # include <unistd.h> |
|---|
| [2299] | 35 | |
|---|
| [2312] | 36 | /* mode 3: <windows.h> indicates Win32, only (u)intptr_t is present |
|---|
| 37 | * FIXME: Win64 probably doesn't work that way */ |
|---|
| 38 | #elif CUCUL_TYPES == 3 |
|---|
| 39 | #include <windows.h> |
|---|
| 40 | |
|---|
| [2299] | 41 | typedef signed char int8_t; |
|---|
| 42 | typedef signed short int16_t; |
|---|
| 43 | typedef signed long int int32_t; |
|---|
| [2304] | 44 | typedef signed long long int int64_t; |
|---|
| [2299] | 45 | |
|---|
| 46 | typedef unsigned char uint8_t; |
|---|
| 47 | typedef unsigned short uint16_t; |
|---|
| 48 | typedef unsigned long int uint32_t; |
|---|
| [2304] | 49 | typedef unsigned long long int uint64_t; |
|---|
| [2299] | 50 | |
|---|
| [2308] | 51 | typedef int ssize_t; |
|---|
| 52 | typedef unsigned int size_t; |
|---|
| 53 | |
|---|
| [2312] | 54 | /* fallback: nothing is known, we assume the platform is 32-bit and |
|---|
| 55 | * sizeof(long) == sizeof(void *). We don't typedef directly because we |
|---|
| 56 | * have no idea what other typedefs have already been made. */ |
|---|
| 57 | #else |
|---|
| 58 | typedef signed char _cucul_int8_t; |
|---|
| 59 | typedef signed short _cucul_int16_t; |
|---|
| 60 | typedef signed long int _cucul_int32_t; |
|---|
| 61 | typedef signed long long int _cucul_int64_t; |
|---|
| 62 | # undef int8_t |
|---|
| 63 | # define int8_t _cucul_int8_t |
|---|
| 64 | # undef int16_t |
|---|
| 65 | # define int16_t _cucul_int16_t |
|---|
| 66 | # undef int32_t |
|---|
| 67 | # define int32_t _cucul_int32_t |
|---|
| 68 | # undef int64_t |
|---|
| 69 | # define int64_t _cucul_int64_t |
|---|
| 70 | |
|---|
| 71 | typedef unsigned char _cucul_uint8_t; |
|---|
| 72 | typedef unsigned short _cucul_uint16_t; |
|---|
| 73 | typedef unsigned long int _cucul_uint32_t; |
|---|
| 74 | typedef unsigned long long int _cucul_uint64_t; |
|---|
| 75 | # undef uint8_t |
|---|
| 76 | # define uint8_t _cucul_uint8_t |
|---|
| 77 | # undef uint16_t |
|---|
| 78 | # define uint16_t _cucul_uint16_t |
|---|
| 79 | # undef uint32_t |
|---|
| 80 | # define uint32_t _cucul_uint32_t |
|---|
| 81 | # undef uint64_t |
|---|
| 82 | # define uint64_t _cucul_uint64_t |
|---|
| 83 | |
|---|
| 84 | typedef long int _cucul_intptr_t; |
|---|
| 85 | typedef unsigned long int _cucul_uintptr_t; |
|---|
| 86 | # undef intptr_t |
|---|
| 87 | # define intptr_t _cucul_intptr_t |
|---|
| 88 | # undef uintptr_t |
|---|
| 89 | # define uintptr_t _cucul_uintptr_t |
|---|
| 90 | |
|---|
| 91 | typedef int _cucul_ssize_t; |
|---|
| 92 | typedef unsigned int _cucul_size_t; |
|---|
| 93 | # undef ssize_t |
|---|
| 94 | # define ssize_t _cucul_ssize_t |
|---|
| 95 | # undef size_t |
|---|
| 96 | # define size_t _cucul_size_t |
|---|
| 97 | |
|---|
| [2299] | 98 | #endif |
|---|
| 99 | |
|---|
| 100 | #endif /* __CUCUL_TYPES_H__ */ |
|---|
| 101 | |
|---|