source: libcaca/trunk/caca/caca_types.h @ 4686

Last change on this file since 4686 was 4686, checked in by Sam Hocevar, 11 years ago

Get rid of the build time generated caca_types.h. It sucked.

  • Property svn:keywords set to Id
File size: 3.2 KB
Line 
1/*
2 *  libcaca       Colour ASCII-Art library
3 *  Copyright (c) 2008-2010 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://sam.zoy.org/wtfpl/COPYING for more details.
11 */
12
13/*
14 *  This file contains definitions for the C99 integer types.
15 */
16
17#ifndef __CACA_TYPES_H__
18#define __CACA_TYPES_H__
19
20#if !defined _MSC_VER
21    /* FIXME: we should detect platforms with <inttypes.h> and no <stdint.h> */
22#   include <stdint.h>
23#   include <unistd.h>
24#else
25#   if _MSC_VER >= 1600
26        /* Visual Studio 2010 and later */
27#       include <stdint.h>
28#   else
29#       include <windows.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#       if defined _WIN64
50            /* Win64, only (u)intptr_t and size_t are present */
51            typedef int ssize_t;
52#       else
53            /* Win32, only (u)intptr_t is present */
54            typedef int ssize_t;
55            typedef unsigned int size_t;
56#       endif
57#   endif
58#endif
59
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#if 0
64typedef signed char _caca_int8_t;
65typedef signed short _caca_int16_t;
66typedef signed long int _caca_int32_t;
67typedef signed long long int _caca_int64_t;
68#   undef int8_t
69#   define int8_t _caca_int8_t
70#   undef int16_t
71#   define int16_t _caca_int16_t
72#   undef int32_t
73#   define int32_t _caca_int32_t
74#   undef int64_t
75#   define int64_t _caca_int64_t
76typedef unsigned char _caca_uint8_t;
77typedef unsigned short _caca_uint16_t;
78typedef unsigned long int _caca_uint32_t;
79typedef unsigned long long int _caca_uint64_t;
80#   undef uint8_t
81#   define uint8_t _caca_uint8_t
82#   undef uint16_t
83#   define uint16_t _caca_uint16_t
84#   undef uint32_t
85#   define uint32_t _caca_uint32_t
86#   undef uint64_t
87#   define uint64_t _caca_uint64_t
88typedef long int _caca_intptr_t;
89typedef unsigned long int _caca_uintptr_t;
90#   undef intptr_t
91#   define intptr_t _caca_intptr_t
92#   undef uintptr_t
93#   define uintptr_t _caca_uintptr_t
94typedef int _caca_ssize_t;
95typedef unsigned int _caca_size_t;
96#   undef ssize_t
97#   define ssize_t _caca_ssize_t
98#   undef size_t
99#   define size_t _caca_size_t
100#endif
101
102#endif /* __CACA_TYPES_H__ */
103
Note: See TracBrowser for help on using the repository browser.