ScummVM API documentation
sdl-sys.h
1
/* ScummVM - Graphic Adventure Engine
2
*
3
* ScummVM is the legal property of its developers, whose names
4
* are too numerous to list here. Please refer to the COPYRIGHT
5
* file distributed with this source distribution.
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*
20
*/
21
22
#ifndef BACKEND_SDL_SYS_H
23
#define BACKEND_SDL_SYS_H
24
25
// The purpose of this header is to include the SDL headers in a uniform
26
// fashion.
27
// Moreover, it contains a workaround for the fact that SDL_rwops.h uses
28
// a FILE pointer in one place, which conflicts with common/forbidden.h.
29
// The SDL 1.3 headers also include strings.h
30
31
#include "common/scummsys.h"
32
33
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_FILE)
34
#undef FILE
35
#endif
36
37
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strcasecmp)
38
#undef strcasecmp
39
#define strcasecmp FAKE_strcasecmp
40
#endif
41
42
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strncasecmp)
43
#undef strncasecmp
44
#define strncasecmp FAKE_strncasecmp
45
#endif
46
47
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_exit)
48
#undef exit
49
#define exit FAKE_exit
50
#endif
51
52
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_abort)
53
#undef abort
54
#define abort FAKE_abort
55
#endif
56
57
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_system)
58
#undef system
59
#define system FAKE_system
60
#endif
61
62
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_mkdir)
63
#undef mkdir
64
#define mkdir FAKE_mkdir
65
#endif
66
67
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strcpy)
68
#undef strcpy
69
#define strcpy FAKE_strcpy
70
#endif
71
72
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strcat)
73
#undef strcat
74
#define strcat FAKE_strcat
75
#endif
76
77
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_vsprintf)
78
#undef vsprintf
79
#define vsprintf FAKE_vsprintf
80
#endif
81
82
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_sprintf)
83
#undef sprintf
84
#define sprintf FAKE_sprintf
85
#endif
86
87
// Fix compilation with MacPorts SDL 2
88
// It needs various (usually forbidden) symbols from time.h
89
#ifndef FORBIDDEN_SYMBOL_EXCEPTION_time_h
90
91
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_asctime)
92
#undef asctime
93
#define asctime FAKE_asctime
94
#endif
95
96
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_clock)
97
#undef clock
98
#define clock FAKE_clock
99
#endif
100
101
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_ctime)
102
#undef ctime
103
#define ctime FAKE_ctime
104
#endif
105
106
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_difftime)
107
#undef difftime
108
#define difftime FAKE_difftime
109
#endif
110
111
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_getdate)
112
#undef getdate
113
#define getdate FAKE_getdate
114
#endif
115
116
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_gmtime)
117
#undef gmtime
118
#define gmtime FAKE_gmtime
119
#endif
120
121
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_localtime)
122
#undef localtime
123
#define localtime FAKE_localtime
124
#endif
125
126
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_mktime)
127
#undef mktime
128
#define mktime FAKE_mktime
129
#endif
130
131
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_time)
132
#undef time
133
#define time FAKE_time
134
#endif
135
136
#endif // FORBIDDEN_SYMBOL_EXCEPTION_time_h
137
138
// Fix compilation on non-x86 architectures
139
// It needs various (usually forbidden) symbols from unistd.h
140
#ifndef FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
141
142
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_chdir)
143
#undef chdir
144
#define chdir FAKE_chdir
145
#endif
146
147
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_getcwd)
148
#undef getcwd
149
#define getcwd FAKE_getcwd
150
#endif
151
152
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_getwd)
153
#undef getwd
154
#define getwd FAKE_getwd
155
#endif
156
157
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_unlink)
158
#undef unlink
159
#define unlink FAKE_unlink
160
#endif
161
162
#endif // FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
163
164
// HACK: SDL might include windows.h which defines its own ARRAYSIZE.
165
// However, we want to use the version from common/util.h. Thus, we make sure
166
// that we actually have this definition after including the SDL headers.
167
#if defined(ARRAYSIZE) && defined(COMMON_UTIL_H)
168
#define HACK_REDEFINE_ARRAYSIZE
169
#undef ARRAYSIZE
170
#endif
171
172
// HACK to fix compilation with SDL 2.0 in MSVC.
173
// In SDL 2.0, intrin.h is now included in SDL_cpuinfo.h, which includes
174
// setjmp.h. SDL_cpuinfo.h is included from SDL.h and SDL_syswm.h.
175
// Thus, we remove the exceptions for setjmp and longjmp before these two
176
// includes.
177
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && defined(_MSC_VER) && defined(USE_SDL2)
178
// We unset any fake definitions of setjmp/longjmp here
179
180
#ifndef FORBIDDEN_SYMBOL_EXCEPTION_setjmp
181
#undef setjmp
182
#endif
183
184
#ifndef FORBIDDEN_SYMBOL_EXCEPTION_longjmp
185
#undef longjmp
186
#endif
187
188
#endif
189
190
#include <SDL.h>
191
192
// Ignore warnings from system headers pulled by SDL
193
#pragma warning(push)
194
#pragma warning(disable:4121) // alignment of a member was sensitive to packing
195
#include <SDL_syswm.h>
196
#pragma warning(pop)
197
198
// Restore the forbidden exceptions from the hack above
199
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && defined(_MSC_VER)
200
201
#ifndef FORBIDDEN_SYMBOL_EXCEPTION_setjmp
202
#undef setjmp
203
#define setjmp(a) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
204
#endif
205
206
#ifndef FORBIDDEN_SYMBOL_EXCEPTION_longjmp
207
#undef longjmp
208
#define longjmp(a,b) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
209
#endif
210
211
#endif
212
213
// SDL_syswm.h will include windows.h on Win32. We need to undefine its
214
// ARRAYSIZE definition because we supply our own.
215
#undef ARRAYSIZE
216
217
#ifdef HACK_REDEFINE_ARRAYSIZE
218
#undef HACK_REDEFINE_ARRAYSIZE
219
#define ARRAYSIZE(x) ((int)(sizeof(x) / sizeof(x[0])))
220
#endif
221
222
// In a moment of brilliance Xlib.h included by SDL_syswm.h #defines the
223
// following names. In a moment of mental breakdown, which occurred upon
224
// gazing at Xlib.h, LordHoto decided to undefine them to prevent havoc.
225
#ifdef Status
226
#undef Status
227
#endif
228
229
#ifdef Bool
230
#undef Bool
231
#endif
232
233
#ifdef True
234
#undef True
235
#endif
236
237
#ifdef False
238
#undef False
239
#endif
240
241
#ifdef Complex
242
#undef Complex
243
#endif
244
245
// Finally forbid FILE again (if it was forbidden to start with)
246
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_FILE)
247
#undef FILE
248
#define FILE FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
249
#endif
250
251
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strcasecmp)
252
#undef strcasecmp
253
#define strcasecmp FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
254
#endif
255
256
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strncasecmp)
257
#undef strncasecmp
258
#define strncasecmp FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
259
#endif
260
261
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_exit)
262
#undef exit
263
#define exit(a) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
264
#endif
265
266
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_abort)
267
#undef abort
268
#define abort() FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
269
#endif
270
271
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_system)
272
#undef system
273
#define system(a) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
274
#endif
275
276
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_mkdir)
277
#undef mkdir
278
#define mkdir(a,b) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
279
#endif
280
281
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strcpy)
282
#undef strcpy
283
#define strcpy(a,b) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
284
#endif
285
286
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strcat)
287
#undef strcat
288
#define strcat(a,b) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
289
#endif
290
291
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_vsprintf)
292
#undef vsprintf
293
#define vsprintf(a,b,c) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
294
#endif
295
296
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_sprintf)
297
#undef sprintf
298
#define sprintf(a,b,...) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
299
#endif
300
301
// re-forbid all those time.h symbols again (if they were forbidden)
302
#ifndef FORBIDDEN_SYMBOL_EXCEPTION_time_h
303
304
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_asctime)
305
#undef asctime
306
#define asctime(a) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
307
#endif
308
309
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_clock)
310
#undef clock
311
#define clock() FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
312
#endif
313
314
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_ctime)
315
#undef ctime
316
#define ctime(a) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
317
#endif
318
319
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_difftime)
320
#undef difftime
321
#define difftime(a,b) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
322
#endif
323
324
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_getdate)
325
#undef getdate
326
#define getdate(a) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
327
#endif
328
329
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_gmtime)
330
#undef gmtime
331
#define gmtime(a) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
332
#endif
333
334
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_localtime)
335
#undef localtime
336
#define localtime(a) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
337
#endif
338
339
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_mktime)
340
#undef mktime
341
#define mktime(a) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
342
#endif
343
344
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_time)
345
#undef time
346
#define time(a) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
347
#endif
348
349
#endif // FORBIDDEN_SYMBOL_EXCEPTION_time_h
350
351
// re-forbid all those unistd.h symbols again (if they were forbidden)
352
#ifndef FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
353
354
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_chdir)
355
#undef chdir
356
#define chdir(a) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
357
#endif
358
359
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_getcwd)
360
#undef getcwd
361
#define getcwd(a,b) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
362
#endif
363
364
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_getwd)
365
#undef getwd
366
#define getwd(a) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
367
#endif
368
369
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_unlink)
370
#undef unlink
371
#define unlink(a) FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
372
#endif
373
374
#endif // FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
375
376
#endif
backends
platform
sdl
sdl-sys.h
Generated on Tue Apr 23 2024 09:03:40 for ScummVM API documentation by
1.8.13