00001
00012 #ifndef LEMUR_PLATFORM_H
00013 #define LEMUR_PLATFORM_H
00014
00015
00016
00017 #ifndef WIN32
00018
00019 #include <stddef.h>
00020 #include <limits.h>
00021 #include <float.h>
00022 #include <unistd.h>
00023 #include <sys/socket.h>
00024 #include <netdb.h>
00025 #include <arpa/inet.h>
00026
00027 typedef long long INT64;
00028 typedef unsigned long long UINT64;
00029 typedef signed int INT32;
00030 typedef unsigned int UINT32;
00031 typedef signed short INT16;
00032 typedef unsigned short UINT16;
00033 typedef off_t FILE_OFFSET;
00034 typedef int socket_t;
00035
00036 #ifndef __CYGWIN__
00037 #define HAS_READDIR_R
00038 #endif
00039
00040 #ifndef INADDR_NONE
00041
00042 #define INADDR_NONE INADDR_BROADCAST
00043 #endif
00044
00045 #define LEMUR_ALIGN 16
00046 #define LEMUR_PREALIGN
00047 #define LEMUR_POSTALIGN __attribute__ ((aligned))
00048 #else
00049 #define NOGDI
00050 #define WIN32_LEAN_AND_MEAN
00051 #include <windows.h>
00052 #include <winsock.h>
00053
00054
00055 typedef __int64 INT64;
00056 typedef unsigned __int64 UINT64;
00057 typedef signed int INT32;
00058 typedef signed short INT16;
00059 typedef signed char INT8;
00060 typedef unsigned int UINT32;
00061 typedef int FILE_OFFSET;
00062 typedef SOCKET socket_t;
00063
00064 #if _MSC_VER == 1200
00065
00066 #define LEMUR_BROKEN_MIN
00067 #define LEMUR_BROKEN_MAX
00068 #define LEMUR_BROKEN_AUTOPTR
00069 #define LEMUR_NO_REMOVE
00070 #endif
00071
00072 #define LEMUR_ALIGN 16
00073 #define LEMUR_PREALIGN __declspec(align(16))
00074 #define LEMUR_POSTALIGN
00075
00076 #define LEMUR_USING_FINDFIRST
00077 #endif
00078
00079 #define PTR_TO_SIZET(s) ( (size_t) ( (void*) (s) ) )
00080 #define PTR_TO_INT(s) ( (int) ( (size_t) ( (void*) (s) ) ) )
00081
00082 #ifndef MAX_UINT64
00083 #define MAX_UINT64 ( ~ ((UINT64) 0) )
00084 #endif
00085
00086 #ifndef MAX_INT64
00087 #define MAX_INT64 ( (INT64) ( MAX_UINT64 >> 1 ) )
00088 #endif
00089
00090 #ifndef MIN_INT64
00091 #define MIN_INT64 ( (INT64) ( MAX_UINT64 ^ ( (UINT64) MAX_INT64 ) ) )
00092 #endif
00093
00094 #ifndef MAX_UINT32
00095 #define MAX_UINT32 ( ~ ((UINT32) 0) )
00096 #endif
00097
00098 #ifndef MAX_INT32
00099 #define MAX_INT32 ( (INT32) (MAX_UINT32 >> 1) )
00100 #endif
00101
00102 #ifndef MIN_INT32
00103 #define MIN_INT32 ( (INT32) ( MAX_UINT32 ^ ( (UINT32) MAX_INT32 ) ) )
00104 #endif
00105
00106 #endif
00107