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