00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00021 #ifndef _types_h
00022 #define _types_h
00023
00024 #if defined(_WIN32) || defined(_WIN64)
00025 #include <spl/cleanwindows.h>
00026 #else
00027 #include <spl/autoconf/config.h>
00028 #endif
00029
00030 #if HAVE_TYPES_H
00031 #include <types.h>
00032 #endif
00033 #if HAVE_SYS_TYPES_H
00034 #include <sys/types.h>
00035 #endif
00036 #if HAVE_STRING_H
00037 #include <string.h>
00038 #endif
00039
00228 #if defined(_WIN32) || defined(WIN32) || defined(_WIN64) || defined(WIN64) || defined(_MSC_VER)
00229 #ifndef _WIN32 //< TODO should be able to remove this
00230 #define _WIN32
00231 #endif
00232 #ifndef WIN32 //< TODO should be able to remove this
00233 #define WIN32
00234 #endif
00235 #ifndef _WINDOWS
00236 #define _WINDOWS
00237 #endif
00238 #if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)
00239 #define LITTLE_ENDIAN 1
00240 #endif
00241 typedef signed __int64 int64;
00242 typedef unsigned __int64 uint64;
00243 typedef signed int int32;
00244 typedef signed short int16;
00245 typedef __int8 int8;
00246 typedef unsigned char byte;
00247
00248 typedef unsigned int uint32;
00249 typedef unsigned short uint16;
00250 typedef unsigned __int8 uint8;
00251
00252 typedef float float32;
00253 typedef double float64;
00254
00255 #elif __GNUC__
00256 #if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)
00257 #define LITTLE_ENDIAN 1
00258 #endif
00259 typedef signed long long int64;
00260 typedef unsigned long long uint64;
00261 typedef signed int int32;
00262 typedef signed short int16;
00263 typedef char int8;
00264 typedef unsigned char byte;
00265
00266 typedef unsigned int uint32;
00267 typedef unsigned short uint16;
00268 typedef unsigned char uint8;
00269
00270 typedef float float32;
00271 typedef double float64;
00272
00273 char *itoa( int i, char *buf, const int buflen );
00274
00275 #elif defined(__TANDEM)
00276 #define _TANDEM
00277
00278 #include <sys/types.h>
00279 #include <wchar.h>
00280 #if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)
00281 #define BIG_ENDIAN 1
00282 #endif
00283 typedef signed long long int64;
00284
00285 typedef signed long long uint64;
00286 typedef signed int int32;
00287 typedef signed short int16;
00288 typedef char int8;
00289 typedef unsigned char byte;
00290
00291 typedef unsigned int uint32;
00292 typedef unsigned short uint16;
00293 typedef unsigned char uint8;
00294
00295 typedef float float32;
00296 typedef double float64;
00297
00298 char *itoa( int i, char *buf, const int buflen );
00299
00300
00301 #else
00302
00303 #error Unsupported Target
00304
00305 #endif
00306
00307 #ifndef __cplusplus
00308 #define false 0
00309 #define true 1
00310 typedef char bool;
00311 #endif
00312
00313 #define IL_MIN_INT32 ((int32)0x80000000)
00314 #define IL_MAX_INT32 ((int32)0x7FFFFFFF)
00315 #define IL_MAX_UINT32 ((uint32)0xFFFFFFFFL)
00316 #define IL_MIN_INT64 ((int64)0x8000000000000000LL)
00317 #define IL_MAX_INT64 ((int64)0x7FFFFFFFFFFFFFFFLL)
00318 #define IL_MAX_UINT64 ((int64)0x7FFFFFFFFFFFFFFFLL)
00319
00320 #define READ_BYTE(buf, offset) ((int32)(((int8 *)(buf))[(offset)]))
00321 #define READ_BYTE_SHIFT(buf,offset,shift) (((uint32)(((uint8 *)(buf))[(offset)])) << (shift))
00322
00324 inline void ValidateType( int8 i ) {}
00325 inline void ValidateType( int16 i ) {}
00326 inline void ValidateType( int32 i ) {}
00327 inline void ValidateType( int64 i ) {}
00328 inline void ValidateType( float32 i ) {}
00329 inline void ValidateType( float64 i ) {}
00330 inline void ValidateType( byte i ) {}
00331 inline void ValidateType( uint16 i ) {}
00332 inline void ValidateType( uint32 i ) {}
00333 #ifndef __TANDEM
00334 inline void ValidateType( uint64 i ) {}
00335 #endif
00336
00337
00339 class IHashable
00340 {
00341 public:
00342 inline IHashable() {}
00343 virtual ~IHashable();
00344 virtual int32 HashCode() const = 0;
00345 };
00346
00350 class IComparable : public IHashable
00351 {
00352 public:
00353 inline IComparable() {}
00354 virtual ~IComparable();
00355 virtual bool Equals( const IComparable& a ) const = 0;
00356 virtual int Compare( const IComparable& a ) const = 0;
00357
00360 virtual int32 MajicNumber() const = 0;
00361 virtual int32 HashCode() const = 0;
00362 };
00363
00364 #define BYTE_MAJIC 0x0112
00365 #define BOOL_MAJIC 0x0113
00366 #define INT16_MAJIC 0x0114
00367 #define FLOAT32_MAJIC 0x0115
00368
00369 #include <spl/typeof.h>
00370
00374 #endif