Eclipse SUMO - Simulation of Urban MObility
fxexdefs.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2004-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
20 //
21 /****************************************************************************/
22 
23 #ifndef FXEXDEFS_H
24 #define FXEXDEFS_H
25 
26 #include <config.h>
27 
28 #include "fxheader.h"
29 
30 #ifdef WIN32
31 #define NOMINMAX
32 #include <windows.h>
33 #undef NOMINMAX
34 #endif
35 
36 // loads the FOX defs
37 #ifndef FXDEFS_H
38 #include <fxdefs.h>
43 using namespace FX;
44 #endif
45 
46 // implement CALLBACK for unix
47 #ifndef CALLBACK
48 #define CALLBACK
49 #endif
50 
57 namespace FXEX {
58 
59 // provide an extern mechanism
60 #ifdef WIN32
61 #ifdef FOXDLL
62 #ifndef FOXDLL_EXPORTS
63 #define FXEXTERN extern
64 #endif
65 #endif
66 #endif
67 
68 #ifndef FXEXTERN
69 #define FXEXTERN
70 #endif
71 
72 // Valid compression factors for Bzip and Gzip compression libraries
73 #define COMPRESS_MAX 9
74 #define COMPRESS_NORMAL 6
75 #define COMPRESS_FAST 1
76 #define COMPRESS_NONE 0
77 
78 // Win32 defines INFINITE to be -1, we might as well do it too.
79 #ifndef WIN32
80 # define INFINITE (-1)
81 #endif
82 
83 // determine the newline charater(s)
84 #ifdef WIN32
85 #define FXNEWLINE "\r\n"
86 #endif
87 #ifdef MAC
88 #define FXNEWLINE "\r"
89 #endif
90 #ifndef FXNEWLINE
91 #define FXNEWLINE "\n"
92 #endif
93 
94 // make a short from two chars
95 #define MKUSHORT(l,h) ((((FX::FXuchar)(l))&0xff) | (((FX::FXuchar)(h))<<8))
96 
97 /* !!!!
98 // Make a long from two ints - provided longs are twice the size of an int
99 #ifdef FX_LONG
100 # define MKULONG(l,h) ((((FX::FXuint)(l))&0xffffffff) | (((FX::FXuint)(h))<<32))
101 #else
102 # if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
103 # error "You wanted 64bit file sizes (actually 63), but I couldn't make it so..."
104 # endif
105 #endif
106 !!!! */
107 
112 #define FXDeclare(Class) \
113  FXDECLARE(Class)
114 #define FXDeclareAbstract(Class) \
115  FXDECLARE_ABSTRACT(Class)
116 #define FXDefMap(Class) \
117  FXDEFMAP(Class) Class##Map[]
118 #define FXImplementAbstract(Class,Parent) \
119  FXIMPLEMENT_ABSTRACT(Class,Parent,Class##Map,ARRAYNUMBER(Class##Map))
120 #define FXImplement(Class,Parent) \
121  FXIMPLEMENT(Class,Parent,Class##Map,ARRAYNUMBER(Class##Map))
122 #define FXFuncDecl(Func) \
123  long on##Func (FXObject*,FXSelector,void*)
124 #define FXFuncImpl(Class,Func,tgt,sel,ptr) \
125  long Class::on##Func (FXOject *tgt,FXSelector sel, void *ptr)
126 #define FXMapTypes(Class,FromType,ToType,Func) \
127  FXMAPTYPES(SEL_##FromType,SEL_##ToType,Class::on##Func)
128 #define FXMapType(Class,SelType,Func) \
129  FXMAPTYPE(SEL_##SelType,Class::on##Func)
130 #define FXMapFuncs(Class,SelType,FromId,ToId,Func) \
131  FXMAPFUNCS(SEL_##SelType,Class::ID_##FromId,Class::ID_##ToId,Class::on#Func)
132 #define FXMapFunc(Class,SelType,Id,Func) \
133  FXMAPFUNC(SEL_##SelType,Class::ID_##Id,Class::on##Func)
134 
136 #define FXSEND(tgt,sel,msg,ptr) \
137  (tgt->handle(this,FXSEL(sel,msg),ptr)
138 #define FXROUTE(src,tgt,sel,msg,ptr) \
139  (tgt->handle(src,FXSEL(sel,msg),ptr)
140 
141 // debugging macros
142 #ifndef NDEBUG
143 # define FXCTOR() fxtrace (100,"%s::%s %p\n",getClassName(),getClassName(),this)
144 # define FXMETHOD(methodname) fxtrace (100,"%s::%s %p\n",getClassName(),#methodname,this)
145 # define FXDTOR() fxtrace (100,"%s::~%s %p\n",getClassName(),getClassName(),this)
146 #else
147 # define FXCTOR()
148 # define FXMETHOD(methodname)
149 # define FXDTOR()
150 #endif
151 
152 // New selector types
153 enum {
154  SEL_DATA = FX::SEL_LAST, // form of data as an event
155  SEL_THREAD, // thread/runnable events
156  SEL_WAITABLE_WAIT, // waitable event such as a Condition variable, semaphore, etc
157  SEL_WAITABLE_ACTIVATE, // waitable event such as a Condition variable, semaphore, etc
158  SEL_INTERLOCK, // interlocked event; object went into lock
159  SEL_BARRIER_LOCK, // barrier event; thread waiting in barrier lock
160  SEL_BARRIER_UNLOCK, // barrier event; barrier object reset, threads released
161  SEL_INPUT, // some type of input event
162  SEL_OUTPUT, // some type of output event
163  SEL_ERROR, // some type of error event
164  SEL_IO, // Some form of IO
165  SEL_IO_CONNECT, // Connection event
166  SEL_EVENT, // a generic event
167  SEL_BEGIN, // en event defining some begining
168  SEL_END, // an event defining some ending
169  SEL_TAG, // tag event
170  SEL_CONTENT, // content event
171  SEL_REGISTRY, // a registry event (TODO I have a plan for this...)
172  SEL_LASTEX,// Last message
174 };
175 
177 typedef FXint FXIOStatus;
178 enum {
184 };
185 #ifndef INVALID_HANDLE
186 #ifdef WIN32
187 #define INVALID_HANDLE INVALID_HANDLE_VALUE
188 #else
189 #define INVALID_HANDLE -1
190 #endif
191 #endif
192 
193 #ifndef VALID_RESULT
194 #define VALID_RESULT 0
195 #endif
196 
198 typedef FXint FXIOState;
199 enum {
211 };
212 
218  FXSocketTypeNone = 0, // unknown socket type
219  FXSocketTypeStream, // TCP socket
221  FXSocketTypeDatagram, // UDP socket
222  FXSocketTypeUDP = FXSocketTypeDatagram // UDP socket
223 };
224 
227  FXSocketFamilyNone = 0, // unknown socket family
228  FXSocketFamilyLocal, // Local domain socket (on nearly every system, same as Unix domain)
229  FXSocketFamilyInet, // Internet domain socket, version 4 (ie the default internet family)
230  FXSocketFamilyInet6, // Internet domain socket, version 6
231  FXSocketFamilyAutomatic, // automatically choose UNIX domain (local) socket, when connecting
232  // to localhost, internet domain for internet sockets
234 };
235 
256  FILEPERM_NONE = 0, // file has no permissions
257  FILEPERM_USER_READ = 0x00000001, // user can read from file
258  FILEPERM_USER_WRITE = 0x00000002, // user can write to file
259  FILEPERM_USER_EXEC = 0X00000004, // user can execute file
260  FILEPERM_GROUP_READ = 0x00000010, // group can read from file
261  FILEPERM_GROUP_WRITE = 0x00000020, // group can write to file
262  FILEPERM_GROUP_EXEC = 0x00000040, // group can execute the file
263  FILEPERM_OTHER_READ = 0x00000100, // everybody can read from file
264  FILEPERM_OTHER_WRITE = 0x00000200, // everybody can write to file
265  FILEPERM_OTHER_EXEC = 0x00000400, // everybody can execute the file
266  FILEPERM_READ = 0x00000111, // file read mask; set all read permissions
267  FILEPERM_WRITE = 0x00000222, // file write mask; set all write permissions
268  FILEPERM_EXEC = 0x00000444, // file execute mask; set all execute permissions
269  FILEPERM_ALL = 0x00000777, // permissions mask; set all permissions
270  FILEPERM_SET_UID = 0x00001000, // set the UID permission
271  FILEPERM_SET_GID = 0x00002000, // set the GID permisssion
272  FILEPERM_STICKY = 0x00004000, // set the STICKY permission
273  FILEPERM_SECURE_IO = FILEPERM_USER_READ | FILEPERM_USER_WRITE, // permissions suitable for single user IO access
274  FILEPERM_DEFAULT_IO = FILEPERM_READ | FILEPERM_USER_WRITE | FILEPERM_GROUP_WRITE, // permissions suitable for group IO access
275  FILEPERM_DEFAULT_EXEC = FILEPERM_READ | FILEPERM_USER_WRITE | FILEPERM_GROUP_WRITE | FILEPERM_EXEC // permissions suitable for all users to execute a file
276 };
277 
278 // thread stuff
279 #ifndef WIN32
280 typedef void* FXThreadHandle; // handle to a thread
281 typedef void* FXThreadMutex; // handle to a mutex
282 typedef void* FXThreadCondition; // handle to a condition variable
283 typedef void* FXThreadSemaphore; // handle to a semaphore
284 typedef FXInputHandle* MFXThreadEventHandle; // handle to a thread event object
285 #else
286 typedef HANDLE FXThreadHandle; // handle to a thread
287 typedef HANDLE FXThreadMutex; // handle to a mutex
288 typedef HANDLE FXThreadCondition; // handle to a condition variable
289 typedef HANDLE FXThreadSemaphore; // handle to a semaphore
290 typedef FXInputHandle MFXThreadEventHandle; // handle to a thread event object
291 #endif
292 
293 // dynamic library loading
294 #ifndef WIN32
295 typedef void* FXDLLHandle; // handle to a dynamically loaded file
296 #else
297 typedef HMODULE FXDLLHandle; // handle to a dynamically loaded file
298 #endif
299 
300 namespace FXUtils {
302 extern FXAPI const FXuchar fxexversion[3];
303 }
304 } // namespace FXEX
305 
306 #endif // FXEXDEFS_H
FXAPI const FXuchar fxexversion[3]
Version number that the library version is compiled with.
Definition: fxexdefs.h:57
void * FXDLLHandle
Definition: fxexdefs.h:295
FXint FXIOStatus
IO status definitions.
Definition: fxexdefs.h:177
@ FXIOStateOK
Definition: fxexdefs.h:203
@ FXIOStateAccepted
Definition: fxexdefs.h:208
@ FXIOStateNone
Definition: fxexdefs.h:201
@ FXIOStateOk
Definition: fxexdefs.h:202
@ FXIOStateConnected
Definition: fxexdefs.h:205
@ FXIOStateDuplicated
Definition: fxexdefs.h:209
@ FXIOStateListener
Definition: fxexdefs.h:207
@ FXIOStateLast
Definition: fxexdefs.h:210
@ FXIOStateUnconnected
Definition: fxexdefs.h:204
@ FXIOStateUnknown
Definition: fxexdefs.h:200
@ FXIOStateOpen
Definition: fxexdefs.h:206
@ SEL_REGISTRY
Definition: fxexdefs.h:171
@ SEL_CONTENT
Definition: fxexdefs.h:170
@ SEL_BARRIER_LOCK
Definition: fxexdefs.h:159
@ SEL_OUTPUT
Definition: fxexdefs.h:162
@ SEL_END
Definition: fxexdefs.h:168
@ SEL_EVENT
Definition: fxexdefs.h:166
@ SEL_WAITABLE_ACTIVATE
Definition: fxexdefs.h:157
@ SEL_INTERLOCK
Definition: fxexdefs.h:158
@ SEL_INPUT
Definition: fxexdefs.h:161
@ SEL_BEGIN
Definition: fxexdefs.h:167
@ SEL_WAITABLE_WAIT
Definition: fxexdefs.h:156
@ SEL_LASTEX
Definition: fxexdefs.h:172
@ SEL_IO_CONNECT
Definition: fxexdefs.h:165
@ SEL_THREAD_EVENT
Definition: fxexdefs.h:173
@ SEL_DATA
Definition: fxexdefs.h:154
@ SEL_IO
Definition: fxexdefs.h:164
@ SEL_BARRIER_UNLOCK
Definition: fxexdefs.h:160
@ SEL_TAG
Definition: fxexdefs.h:169
@ SEL_ERROR
Definition: fxexdefs.h:163
@ SEL_THREAD
Definition: fxexdefs.h:155
void * FXThreadHandle
Definition: fxexdefs.h:280
void * FXThreadMutex
Definition: fxexdefs.h:281
FXInputHandle * MFXThreadEventHandle
Definition: fxexdefs.h:284
FXint FXIOState
IO state definitions.
Definition: fxexdefs.h:198
void * FXThreadSemaphore
Definition: fxexdefs.h:283
FXSocketType
Socket types.
Definition: fxexdefs.h:217
@ FXSocketTypeTCP
Definition: fxexdefs.h:220
@ FXSocketTypeUDP
Definition: fxexdefs.h:222
@ FXSocketTypeDatagram
Definition: fxexdefs.h:221
@ FXSocketTypeStream
Definition: fxexdefs.h:219
@ FXSocketTypeNone
Definition: fxexdefs.h:218
void * FXThreadCondition
Definition: fxexdefs.h:282
FXSocketFamily
Socket families.
Definition: fxexdefs.h:226
@ FXSocketFamilyNone
Definition: fxexdefs.h:227
@ FXSocketFamilyUnix
Definition: fxexdefs.h:233
@ FXSocketFamilyAutomatic
Definition: fxexdefs.h:231
@ FXSocketFamilyInet6
Definition: fxexdefs.h:230
@ FXSocketFamilyLocal
Definition: fxexdefs.h:228
@ FXSocketFamilyInet
Definition: fxexdefs.h:229
@ FXIOStatusOk
Definition: fxexdefs.h:181
@ FXIOStatusUnknown
Definition: fxexdefs.h:179
@ FXIOStatusLast
Definition: fxexdefs.h:183
@ FXIOStatusError
Definition: fxexdefs.h:180
@ FXIOStatusOK
Definition: fxexdefs.h:182
FXFilePermission
Definition: fxexdefs.h:255
@ FILEPERM_GROUP_READ
Definition: fxexdefs.h:260
@ FILEPERM_NONE
Definition: fxexdefs.h:256
@ FILEPERM_OTHER_WRITE
Definition: fxexdefs.h:264
@ FILEPERM_READ
Definition: fxexdefs.h:266
@ FILEPERM_USER_READ
Definition: fxexdefs.h:257
@ FILEPERM_OTHER_EXEC
Definition: fxexdefs.h:265
@ FILEPERM_GROUP_EXEC
Definition: fxexdefs.h:262
@ FILEPERM_USER_WRITE
Definition: fxexdefs.h:258
@ FILEPERM_STICKY
Definition: fxexdefs.h:272
@ FILEPERM_ALL
Definition: fxexdefs.h:269
@ FILEPERM_EXEC
Definition: fxexdefs.h:268
@ FILEPERM_OTHER_READ
Definition: fxexdefs.h:263
@ FILEPERM_WRITE
Definition: fxexdefs.h:267
@ FILEPERM_DEFAULT_IO
Definition: fxexdefs.h:274
@ FILEPERM_SECURE_IO
Definition: fxexdefs.h:273
@ FILEPERM_SET_GID
Definition: fxexdefs.h:271
@ FILEPERM_SET_UID
Definition: fxexdefs.h:270
@ FILEPERM_DEFAULT_EXEC
Definition: fxexdefs.h:275
@ FILEPERM_GROUP_WRITE
Definition: fxexdefs.h:261
@ FILEPERM_USER_EXEC
Definition: fxexdefs.h:259
Definition: GUI.h:31