CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

cstypes.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 1998-2004 by Jorrit Tyberghein
00003   
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008   
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013   
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_CSTYPES_H__
00020 #define __CS_CSTYPES_H__
00021 
00027 #include "csplatform.h"
00028 #include <float.h>
00029 
00030 #if defined(CS_HAS_STDINT_H)
00031 #ifndef __STDC_CONSTANT_MACROS
00032 #define __STDC_CONSTANT_MACROS
00033 #endif
00034 #ifndef __STDC_LIMIT_MACROS
00035 #define __STDC_LIMIT_MACROS
00036 #endif
00037 #include <stdint.h>
00038 #endif
00039 
00040 #if defined(CS_HAS_INTTYPES_H)
00041 #include <inttypes.h>
00042 #endif
00043 
00052 #ifndef CS_HAS_STDINT_H
00053 
00054 typedef unsigned char uint8;
00056 typedef char int8;
00058 typedef unsigned short uint16;
00060 typedef short int16;
00062 typedef unsigned int uint32;
00064 typedef int int32;
00065 #if defined(CS_COMPILER_GCC)
00066 
00067 typedef unsigned long long uint64;
00069 typedef long long int64;
00070 #elif defined(CS_COMPILER_MSVC) || defined(CS_COMPILER_BCC)
00071 
00072 typedef unsigned __int64 uint64;
00074 typedef __int64 int64;
00075 #else
00076 #warning Do not know how to declare 64-bit integers
00077 #endif // CS_COMPILER_GCC
00078 
00079 #else // CS_HAS_STDINT_H
00080 
00081 typedef uint8_t uint8;
00082 typedef int8_t int8;
00083 typedef uint16_t uint16;
00084 typedef int16_t int16;
00085 typedef uint32_t uint32;
00086 typedef int32_t int32;
00087 typedef uint64_t uint64;
00088 typedef int64_t int64;
00089 #endif
00090 
00091 #ifdef CS_HAS_INT64_C
00092 
00098 #define CONST_INT64(x) INT64_C(x)
00099 
00105 #define CONST_UINT64(x) UINT64_C(x)
00106 
00107 #else // CS_HAS_INT64_C
00108 
00109 #if defined(CS_COMPILER_GCC)
00110 #define CONST_INT64(x)  x ## LL
00111 #define CONST_UINT64(x) x ## ULL
00112 #elif defined(CS_COMPILER_MSVC) || defined(CS_COMPILER_BCC)
00113 #define CONST_INT64(x)  x##i64
00114 #define CONST_UINT64(x) x##ui64
00115 #else
00116 #warning Do not know how to contruct 64-bit integer constants
00117 #endif // CS_COMPILER_GCC
00118 
00119 #endif // CS_HAS_INT64_C
00120 
00126 // Provide intptr_t and uintptr_t. If the configure script determined that
00127 // these types exist in the standard headers, then just employ those types.
00128 // For MSVC, where the configure script is not used, check <stddef.h>, which is
00129 // one of several headers which may provide these types. We can tell if
00130 // <stddef.h> provided the types by checking if _INTPTR_T_DEFINED has been
00131 // #defined; newer versions of MSVC will provide them; older ones will not.  If
00132 // all else fails, then we fake up these types on our own.
00133 #include <stddef.h>
00134 #if !defined(CS_HAS_INTPTR_T) && !defined(_INTPTR_T_DEFINED)
00135 
00136 typedef int intptr_t;
00138 typedef unsigned int uintptr_t;
00140 typedef int ptrdiff_t;
00141 #define _INTPTR_T_DEFINED
00142 #define _UINTPTR_T_DEFINED
00143 #define _PTRDIFF_T_DEFINED
00144 #endif
00145 
00146 #if !defined(CS_HAS_INTMAX_T)
00147 
00148 typedef int64 intmax_t;
00150 typedef uint64 uintmax_t;
00151 #endif
00152 
00153 
00154 #if defined(CS_COMPILER_GCC)
00155 #ifndef __STRICT_ANSI__
00156 
00159 typedef long long longlong;
00163 typedef unsigned long long ulonglong;
00164 #else
00165 // @@@ Correct?
00166 typedef int64 longlong;
00167 typedef uint64 ulonglong;
00168 #endif
00169 #elif defined(CS_COMPILER_MSVC) || defined(CS_COMPILER_BCC)
00170 typedef int64 longlong;
00171 typedef uint64 ulonglong;
00172 #else
00173 #ifdef CS_HAS_STDINT_H
00174 typedef int_least64_t longlong;
00175 typedef uint_least64_t ulonglong;
00176 #else 
00177 #warning Do not know how to declare (u)longlong types
00178 #endif 
00179 #endif 
00180 
00187 typedef unsigned int csTicks;
00188 
00190 typedef unsigned int uint;
00195 #endif // __CS_CSTYPES_H__

Generated for Crystal Space by doxygen 1.3.9.1