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
00100 #ifdef BLOCXX_WIN32
00101
00102 #define BLOCXX_SHAREDLIB_EXTENSION ".dll"
00103 #define BLOCXX_FILENAME_SEPARATOR "\\"
00104 #define BLOCXX_FILENAME_SEPARATOR_C '\\'
00105 #define BLOCXX_PATHNAME_SEPARATOR ";"
00106
00107 #if __MINGW32__
00108
00109
00110
00111
00112
00113 #include <windef.h>
00114 #include <winsock2.h>
00115 #endif
00116
00117
00118
00119 struct Select_t
00120 {
00121 Select_t()
00122 : event(NULL)
00123 , sockfd(INVALID_SOCKET)
00124 , networkevents(0)
00125 , doreset(false)
00126 {
00127 }
00128
00129 Select_t(const Select_t& arg)
00130 : event(arg.event)
00131 , sockfd(arg.sockfd)
00132 , networkevents(arg.networkevents)
00133 , doreset(arg.doreset)
00134 {
00135 }
00136
00137 HANDLE event;
00138 SOCKET sockfd;
00139 long networkevents;
00140 bool doreset;
00141 };
00142
00143
00144 #else
00145
00146
00147
00148
00149 typedef int Select_t;
00150
00151 #if defined BLOCXX_DARWIN
00152 #define BLOCXX_SHAREDLIB_EXTENSION ".dylib.bundle"
00153 #elif defined BLOCXX_HPUX
00154 #define BLOCXX_SHAREDLIB_EXTENSION ".sl"
00155 #elif defined BLOCXX_NETWARE
00156 #define BLOCXX_SHAREDLIB_EXTENSION ".nlm"
00157 #else
00158 #define BLOCXX_SHAREDLIB_EXTENSION ".so"
00159 #endif
00160 #define BLOCXX_FILENAME_SEPARATOR "/"
00161 #define BLOCXX_FILENAME_SEPARATOR_C '/'
00162 #define BLOCXX_PATHNAME_SEPARATOR ":"
00163 #endif
00164
00165 #ifdef BLOCXX_WIN32
00166 typedef HANDLE FileHandle;
00167 typedef HANDLE Descriptor;
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 typedef int Descriptor;
00177 #define BLOCXX_INVALID_FILEHANDLE -1
00178 typedef uid_t UserId;
00179 typedef pid_t ProcId;
00180 #endif
00181
00182 }
00183
00184 #endif