00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FXEXDEFS_H
00023 #define FXEXDEFS_H
00024
00025 #ifdef _MSC_VER
00026 #include <windows_config.h>
00027 #else
00028 #include <config.h>
00029 #endif
00030
00031 #include <fx.h>
00032
00033 #ifdef WIN32
00034 #include <windows.h>
00035 #endif
00036
00037
00038 #ifndef FXDEFS_H
00039 #include <fxdefs.h>
00044 using namespace FX;
00045 #endif
00046
00047
00048
00049 #if defined(WIN32) && defined(_MSC_VER)
00050 #pragma warning (disable : 4231)
00051 #endif
00052
00053
00054
00055 #ifndef CALLBACK
00056 #define CALLBACK
00057 #endif
00058
00065 namespace FXEX {
00066
00067
00068 #ifdef WIN32
00069 #ifdef FOXDLL
00070 #ifndef FOXDLL_EXPORTS
00071 #define FXEXTERN extern
00072 #endif
00073 #endif
00074 #endif
00075
00076 #ifndef FXEXTERN
00077 #define FXEXTERN
00078 #endif
00079
00080
00081
00082 #define COMPRESS_MAX 9
00083 #define COMPRESS_NORMAL 6
00084 #define COMPRESS_FAST 1
00085 #define COMPRESS_NONE 0
00086
00087
00088
00089 #ifndef WIN32
00090 # define INFINITE (-1)
00091 #endif
00092
00093
00094
00095 #ifdef WIN32
00096 #define FXNEWLINE "\r\n"
00097 #endif
00098 #ifdef MAC
00099 #define FXNEWLINE "\r"
00100 #endif
00101 #ifndef FXNEWLINE
00102 #define FXNEWLINE "\n"
00103 #endif
00104
00105
00106
00107 #define MKUSHORT(l,h) ((((FX::FXuchar)(l))&0xff) | (((FX::FXuchar)(h))<<8))
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00124 #define FXDeclare(Class) \
00125 FXDECLARE(Class)
00126 #define FXDeclareAbstract(Class) \
00127 FXDECLARE_ABSTRACT(Class)
00128 #define FXDefMap(Class) \
00129 FXDEFMAP(Class) Class##Map[]
00130 #define FXImplementAbstract(Class,Parent) \
00131 FXIMPLEMENT_ABSTRACT(Class,Parent,Class##Map,ARRAYNUMBER(Class##Map))
00132 #define FXImplement(Class,Parent) \
00133 FXIMPLEMENT(Class,Parent,Class##Map,ARRAYNUMBER(Class##Map))
00134 #define FXFuncDecl(Func) \
00135 long on##Func (FXObject*,FXSelector,void*)
00136 #define FXFuncImpl(Class,Func,tgt,sel,ptr) \
00137 long Class::on##Func (FXOject *tgt,FXSelector sel, void *ptr)
00138 #define FXMapTypes(Class,FromType,ToType,Func) \
00139 FXMAPTYPES(SEL_##FromType,SEL_##ToType,Class::on##Func)
00140 #define FXMapType(Class,SelType,Func) \
00141 FXMAPTYPE(SEL_##SelType,Class::on##Func)
00142 #define FXMapFuncs(Class,SelType,FromId,ToId,Func) \
00143 FXMAPFUNCS(SEL_##SelType,Class::ID_##FromId,Class::ID_##ToId,Class::on#Func)
00144 #define FXMapFunc(Class,SelType,Id,Func) \
00145 FXMAPFUNC(SEL_##SelType,Class::ID_##Id,Class::on##Func)
00146
00147
00149 #define FXSEND(tgt,sel,msg,ptr) \
00150 (tgt->handle(this,FXSEL(sel,msg),ptr)
00151 #define FXROUTE(src,tgt,sel,msg,ptr) \
00152 (tgt->handle(src,FXSEL(sel,msg),ptr)
00153
00154
00155
00156 #ifndef NDEBUG
00157 # define FXCTOR() fxtrace (100,"%s::%s %p\n",getClassName(),getClassName(),this)
00158 # define FXMETHOD(methodname) fxtrace (100,"%s::%s %p\n",getClassName(),#methodname,this)
00159 # define FXDTOR() fxtrace (100,"%s::~%s %p\n",getClassName(),getClassName(),this)
00160 #else
00161 # define FXCTOR()
00162 # define FXMETHOD(methodname)
00163 # define FXDTOR()
00164 #endif
00165
00166
00167
00168 enum {
00169 SEL_DATA=FX::SEL_LAST,
00170 SEL_THREAD,
00171 SEL_WAITABLE_WAIT,
00172 SEL_WAITABLE_ACTIVATE,
00173 SEL_INTERLOCK,
00174 SEL_BARRIER_LOCK,
00175 SEL_BARRIER_UNLOCK,
00176 SEL_INPUT,
00177 SEL_OUTPUT,
00178 SEL_ERROR,
00179 SEL_IO,
00180 SEL_IO_CONNECT,
00181 SEL_EVENT,
00182 SEL_BEGIN,
00183 SEL_END,
00184 SEL_TAG,
00185 SEL_CONTENT,
00186 SEL_REGISTRY,
00187 SEL_LASTEX,
00188 SEL_THREAD_EVENT
00189 };
00190
00191
00193 typedef FXint FXIOStatus;
00194 enum {
00195 FXIOStatusUnknown=-2,
00196 FXIOStatusError=-1,
00197 FXIOStatusOk=0,
00198 FXIOStatusOK=0,
00199 FXIOStatusLast
00200 };
00201 #ifndef INVALID_HANDLE
00202 # ifdef WIN32
00203 # define INVALID_HANDLE INVALID_HANDLE_VALUE
00204 # else
00205 # define INVALID_HANDLE -1
00206 # endif
00207 #endif
00208
00209 #ifndef VALID_RESULT
00210 # define VALID_RESULT 0
00211 #endif
00212
00213
00215 typedef FXint FXIOState;
00216 enum {
00217 FXIOStateUnknown=-1,
00218 FXIOStateNone=-1,
00219 FXIOStateOk=0,
00220 FXIOStateOK=0,
00221 FXIOStateUnconnected,
00222 FXIOStateConnected,
00223 FXIOStateOpen=FXIOStateConnected,
00224 FXIOStateListener,
00225 FXIOStateAccepted,
00226 FXIOStateDuplicated,
00227 FXIOStateLast
00228 };
00229
00230
00234
00235 enum FXSocketType {
00236 FXSocketTypeNone=0,
00237 FXSocketTypeStream,
00238 FXSocketTypeTCP=FXSocketTypeStream,
00239 FXSocketTypeDatagram,
00240 FXSocketTypeUDP=FXSocketTypeDatagram
00241 };
00242
00244 enum FXSocketFamily {
00245 FXSocketFamilyNone=0,
00246 FXSocketFamilyLocal,
00247 FXSocketFamilyInet,
00248 FXSocketFamilyInet6,
00249 FXSocketFamilyAutomatic,
00250
00251 FXSocketFamilyUnix=FXSocketFamilyLocal
00252 };
00253
00254
00274 enum FXFilePermission {
00275 FILEPERM_NONE = 0,
00276 FILEPERM_USER_READ = 0x00000001,
00277 FILEPERM_USER_WRITE = 0x00000002,
00278 FILEPERM_USER_EXEC = 0X00000004,
00279 FILEPERM_GROUP_READ = 0x00000010,
00280 FILEPERM_GROUP_WRITE = 0x00000020,
00281 FILEPERM_GROUP_EXEC = 0x00000040,
00282 FILEPERM_OTHER_READ = 0x00000100,
00283 FILEPERM_OTHER_WRITE = 0x00000200,
00284 FILEPERM_OTHER_EXEC = 0x00000400,
00285 FILEPERM_READ = 0x00000111,
00286 FILEPERM_WRITE = 0x00000222,
00287 FILEPERM_EXEC = 0x00000444,
00288 FILEPERM_ALL = 0x00000777,
00289 FILEPERM_SET_UID = 0x00001000,
00290 FILEPERM_SET_GID = 0x00002000,
00291 FILEPERM_STICKY = 0x00004000,
00292 FILEPERM_SECURE_IO = FILEPERM_USER_READ|FILEPERM_USER_WRITE,
00293 FILEPERM_DEFAULT_IO = FILEPERM_READ|FILEPERM_USER_WRITE|FILEPERM_GROUP_WRITE,
00294 FILEPERM_DEFAULT_EXEC = FILEPERM_READ|FILEPERM_USER_WRITE|FILEPERM_GROUP_WRITE|FILEPERM_EXEC
00295 };
00296
00297
00298
00299 #ifndef WIN32
00300 typedef void* FXThreadHandle;
00301 typedef void* FXThreadMutex;
00302 typedef void* FXThreadCondition;
00303 typedef void* FXThreadSemaphore;
00304 typedef FXInputHandle* FXThreadEventHandle;
00305 #else
00306 #include <windows.h>
00307 typedef HANDLE FXThreadHandle;
00308 typedef HANDLE FXThreadMutex;
00309 typedef HANDLE FXThreadCondition;
00310 typedef HANDLE FXThreadSemaphore;
00311 typedef FXInputHandle FXThreadEventHandle;
00312 #endif
00313
00314
00315
00316 #ifndef WIN32
00317 typedef void* FXDLLHandle;
00318 #else
00319 typedef HMODULE FXDLLHandle;
00320 #endif
00321
00322
00323
00324
00325
00326
00327 namespace FXUtils {
00328
00330
00332 extern FXAPI const FXuchar fxexversion[3];
00333
00334
00336
00338 #ifdef WIN32
00339 static void get_time_now(unsigned long* abs_sec, unsigned long* abs_nsec);
00340 static DWORD get_timeout(unsigned long secs, unsigned long nsecs,DWORD default_to);
00341 #else
00342 void convert_timeval(struct timeval *tv,FXuint ms);
00343 void convert_timespec(struct timespec *ts,FXuint ms);
00344 #endif
00345
00346 }
00347 }
00348
00349 #endif // FXEXDEFS_H
00350