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
00036 #ifndef OWBI1_TYPES_HPP_INCLUDE_GUARD_
00037 #define OWBI1_TYPES_HPP_INCLUDE_GUARD_
00038 #include "OWBI1_config.h"
00039
00040 #ifndef __cplusplus
00041 #error "OWBI1_Types.hpp can only be included by c++ files"
00042 #endif
00043
00044 extern "C"
00045 {
00046 #include <sys/types.h>
00047 }
00048
00049 namespace OWBI1
00050 {
00051
00052 typedef unsigned char UInt8;
00053 typedef signed char Int8;
00054 #if OWBI1_SIZEOF_SHORT_INT == 2
00055 typedef unsigned short UInt16;
00056 typedef short Int16;
00057 #define OWBI1_INT16_IS_SHORT 1
00058 #elif OWBI1_SIZEOF_INT == 2
00059 typedef unsigned int UInt16;
00060 typedef int Int16;
00061 #define OWBI1_INT16_IS_INT 1
00062 #endif
00063 #if OWBI1_SIZEOF_INT == 4
00064 typedef unsigned int UInt32;
00065 typedef int Int32;
00066 #define OWBI1_INT32_IS_INT 1
00067 #elif OWBI1_SIZEOF_LONG_INT == 4
00068 typedef unsigned long UInt32;
00069 typedef long Int32;
00070 #define OWBI1_INT32_IS_LONG 1
00071 #endif
00072 #if OWBI1_SIZEOF_LONG_INT == 8
00073 typedef unsigned long UInt64;
00074 typedef long Int64;
00075 #define OWBI1_INT64_IS_LONG 1
00076 #elif OWBI1_SIZEOF_LONG_LONG_INT == 8
00077 typedef unsigned long long UInt64;
00078 typedef long long Int64;
00079 #define OWBI1_INT64_IS_LONG_LONG 1
00080 #else
00081 #error "Compiler must support 64 bit long"
00082 #endif
00083 #if OWBI1_SIZEOF_DOUBLE == 8
00084 typedef double Real64;
00085 #define OWBI1_REAL64_IS_DOUBLE 1
00086 #elif OWBI1_SIZEOF_LONG_DOUBLE == 8
00087 typedef long double Real64;
00088 #define OWBI1_REAL64_IS_LONG_DOUBLE 1
00089 #endif
00090 #if OWBI1_SIZEOF_FLOAT == 4
00091 typedef float Real32;
00092 #define OWBI1_REAL32_IS_FLOAT 1
00093 #elif OWBI1_SIZEOF_DOUBLE == 4
00094 typedef double Real32;
00095 #define OWBI1_REAL32_IS_DOUBLE 1
00096 #endif
00097 typedef off_t off_t;
00098
00099 #ifdef OWBI1_WIN32
00100
00101 #define OWBI1_SHAREDLIB_EXTENSION ".dll"
00102 #define OWBI1_FILENAME_SEPARATOR "\\"
00103 #define OWBI1_FILENAME_SEPARATOR_C '\\'
00104 #define OWBI1_PATHNAME_SEPARATOR ";"
00105
00106
00107 struct Select_t
00108 {
00109 Select_t()
00110 : event(NULL)
00111 , sockfd(INVALID_SOCKET)
00112 , networkevents(0)
00113 , doreset(false)
00114 {
00115 }
00116
00117 Select_t(const Select_t& arg)
00118 : event(arg.event)
00119 , sockfd(arg.sockfd)
00120 , networkevents(arg.networkevents)
00121 , doreset(arg.doreset)
00122 {
00123 }
00124
00125 HANDLE event;
00126 SOCKET sockfd;
00127 long networkevents;
00128 bool doreset;
00129 };
00130
00131
00132 #else
00133
00134
00135
00136
00137 typedef int Select_t;
00138
00139 #if defined OWBI1_DARWIN
00140 #define OWBI1_SHAREDLIB_EXTENSION ".dylib"
00141 #elif defined OWBI1_HPUX
00142 #define OWBI1_SHAREDLIB_EXTENSION ".sl"
00143 #elif defined OWBI1_NETWARE
00144 #define OWBI1_SHAREDLIB_EXTENSION ".nlm"
00145 #else
00146 #define OWBI1_SHAREDLIB_EXTENSION ".so"
00147 #endif
00148 #define OWBI1_FILENAME_SEPARATOR "/"
00149 #define OWBI1_FILENAME_SEPARATOR_C '/'
00150 #define OWBI1_PATHNAME_SEPARATOR ":"
00151 #endif
00152
00153 #ifdef OWBI1_WIN32
00154 typedef HANDLE FileHandle;
00155 #define OWBI1_INVALID_FILEHANDLE INVALID_HANDLE_VALUE
00156 typedef int UserId;
00157 typedef int uid_t;
00158 typedef DWORD ProcId;
00159 #else
00160 typedef int FileHandle;
00161 #define OWBI1_INVALID_FILEHANDLE -1
00162 typedef uid_t UserId;
00163 typedef pid_t ProcId;
00164 #endif
00165
00166 }
00167
00168 #endif