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 <sys/types.h>
00025 #include <netinet/in.h>
00026 #include <netdb.h>
00027 #include <arpa/inet.h>
00028
00029 #include <inttypes.h>
00030 typedef uint8_t UINT8;
00031 typedef int8_t INT8;
00032 typedef uint16_t UINT16;
00033 typedef int16_t INT16;
00034 typedef uint32_t UINT32;
00035 typedef int32_t INT32;
00036 typedef uint64_t UINT64;
00037 typedef int64_t INT64;
00038
00039 typedef off_t FILE_OFFSET;
00040 typedef int socket_t;
00041
00042 #ifndef __CYGWIN__
00043 #define HAS_READDIR_R
00044 #endif
00045
00046 #ifndef INADDR_NONE
00047
00048 #define INADDR_NONE INADDR_BROADCAST
00049 #endif
00050 #define LEMUR_ALIGN 16
00051 #define LEMUR_PREALIGN
00052 #define LEMUR_POSTALIGN __attribute__ ((aligned))
00053 #else
00054 #define NOGDI
00055
00056 #define _WIN32_WINNT 0x0500
00057 #define WIN32_LEAN_AND_MEAN
00058 #include <windows.h>
00059 #include <winsock.h>
00060
00061
00062 typedef __int64 INT64;
00063 typedef unsigned __int64 UINT64;
00064 typedef signed int INT32;
00065 typedef signed short INT16;
00066 typedef signed char INT8;
00067 typedef unsigned int UINT32;
00068 typedef unsigned char UINT8;
00069 typedef signed char INT8;
00070 typedef int FILE_OFFSET;
00071 typedef SOCKET socket_t;
00072
00073 #if _MSC_VER == 1200
00074
00075 #define LEMUR_BROKEN_MIN
00076 #define LEMUR_BROKEN_MAX
00077 #define LEMUR_BROKEN_AUTOPTR
00078 #define LEMUR_NO_REMOVE
00079 #endif
00080
00081 #define LEMUR_ALIGN 16
00082 #define LEMUR_PREALIGN __declspec(align(16))
00083 #define LEMUR_POSTALIGN
00084
00085 #define LEMUR_USING_FINDFIRST
00086
00087 typedef int socklen_t;
00088 #endif
00089
00090 #define PTR_TO_SIZET(s) ( (size_t) ( (void*) (s) ) )
00091 #define PTR_TO_INT(s) ( (int) ( (size_t) ( (void*) (s) ) ) )
00092
00093 #ifndef MAX_UINT64
00094 #define MAX_UINT64 ( ~ ((UINT64) 0) )
00095 #endif
00096
00097 #ifndef MAX_INT64
00098 #define MAX_INT64 ( (INT64) ( MAX_UINT64 >> 1 ) )
00099 #endif
00100
00101 #ifndef MIN_INT64
00102 #define MIN_INT64 ( (INT64) ( MAX_UINT64 ^ ( (UINT64) MAX_INT64 ) ) )
00103 #endif
00104
00105 #ifndef MAX_UINT32
00106 #define MAX_UINT32 ( ~ ((UINT32) 0) )
00107 #endif
00108
00109 #ifndef MAX_INT32
00110 #define MAX_INT32 ( (INT32) (MAX_UINT32 >> 1) )
00111 #endif
00112
00113 #ifndef MIN_INT32
00114 #define MIN_INT32 ( (INT32) ( MAX_UINT32 ^ ( (UINT32) MAX_INT32 ) ) )
00115 #endif
00116
00117 #endif
00118