qse/ase/types.h

155 lines
3.5 KiB
C
Raw Normal View History

2004-12-18 09:16:31 +00:00
/*
2005-03-29 14:14:15 +00:00
* $Id: types.h,v 1.19 2005-03-29 14:14:15 bacon Exp $
2004-12-18 09:16:31 +00:00
*/
2004-12-18 09:58:49 +00:00
#ifndef _XP_TYPES_H_
#define _XP_TYPES_H_
2004-12-18 09:16:31 +00:00
2005-03-29 10:09:27 +00:00
#ifdef _WIN32
#include <xp/config_win32.h>
#else
#include <xp/config.h>
#endif
2005-02-13 16:15:31 +00:00
2005-02-14 03:13:32 +00:00
/* boolean types */
2005-03-21 08:24:07 +00:00
#ifdef __cplusplus
typedef bool xp_bool_t;
#define xp_true true
#define xp_false false
#else
typedef int xp_bool_t;
#define xp_true (0 == 0)
#define xp_false (0 != 0)
#endif
2005-02-14 03:13:32 +00:00
/* integer that can hold a pointer */
2005-02-13 16:15:31 +00:00
#if SIZEOF_VOID_P == SIZEOF_LONG_LONG
2005-02-14 03:13:32 +00:00
typedef long long xp_int_t;
typedef unsigned long long xp_uint_t;
2005-02-13 16:15:31 +00:00
#elif SIZEOF_VOID_P == SIZEOF_LONG
2005-02-14 03:13:32 +00:00
typedef long xp_int_t;
typedef unsigned long xp_uint_t;
2005-02-13 16:15:31 +00:00
#else
2005-02-14 03:13:32 +00:00
typedef int xp_int_t;
typedef unsigned int xp_uint_t;
2005-02-13 16:15:31 +00:00
#endif
2005-02-14 03:13:32 +00:00
/* the largest integer supported by the system */
#if SIZEOF_LONG_LONG != 0
typedef long long xp_long_t;
typedef unsigned long long xp_ulong_t;
#elif SIZEOF___INT64 != 0
typedef __int64 xp_long_t;
typedef unsigned __int64 xp_ulong_t;
#else
typedef long xp_long_t;
typedef unsigned long xp_ulong_t;
2005-02-13 16:15:31 +00:00
#endif
2005-02-14 03:13:32 +00:00
/* integers of specific size */
#if SIZEOF_CHAR == 1
typedef char xp_int8_t;
typedef unsigned char xp_uint8_t;
#elif SIZEOF___INT8 == 1
typedef __int8 xp_int8_t;
typedef unsigned __int8 xp_uint8_t;
2005-02-13 16:15:31 +00:00
#endif
2005-02-14 03:13:32 +00:00
#if SIZEOF_SHORT == 2
typedef short xp_int16_t;
typedef unsigned short xp_uint16_t;
#elif SIZEOF___INT16 == 2
typedef __int16 xp_int16_t;
typedef unsigned __int16 xp_uint16_t;
2005-02-13 16:15:31 +00:00
#endif
2005-02-14 03:13:32 +00:00
#if SIZEOF_INT == 4
typedef int xp_int32_t;
typedef unsigned int xp_uint32_t;
#elif SIZEOF_LONG == 4
typedef long xp_int32_t;
typedef unsigned long xp_uint32_t;
#elif SIZEOF___INT32 == 4
typedef __int32 xp_int32_t;
typedef unsigned __int32 xp_uint32_t;
2005-02-13 16:15:31 +00:00
#endif
2005-02-14 03:13:32 +00:00
#if SIZEOF_INT == 8
typedef int xp_int64_t;
typedef unsigned int xp_uint64_t;
#elif SIZEOF_LONG == 8
typedef long xp_int64_t;
typedef unsigned long xp_uint64_t;
#elif SIZEOF_LONG_LONG == 8
typedef long long xp_int64_t;
typedef unsigned long long xp_uint64_t;
#elif SIZEOF___INT64 == 8
typedef __int64 xp_int64_t;
typedef unsigned __int64 xp_uint64_t;
#endif
2004-12-18 10:56:00 +00:00
2005-02-14 03:13:32 +00:00
#if SIZEOF_INT == 16
typedef int xp_int128_t;
typedef unsigned int xp_uint128_t;
#elif SIZEOF_LONG == 16
typedef long xp_int128_t;
typedef unsigned long xp_uint128_t;
#elif SIZEOF_LONG_LONG == 16
typedef long long xp_int128_t;
typedef unsigned long long xp_uint128_t;
#elif SIZEOF___INT128 == 16
typedef __int128 xp_int128_t;
typedef unsigned __int128 xp_uint128_t;
#endif
/* miscellaneous integral types */
typedef xp_uint8_t xp_byte_t;
typedef xp_uint_t xp_size_t;
typedef xp_int_t xp_ssize_t;
/* floating-point number */
#if SIZEOF_LONG_DOUBLE > SIZEOF_DOUBLE
typedef long double xp_real_t;
#else
typedef double xp_real_t;
#endif
/* character types */
typedef char xp_mchar_t;
typedef int xp_mcint_t;
2005-03-29 14:14:15 +00:00
#ifdef _WIN32
typedef unsigned short xp_wchar_t;
typedef int xp_wcint_t;
#elif SIZEOF_LONG == 4
2005-02-14 03:13:32 +00:00
/*typedef unsigned short xp_wchar_t;*/
typedef long xp_wchar_t;
typedef long xp_wcint_t;
2005-02-14 03:48:31 +00:00
/*#define XP_SIZEOF_WCHAR_T SIZEOF_SHORT*/
#define XP_SIZEOF_WCHAR_T SIZEOF_LONG
2005-02-14 03:13:32 +00:00
#else
/*typedef unsigned short xp_wchar_t;*/
typedef int xp_wchar_t;
typedef int xp_wcint_t;
2005-02-14 03:48:31 +00:00
/*#define XP_SIZEOF_WCHAR_T SIZEOF_SHORT*/
#define XP_SIZEOF_WCHAR_T SIZEOF_INT
2005-02-14 03:13:32 +00:00
#endif
2005-01-19 12:12:42 +00:00
2005-02-14 03:48:31 +00:00
2005-01-08 13:40:14 +00:00
// TODO: make it configurable from outside
2005-01-06 15:13:26 +00:00
/*
2005-01-02 15:43:46 +00:00
#define XP_CHAR_IS_MCHAR
2004-12-18 09:58:49 +00:00
typedef xp_mchar_t xp_char_t;
typedef xp_mcint_t xp_cint_t;
2005-01-06 15:13:26 +00:00
*/
#define XP_CHAR_IS_WCHAR
typedef xp_wchar_t xp_char_t;
typedef xp_wcint_t xp_cint_t;
2004-12-18 09:16:31 +00:00
2005-03-29 11:37:50 +00:00
#if defined(_WIN32) && defined(XP_CHAR_IS_WCHAR)
2005-03-29 14:14:15 +00:00
#define _UNICODE
2005-03-29 11:37:50 +00:00
#endif
2004-12-18 09:16:31 +00:00
#endif