source: libcaca/trunk/caca/caca_types.h.in @ 3993

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

Fixed libcaca and the Visual Studio solution so that it works
on Win64, including the .NET projects.

File size: 3.0 KB
RevLine 
[2299]1/*
2 *  libcaca       Colour ASCII-Art library
[2821]3 *  libcaca       Colour ASCII-Art library
[2299]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
[2821]19#ifndef __CACA_TYPES_H__
20#define __CACA_TYPES_H__
[2299]21
[2821]22#ifndef CACA_TYPES
23#   define CACA_TYPES @CACA_TYPES@
[2299]24#endif
25
[2308]26/* mode 1: standard <stdint.h> header is present, just include it */
[2821]27#if CACA_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 */
[2821]32#elif CACA_TYPES == 2
[2308]33#   include <inttypes.h>
34#   include <unistd.h>
[2299]35
[3452]36/* mode 3: Win32, only (u)intptr_t is present */
[2821]37#elif CACA_TYPES == 3
[2312]38#include <windows.h>
39
[2299]40typedef signed char int8_t;
41typedef signed short int16_t;
42typedef signed long int int32_t;
[2304]43typedef signed long long int int64_t;
[2299]44
45typedef unsigned char uint8_t;
46typedef unsigned short uint16_t;
47typedef unsigned long int uint32_t;
[2304]48typedef unsigned long long int uint64_t;
[2299]49
[2308]50typedef int ssize_t;
51typedef unsigned int size_t;
52
[3452]53/* mode 4: Win64, only (u)intptr_t and size_t are present */
54#elif CACA_TYPES == 4
55#include <windows.h>
56
57typedef signed char int8_t;
58typedef signed short int16_t;
59typedef signed long int int32_t;
60typedef signed long long int int64_t;
61
62typedef unsigned char uint8_t;
63typedef unsigned short uint16_t;
64typedef unsigned long int uint32_t;
65typedef unsigned long long int uint64_t;
66
67typedef int ssize_t;
68
[2312]69/* fallback: nothing is known, we assume the platform is 32-bit and
70 * sizeof(long) == sizeof(void *). We don't typedef directly because we
71 * have no idea what other typedefs have already been made. */
72#else
[2821]73typedef signed char _caca_int8_t;
74typedef signed short _caca_int16_t;
75typedef signed long int _caca_int32_t;
76typedef signed long long int _caca_int64_t;
[2312]77#   undef int8_t
[2821]78#   define int8_t _caca_int8_t
[2312]79#   undef int16_t
[2821]80#   define int16_t _caca_int16_t
[2312]81#   undef int32_t
[2821]82#   define int32_t _caca_int32_t
[2312]83#   undef int64_t
[2821]84#   define int64_t _caca_int64_t
[2312]85
[2821]86typedef unsigned char _caca_uint8_t;
87typedef unsigned short _caca_uint16_t;
88typedef unsigned long int _caca_uint32_t;
89typedef unsigned long long int _caca_uint64_t;
[2312]90#   undef uint8_t
[2821]91#   define uint8_t _caca_uint8_t
[2312]92#   undef uint16_t
[2821]93#   define uint16_t _caca_uint16_t
[2312]94#   undef uint32_t
[2821]95#   define uint32_t _caca_uint32_t
[2312]96#   undef uint64_t
[2821]97#   define uint64_t _caca_uint64_t
[2312]98
[2821]99typedef long int _caca_intptr_t;
100typedef unsigned long int _caca_uintptr_t;
[2312]101#   undef intptr_t
[2821]102#   define intptr_t _caca_intptr_t
[2312]103#   undef uintptr_t
[2821]104#   define uintptr_t _caca_uintptr_t
[2312]105
[2821]106typedef int _caca_ssize_t;
107typedef unsigned int _caca_size_t;
[2312]108#   undef ssize_t
[2821]109#   define ssize_t _caca_ssize_t
[2312]110#   undef size_t
[2821]111#   define size_t _caca_size_t
[2312]112
[2299]113#endif
114
[2821]115#endif /* __CACA_TYPES_H__ */
Note: See TracBrowser for help on using the repository browser.