00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00038 #ifndef BLOCXX_TYPES_HPP_INCLUDE_GUARD_
00039 #define BLOCXX_TYPES_HPP_INCLUDE_GUARD_
00040 #include "blocxx/BLOCXX_config.h"
00041
00042 #ifndef __cplusplus
00043 #error "BLOCXX_Types.hpp can only be included by c++ files"
00044 #endif
00045
00046 extern "C"
00047 {
00048 #include <sys/types.h>
00049 }
00050
00051 namespace BLOCXX_NAMESPACE
00052 {
00053
00054 typedef unsigned char UInt8;
00055 typedef signed char Int8;
00056 #if BLOCXX_SIZEOF_SHORT_INT == 2
00057 typedef unsigned short UInt16;
00058 typedef short Int16;
00059 #define BLOCXX_INT16_IS_SHORT 1
00060 #elif BLOCXX_SIZEOF_INT == 2
00061 typedef unsigned int UInt16;
00062 typedef int Int16;
00063 #define BLOCXX_INT16_IS_INT 1
00064 #endif
00065 #if BLOCXX_SIZEOF_INT == 4
00066 typedef unsigned int UInt32;
00067 typedef int Int32;
00068 #define BLOCXX_INT32_IS_INT 1
00069 #elif BLOCXX_SIZEOF_LONG_INT == 4
00070 typedef unsigned long UInt32;
00071 typedef long Int32;
00072 #define BLOCXX_INT32_IS_LONG 1
00073 #endif
00074 #if BLOCXX_SIZEOF_LONG_INT == 8
00075 typedef unsigned long UInt64;
00076 typedef long Int64;
00077 #define BLOCXX_INT64_IS_LONG 1
00078 #elif BLOCXX_SIZEOF_LONG_LONG_INT == 8
00079 typedef unsigned long long UInt64;
00080 typedef long long Int64;
00081 #define BLOCXX_INT64_IS_LONG_LONG 1
00082 #else
00083 #error "Compiler must support 64 bit long"
00084 #endif
00085 #if BLOCXX_SIZEOF_DOUBLE == 8
00086 typedef double Real64;
00087 #define BLOCXX_REAL64_IS_DOUBLE 1
00088 #elif BLOCXX_SIZEOF_LONG_DOUBLE == 8
00089 typedef long double Real64;
00090 #define BLOCXX_REAL64_IS_LONG_DOUBLE 1
00091 #endif
00092 #if BLOCXX_SIZEOF_FLOAT == 4
00093 typedef float Real32;
00094 #define BLOCXX_REAL32_IS_FLOAT 1
00095 #elif BLOCXX_SIZEOF_DOUBLE == 4
00096 typedef double Real32;
00097 #define BLOCXX_REAL32_IS_DOUBLE 1
00098 #endif
00099 typedef off_t off_t;
00100
00101 #ifdef BLOCXX_WIN32
00102
00103 #define BLOCXX_SHAREDLIB_EXTENSION ".dll"
00104 #define BLOCXX_FILENAME_SEPARATOR "\\"
00105 #define BLOCXX_FILENAME_SEPARATOR_C '\\'
00106 #define BLOCXX_PATHNAME_SEPARATOR ";"
00107
00108 #if __MINGW32__
00109
00110
00111
00112
00113
00114 #include <windef.h>
00115 #include <winsock2.h>
00116 #endif
00117
00118
00119
00120 struct Select_t
00121 {
00122 Select_t()
00123 : event(NULL)
00124 , sockfd(INVALID_SOCKET)
00125 , networkevents(0)
00126 , doreset(false)
00127 {
00128 }
00129
00130 Select_t(const Select_t& arg)
00131 : event(arg.event)
00132 , sockfd(arg.sockfd)
00133 , networkevents(arg.networkevents)
00134 , doreset(arg.doreset)
00135 {
00136 }
00137
00138 HANDLE event;
00139 SOCKET sockfd;
00140 long networkevents;
00141 bool doreset;
00142 };
00143
00144
00145 #else
00146
00147
00148
00149
00150 typedef int Select_t;
00151
00152 #if defined BLOCXX_DARWIN
00153 #define BLOCXX_SHAREDLIB_EXTENSION ".dylib"
00154 #elif defined BLOCXX_HPUX
00155 #define BLOCXX_SHAREDLIB_EXTENSION ".sl"
00156 #elif defined BLOCXX_NETWARE
00157 #define BLOCXX_SHAREDLIB_EXTENSION ".nlm"
00158 #else
00159 #define BLOCXX_SHAREDLIB_EXTENSION ".so"
00160 #endif
00161 #define BLOCXX_FILENAME_SEPARATOR "/"
00162 #define BLOCXX_FILENAME_SEPARATOR_C '/'
00163 #define BLOCXX_PATHNAME_SEPARATOR ":"
00164 #endif
00165
00166 #ifdef BLOCXX_WIN32
00167 typedef HANDLE FileHandle;
00168 #define BLOCXX_INVALID_FILEHANDLE INVALID_HANDLE_VALUE
00169 typedef int UserId;
00170 typedef int uid_t;
00171 typedef DWORD pid_t;
00172 typedef DWORD ProcId;
00173 typedef struct {} siginfo_t;
00174 #else
00175 typedef int FileHandle;
00176 #define BLOCXX_INVALID_FILEHANDLE -1
00177 typedef uid_t UserId;
00178 typedef pid_t ProcId;
00179 #endif
00180
00181 }
00182
00183 #endif