2004-12-18 09:16:31 +00:00
|
|
|
/*
|
2005-06-08 15:49:35 +00:00
|
|
|
* $Id: types.h,v 1.28 2005-06-08 15:49:35 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-05-19 16:41:10 +00:00
|
|
|
#if defined(_DOS)
|
|
|
|
#include <xp/conf_dos.h>
|
|
|
|
#elif defined(_WIN32)
|
2005-05-20 04:01:12 +00:00
|
|
|
#include <xp/conf_win.h>
|
2005-04-18 03:43:17 +00:00
|
|
|
#elif defined(__VMS)
|
2005-05-20 04:01:12 +00:00
|
|
|
#include <xp/conf_vms.h>
|
2005-03-29 10:09:27 +00:00
|
|
|
#else
|
|
|
|
#include <xp/config.h>
|
|
|
|
#endif
|
2005-02-13 16:15:31 +00:00
|
|
|
|
2005-05-04 04:33:42 +00:00
|
|
|
/* boolean type */
|
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
|
|
|
|
2005-05-04 04:33:42 +00:00
|
|
|
/* tri-state type */
|
|
|
|
typedef int xp_tri_t;
|
|
|
|
#define xp_alive 1
|
|
|
|
#define xp_zombie 0
|
|
|
|
#define xp_dead -1
|
|
|
|
|
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;
|
2005-06-08 15:49:35 +00:00
|
|
|
typedef xp_uint_t xp_word_t;
|
2005-02-14 03:13:32 +00:00
|
|
|
|
|
|
|
/* 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-05-19 16:41:10 +00:00
|
|
|
#ifdef _DOS
|
|
|
|
/* no wchar support */
|
|
|
|
#define XP_CHAR_IS_MCHAR
|
|
|
|
#elif defined(_WIN32)
|
2005-03-29 14:14:15 +00:00
|
|
|
typedef unsigned short xp_wchar_t;
|
2005-06-06 16:32:29 +00:00
|
|
|
/*typedef int xp_wcint_t;*/
|
|
|
|
typedef unsigned short xp_wcint_t;
|
2005-03-29 14:14:15 +00:00
|
|
|
#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-04-17 15:28:49 +00:00
|
|
|
#if defined(XP_CHAR_IS_MCHAR)
|
2005-05-19 16:41:10 +00:00
|
|
|
/*#define XP_CHAR_IS_MCHAR*/
|
2005-04-17 15:28:49 +00:00
|
|
|
typedef xp_mchar_t xp_char_t;
|
|
|
|
typedef xp_mcint_t xp_cint_t;
|
|
|
|
#elif defined(XP_CHAR_IS_WCHAR)
|
|
|
|
typedef xp_wchar_t xp_char_t;
|
|
|
|
typedef xp_wcint_t xp_cint_t;
|
|
|
|
#else
|
|
|
|
#define XP_CHAR_IS_WCHAR
|
|
|
|
typedef xp_wchar_t xp_char_t;
|
|
|
|
typedef xp_wcint_t xp_cint_t;
|
|
|
|
#endif
|
2005-04-10 06:41:37 +00:00
|
|
|
|
|
|
|
#ifdef XP_CHAR_IS_WCHAR
|
|
|
|
#define UNICODE
|
|
|
|
#endif
|
|
|
|
|
2004-12-18 09:16:31 +00:00
|
|
|
#endif
|