1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22#ifndef _SDL_CONFIG_H
23#define _SDL_CONFIG_H
24
25#ifndef _SDL_platform_h
26#define _SDL_platform_h
27
28#if defined(_AIX)
29#undef __AIX__
30#define __AIX__ 1
31#endif
32#if defined(__HAIKU__)
33#undef __HAIKU__
34#define __HAIKU__ 1
35#endif
36#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
37#undef __BSDI__
38#define __BSDI__ 1
39#endif
40#if defined(_arch_dreamcast)
41#undef __DREAMCAST__
42#define __DREAMCAST__ 1
43#endif
44#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
45#undef __FREEBSD__
46#define __FREEBSD__ 1
47#endif
48#if defined(hpux) || defined(__hpux) || defined(__hpux__)
49#undef __HPUX__
50#define __HPUX__ 1
51#endif
52#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
53#undef __IRIX__
54#define __IRIX__ 1
55#endif
56#if defined(linux) || defined(__linux) || defined(__linux__)
57#undef __LINUX__
58#define __LINUX__ 1
59#endif
60#if defined(ANDROID) || defined(__ANDROID__)
61#undef __ANDROID__
62#undef __LINUX__
63#define __ANDROID__ 1
64#endif
65
66#if defined(__APPLE__)
67
68#include "AvailabilityMacros.h"
69#include "TargetConditionals.h"
70#if TARGET_OS_IPHONE
71
72#undef __IPHONEOS__
73#define __IPHONEOS__ 1
74#undef __MACOSX__
75#else
76
77#undef __MACOSX__
78#define __MACOSX__ 1
79#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
80# error SDL for Mac OS X only supports deploying on 10.5 and above.
81#endif
82#endif
83#endif
84
85#if defined(__NetBSD__)
86#undef __NETBSD__
87#define __NETBSD__ 1
88#endif
89#if defined(__OpenBSD__)
90#undef __OPENBSD__
91#define __OPENBSD__ 1
92#endif
93#if defined(__OS2__)
94#undef __OS2__
95#define __OS2__ 1
96#endif
97#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
98#undef __OSF__
99#define __OSF__ 1
100#endif
101#if defined(__QNXNTO__)
102#undef __QNXNTO__
103#define __QNXNTO__ 1
104#endif
105#if defined(riscos) || defined(__riscos) || defined(__riscos__)
106#undef __RISCOS__
107#define __RISCOS__ 1
108#endif
109#if defined(__SVR4)
110#undef __SOLARIS__
111#define __SOLARIS__ 1
112#endif
113
114#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
115
116#if defined(__MINGW32__) || (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_)
117#include <winapifamily.h>
118#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
119#undef __WINDOWS__
120#define __WINDOWS__ 1
121
122#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
123#undef __WINRT__
124#define __WINRT__ 1
125#endif
126#else
127#undef __WINDOWS__
128#define __WINDOWS__ 1
129#endif
130#endif
131
132#if defined(__WINDOWS__)
133#undef __WIN32__
134#define __WIN32__ 1
135#endif
136#if defined(__PSP__)
137#undef __PSP__
138#define __PSP__ 1
139#endif
140
141#ifdef _begin_code_h
142#error Nested inclusion of begin_code.h
143#endif
144#define _begin_code_h
145
146#ifndef SDL_DEPRECATED
147# if (__GNUC__ >= 4)
148# define SDL_DEPRECATED __attribute__((deprecated))
149# else
150# define SDL_DEPRECATED
151# endif
152#endif
153
154#ifndef DECLSPEC
155# if defined(__WIN32__) || defined(__WINRT__)
156# ifdef __BORLANDC__
157# ifdef BUILD_SDL
158# define DECLSPEC
159# else
160# define DECLSPEC __declspec(dllimport)
161# endif
162# else
163# define DECLSPEC __declspec(dllexport)
164# endif
165# else
166# if defined(__GNUC__) && __GNUC__ >= 4
167# define DECLSPEC __attribute__ ((visibility("default")))
168# elif defined(__GNUC__) && __GNUC__ >= 2
169# define DECLSPEC __declspec(dllexport)
170# else
171# define DECLSPEC
172# endif
173# endif
174#endif
175
176#ifndef SDLCALL
177#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
178#define SDLCALL __cdecl
179#else
180#define SDLCALL
181#endif
182#endif
183
184#ifdef __SYMBIAN32__
185#undef DECLSPEC
186#define DECLSPEC
187#endif
188
189#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
190#ifdef _MSC_VER
191#pragma warning(disable: 4103)
192#endif
193#ifdef __BORLANDC__
194#pragma nopackwarning
195#endif
196#ifdef _M_X64
197
198#pragma pack(push,8)
199#else
200#pragma pack(push,4)
201#endif
202#endif
203
204#ifndef SDL_INLINE
205#if defined(__GNUC__)
206#define SDL_INLINE __inline__
207#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
208 defined(__DMC__) || defined(__SC__) || \
209 defined(__WATCOMC__) || defined(__LCC__) || \
210 defined(__DECC)
211#define SDL_INLINE __inline
212#ifndef __inline__
213#define __inline__ __inline
214#endif
215#else
216#define SDL_INLINE inline
217#ifndef __inline__
218#define __inline__ inline
219#endif
220#endif
221#endif
222
223#ifndef SDL_FORCE_INLINE
224#if defined(_MSC_VER)
225#define SDL_FORCE_INLINE __forceinline
226#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
227#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
228#else
229#define SDL_FORCE_INLINE static SDL_INLINE
230#endif
231#endif
232
233#if !defined(__MACH__)
234#ifndef NULL
235#ifdef __cplusplus
236#define NULL 0
237#else
238#define NULL ((void *)0)
239#endif
240#endif
241#endif
242
243#ifdef __cplusplus
244extern "C" {
245#endif
246
247extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void);
248
249#ifdef __cplusplus
250}
251#endif
252
253#undef _begin_code_h
254
255#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
256#ifdef __BORLANDC__
257#pragma nopackwarning
258#endif
259#pragma pack(pop)
260#endif
261
262#endif
263
264#if defined(__WIN32__)
265#define HAVE_LIBC
266
267#ifndef _SDL_config_windows_h
268#define _SDL_config_windows_h
269
270#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
271#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__)
272#define HAVE_STDINT_H 1
273#elif defined(_MSC_VER)
274typedef signed __int8 int8_t;
275typedef unsigned __int8 uint8_t;
276typedef signed __int16 int16_t;
277typedef unsigned __int16 uint16_t;
278typedef signed __int32 int32_t;
279typedef unsigned __int32 uint32_t;
280typedef signed __int64 int64_t;
281typedef unsigned __int64 uint64_t;
282#ifndef _UINTPTR_T_DEFINED
283#ifdef _WIN64
284typedef unsigned __int64 uintptr_t;
285#else
286typedef unsigned int uintptr_t;
287#endif
288#define _UINTPTR_T_DEFINED
289#endif
290
291#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
292#define DWORD_PTR DWORD
293#endif
294#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
295#define LONG_PTR LONG
296#endif
297#else
298typedef signed char int8_t;
299typedef unsigned char uint8_t;
300typedef signed short int16_t;
301typedef unsigned short uint16_t;
302typedef signed int int32_t;
303typedef unsigned int uint32_t;
304typedef signed long long int64_t;
305typedef unsigned long long uint64_t;
306#ifndef _SIZE_T_DEFINED_
307#define _SIZE_T_DEFINED_
308typedef unsigned int size_t;
309#endif
310typedef unsigned int uintptr_t;
311#endif
312#endif
313
314#ifdef _WIN64
315# define SIZEOF_VOIDP 8
316#else
317# define SIZEOF_VOIDP 4
318#endif
319
320#ifdef HAVE_LIBC
321
322#define HAVE_STDIO_H 1
323#define STDC_HEADERS 1
324#define HAVE_STRING_H 1
325#define HAVE_CTYPE_H 1
326#define HAVE_MATH_H 1
327#define HAVE_SIGNAL_H 1
328
329#define HAVE_MALLOC 1
330#define HAVE_CALLOC 1
331#define HAVE_REALLOC 1
332#define HAVE_FREE 1
333#define HAVE_ALLOCA 1
334#define HAVE_QSORT 1
335#define HAVE_ABS 1
336#define HAVE_MEMSET 1
337#define HAVE_MEMCPY 1
338#define HAVE_MEMMOVE 1
339#define HAVE_MEMCMP 1
340#define HAVE_STRLEN 1
341#define HAVE__STRREV 1
342#define HAVE__STRUPR 1
343#define HAVE__STRLWR 1
344#define HAVE_STRCHR 1
345#define HAVE_STRRCHR 1
346#define HAVE_STRSTR 1
347#define HAVE__LTOA 1
348#define HAVE__ULTOA 1
349#define HAVE_STRTOL 1
350#define HAVE_STRTOUL 1
351#define HAVE_STRTOD 1
352#define HAVE_ATOI 1
353#define HAVE_ATOF 1
354#define HAVE_STRCMP 1
355#define HAVE_STRNCMP 1
356#define HAVE__STRICMP 1
357#define HAVE__STRNICMP 1
358#define HAVE_ATAN 1
359#define HAVE_ATAN2 1
360#define HAVE_ACOS 1
361#define HAVE_ASIN 1
362#define HAVE_CEIL 1
363#define HAVE_COS 1
364#define HAVE_COSF 1
365#define HAVE_FABS 1
366#define HAVE_FLOOR 1
367#define HAVE_LOG 1
368#define HAVE_POW 1
369#define HAVE_SIN 1
370#define HAVE_SINF 1
371#define HAVE_SQRT 1
372#if _MSC_VER >= 1800
373#define HAVE_STRTOLL 1
374#define HAVE_VSSCANF 1
375#define HAVE_COPYSIGN 1
376#define HAVE_SCALBN 1
377#endif
378#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
379#define HAVE_M_PI 1
380#endif
381#else
382#define HAVE_STDARG_H 1
383#define HAVE_STDDEF_H 1
384#endif
385
386#define SDL_AUDIO_DRIVER_DSOUND 1
387#define SDL_AUDIO_DRIVER_XAUDIO2 1
388#define SDL_AUDIO_DRIVER_WINMM 1
389#define SDL_AUDIO_DRIVER_DISK 1
390#define SDL_AUDIO_DRIVER_DUMMY 1
391
392#define SDL_JOYSTICK_DINPUT 1
393#define SDL_HAPTIC_DINPUT 1
394
395#define SDL_LOADSO_WINDOWS 1
396
397#define SDL_THREAD_WINDOWS 1
398
399#define SDL_TIMER_WINDOWS 1
400
401#define SDL_VIDEO_DRIVER_DUMMY 1
402#define SDL_VIDEO_DRIVER_WINDOWS 1
403
404#ifndef SDL_VIDEO_RENDER_D3D
405#define SDL_VIDEO_RENDER_D3D 1
406#endif
407#ifndef SDL_VIDEO_RENDER_D3D11
408#define SDL_VIDEO_RENDER_D3D11 0
409#endif
410
411#ifndef SDL_VIDEO_OPENGL
412#define SDL_VIDEO_OPENGL 1
413#endif
414#ifndef SDL_VIDEO_OPENGL_WGL
415#define SDL_VIDEO_OPENGL_WGL 1
416#endif
417#ifndef SDL_VIDEO_RENDER_OGL
418#define SDL_VIDEO_RENDER_OGL 1
419#endif
420#ifndef SDL_VIDEO_RENDER_OGL_ES2
421#define SDL_VIDEO_RENDER_OGL_ES2 1
422#endif
423#ifndef SDL_VIDEO_OPENGL_ES2
424#define SDL_VIDEO_OPENGL_ES2 1
425#endif
426#ifndef SDL_VIDEO_OPENGL_EGL
427#define SDL_VIDEO_OPENGL_EGL 1
428#endif
429
430#define SDL_POWER_WINDOWS 1
431
432#define SDL_FILESYSTEM_WINDOWS 1
433
434#ifndef _WIN64
435#define SDL_ASSEMBLY_ROUTINES 1
436#endif
437
438#endif
439
440#elif defined(__MACOSX__)
441
442#ifndef _SDL_config_macosx_h
443#define _SDL_config_macosx_h
444
445#include <AvailabilityMacros.h>
446
447#ifdef __LP64__
448 #define SIZEOF_VOIDP 8
449#else
450 #define SIZEOF_VOIDP 4
451#endif
452
453#define HAVE_ALLOCA_H 1
454#define HAVE_SYS_TYPES_H 1
455#define HAVE_STDIO_H 1
456#define STDC_HEADERS 1
457#define HAVE_STRING_H 1
458#define HAVE_INTTYPES_H 1
459#define HAVE_STDINT_H 1
460#define HAVE_CTYPE_H 1
461#define HAVE_MATH_H 1
462#define HAVE_SIGNAL_H 1
463
464#define HAVE_MALLOC 1
465#define HAVE_CALLOC 1
466#define HAVE_REALLOC 1
467#define HAVE_FREE 1
468#define HAVE_ALLOCA 1
469#define HAVE_GETENV 1
470#define HAVE_SETENV 1
471#define HAVE_PUTENV 1
472#define HAVE_UNSETENV 1
473#define HAVE_QSORT 1
474#define HAVE_ABS 1
475#define HAVE_BCOPY 1
476#define HAVE_MEMSET 1
477#define HAVE_MEMCPY 1
478#define HAVE_MEMMOVE 1
479#define HAVE_MEMCMP 1
480#define HAVE_STRLEN 1
481#define HAVE_STRLCPY 1
482#define HAVE_STRLCAT 1
483#define HAVE_STRDUP 1
484#define HAVE_STRCHR 1
485#define HAVE_STRRCHR 1
486#define HAVE_STRSTR 1
487#define HAVE_STRTOL 1
488#define HAVE_STRTOUL 1
489#define HAVE_STRTOLL 1
490#define HAVE_STRTOULL 1
491#define HAVE_STRTOD 1
492#define HAVE_ATOI 1
493#define HAVE_ATOF 1
494#define HAVE_STRCMP 1
495#define HAVE_STRNCMP 1
496#define HAVE_STRCASECMP 1
497#define HAVE_STRNCASECMP 1
498#define HAVE_VSSCANF 1
499#define HAVE_VSNPRINTF 1
500#define HAVE_CEIL 1
501#define HAVE_COPYSIGN 1
502#define HAVE_COS 1
503#define HAVE_COSF 1
504#define HAVE_FABS 1
505#define HAVE_FLOOR 1
506#define HAVE_LOG 1
507#define HAVE_POW 1
508#define HAVE_SCALBN 1
509#define HAVE_SIN 1
510#define HAVE_SINF 1
511#define HAVE_SQRT 1
512#define HAVE_SIGACTION 1
513#define HAVE_SETJMP 1
514#define HAVE_NANOSLEEP 1
515#define HAVE_SYSCONF 1
516#define HAVE_SYSCTLBYNAME 1
517#define HAVE_ATAN 1
518#define HAVE_ATAN2 1
519#define HAVE_ACOS 1
520#define HAVE_ASIN 1
521
522#define SDL_AUDIO_DRIVER_COREAUDIO 1
523#define SDL_AUDIO_DRIVER_DISK 1
524#define SDL_AUDIO_DRIVER_DUMMY 1
525
526#define SDL_JOYSTICK_IOKIT 1
527#define SDL_HAPTIC_IOKIT 1
528
529#define SDL_LOADSO_DLOPEN 1
530
531#define SDL_THREAD_PTHREAD 1
532#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
533
534#define SDL_TIMER_UNIX 1
535
536#define SDL_VIDEO_DRIVER_COCOA 1
537#define SDL_VIDEO_DRIVER_DUMMY 1
538#undef SDL_VIDEO_DRIVER_X11
539#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
540#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
541#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
542#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib"
543#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
544#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
545#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
546#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
547#define SDL_VIDEO_DRIVER_X11_XRANDR 1
548#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
549#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
550#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1
551#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
552
553#ifdef MAC_OS_X_VERSION_10_8
554
555#define SDL_VIDEO_DRIVER_X11_XINPUT2 1
556#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
557#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1
558#endif
559
560#ifndef SDL_VIDEO_RENDER_OGL
561#define SDL_VIDEO_RENDER_OGL 1
562#endif
563
564#ifndef SDL_VIDEO_OPENGL
565#define SDL_VIDEO_OPENGL 1
566#endif
567#ifndef SDL_VIDEO_OPENGL_CGL
568#define SDL_VIDEO_OPENGL_CGL 1
569#endif
570#ifndef SDL_VIDEO_OPENGL_GLX
571#define SDL_VIDEO_OPENGL_GLX 1
572#endif
573
574#define SDL_POWER_MACOSX 1
575
576#define SDL_FILESYSTEM_COCOA 1
577
578#define SDL_ASSEMBLY_ROUTINES 1
579#ifdef __ppc__
580#define SDL_ALTIVEC_BLITTERS 1
581#endif
582
583#endif
584
585#elif defined(__LINUX__)
586
587#ifndef _SDL_config_h
588#define _SDL_config_h
589
590#ifdef _MSC_VER
591#error You should run hg revert SDL_config.h
592#endif
593
594#ifdef __LP64__
595#define SIZEOF_VOIDP 8
596#else
597#define SIZEOF_VOIDP 4
598#endif
599#define HAVE_GCC_ATOMICS 1
600
601#define HAVE_PTHREAD_SPINLOCK 1
602
603#define HAVE_LIBC 1
604#if HAVE_LIBC
605
606#define HAVE_ALLOCA_H 1
607#define HAVE_SYS_TYPES_H 1
608#define HAVE_STDIO_H 1
609#define STDC_HEADERS 1
610#define HAVE_STDLIB_H 1
611#define HAVE_STDARG_H 1
612#define HAVE_MALLOC_H 1
613#define HAVE_MEMORY_H 1
614#define HAVE_STRING_H 1
615#define HAVE_STRINGS_H 1
616#define HAVE_INTTYPES_H 1
617#define HAVE_STDINT_H 1
618#define HAVE_CTYPE_H 1
619#define HAVE_MATH_H 1
620#define HAVE_ICONV_H 1
621#define HAVE_SIGNAL_H 1
622
623#define HAVE_MALLOC 1
624#define HAVE_CALLOC 1
625#define HAVE_REALLOC 1
626#define HAVE_FREE 1
627#define HAVE_ALLOCA 1
628#ifndef __WIN32__
629#define HAVE_GETENV 1
630#define HAVE_SETENV 1
631#define HAVE_PUTENV 1
632#define HAVE_UNSETENV 1
633#endif
634#define HAVE_QSORT 1
635#define HAVE_ABS 1
636#define HAVE_BCOPY 1
637#define HAVE_MEMSET 1
638#define HAVE_MEMCPY 1
639#define HAVE_MEMMOVE 1
640#define HAVE_MEMCMP 1
641#define HAVE_STRLEN 1
642
643#define HAVE_STRDUP 1
644
645#define HAVE_STRCHR 1
646#define HAVE_STRRCHR 1
647#define HAVE_STRSTR 1
648
649#define HAVE_STRTOL 1
650#define HAVE_STRTOUL 1
651
652#define HAVE_STRTOLL 1
653#define HAVE_STRTOULL 1
654#define HAVE_STRTOD 1
655#define HAVE_ATOI 1
656#define HAVE_ATOF 1
657#define HAVE_STRCMP 1
658#define HAVE_STRNCMP 1
659
660#define HAVE_STRCASECMP 1
661
662#define HAVE_STRNCASECMP 1
663
664#define HAVE_VSSCANF 1
665
666#define HAVE_VSNPRINTF 1
667#define HAVE_M_PI
668#define HAVE_ATAN 1
669#define HAVE_ATAN2 1
670#define HAVE_ACOS 1
671#define HAVE_ASIN 1
672#define HAVE_CEIL 1
673#define HAVE_COPYSIGN 1
674#define HAVE_COS 1
675#define HAVE_COSF 1
676#define HAVE_FABS 1
677#define HAVE_FLOOR 1
678#define HAVE_LOG 1
679#define HAVE_POW 1
680#define HAVE_SCALBN 1
681#define HAVE_SIN 1
682#define HAVE_SINF 1
683#define HAVE_SQRT 1
684#define HAVE_FSEEKO 1
685#define HAVE_FSEEKO64 1
686#define HAVE_SIGACTION 1
687#define HAVE_SA_SIGACTION 1
688#define HAVE_SETJMP 1
689#define HAVE_NANOSLEEP 1
690#define HAVE_SYSCONF 1
691
692#define HAVE_CLOCK_GETTIME 1
693
694#define HAVE_MPROTECT 1
695#define HAVE_ICONV 1
696#define HAVE_PTHREAD_SETNAME_NP 1
697
698#define HAVE_SEM_TIMEDWAIT 1
699
700#else
701#define HAVE_STDARG_H 1
702#define HAVE_STDDEF_H 1
703#define HAVE_STDINT_H 1
704#endif
705
706#define SDL_AUDIO_DRIVER_ALSA 1
707#if defined(__LP64__) || defined(_LP64) || defined(__LLP64__) || defined(__x86_64__)
708#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC "/usr/lib/x86_64-linux-gnu/libasound.so.2"
709#else
710#define SDL_AUDIO_DRIVER_ALSA_DYNAMIC "/usr/lib/i386-linux-gnu/libasound.so.2"
711#endif
712
713#define SDL_AUDIO_DRIVER_DISK 1
714#define SDL_AUDIO_DRIVER_DUMMY 1
715
716#define SDL_AUDIO_DRIVER_OSS 1
717
718#define SDL_INPUT_LINUXEV 1
719#define SDL_INPUT_LINUXKD 1
720
721#define SDL_JOYSTICK_LINUX 1
722
723#define SDL_HAPTIC_LINUX 1
724
725#define SDL_LOADSO_DLOPEN 1
726
727#define SDL_THREAD_PTHREAD 1
728#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
729
730#define SDL_TIMER_UNIX 1
731
732#define SDL_VIDEO_DRIVER_DUMMY 1
733
734#define SDL_VIDEO_DRIVER_X11 1
735
736#define SDL_VIDEO_DRIVER_X11_DYNAMIC "libX11.so.6"
737#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "libXext.so.6"
738
739#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "libXxf86vm.so.1"
740
741#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
742#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1
743#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
744#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 1
745#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1
746#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
747
748#define SDL_VIDEO_RENDER_OGL 1
749
750#define SDL_VIDEO_OPENGL 1
751
752#define SDL_VIDEO_OPENGL_GLX 1
753
754#define SDL_POWER_LINUX 1
755
756#define SDL_FILESYSTEM_UNIX 1
757
758#define SDL_ASSEMBLY_ROUTINES 1
759
760#endif
761
762#else
763
764#ifndef _SDL_config_minimal_h
765#define _SDL_config_minimal_h
766
767#define HAVE_STDARG_H 1
768#define HAVE_STDDEF_H 1
769
770#if defined(_MSC_VER) && (_MSC_VER < 1600)
771
772typedef unsigned int size_t;
773typedef signed char int8_t;
774typedef unsigned char uint8_t;
775typedef signed short int16_t;
776typedef unsigned short uint16_t;
777typedef signed int int32_t;
778typedef unsigned int uint32_t;
779typedef signed long long int64_t;
780typedef unsigned long long uint64_t;
781typedef unsigned long uintptr_t;
782#else
783#define HAVE_STDINT_H 1
784#endif
785
786#ifdef __GNUC__
787#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
788#endif
789
790#define SDL_AUDIO_DRIVER_DUMMY 1
791
792#define SDL_JOYSTICK_DISABLED 1
793
794#define SDL_HAPTIC_DISABLED 1
795
796#define SDL_LOADSO_DISABLED 1
797
798#define SDL_THREADS_DISABLED 1
799
800#define SDL_TIMERS_DISABLED 1
801
802#define SDL_VIDEO_DRIVER_DUMMY 1
803
804#define SDL_FILESYSTEM_DUMMY 1
805
806#endif
807
808#endif
809
810#ifdef DECLSPEC
811#undef DECLSPEC
812#endif
813#define DECLSPEC
814
815#if (defined(_MSC_VER) && !defined(WINAPI_FAMILY))
816//#pragma warning(disable:4002)
817//#pragma warning(disable:4003)
818//#pragma warning(disable:4018)
819//#pragma warning(disable:4244)
820#pragma once
821#endif
822
823#define SDL_INIT_AUDIO 0x00000010
824#define SDL_INIT_VIDEO 0x00000020
825#define SDL_INIT_EVENTS 0x00004000
826#define SDL_QuitSubSystem(s) NULL
827#define HAVE_ITOA 1
828#undef SDL_AUDIO_DRIVER_XAUDIO2
829#undef SDL_AUDIO_DRIVER_WINMM
830#undef SDL_AUDIO_DRIVER_DUMMY
831#undef SDL_AUDIO_DRIVER_DISK
832#undef SDL_VIDEO_DRIVER_DUMMY
833#undef SDL_VIDEO_RENDER_OGL_ES2
834#undef SDL_VIDEO_OPENGL_ES2
835#undef SDL_VIDEO_OPENGL_EGL
836#undef SDL_FILESYSTEM_WINDOWS
837#undef SDL_FILESYSTEM_COCOA
838#undef SDL_FILESYSTEM_DUMMY
839#undef SDL_FILESYSTEM_UNIX
840#undef SDL_HAPTIC_DINPUT
841#undef SDL_JOYSTICK_WINMM
842#undef SDL_HAPTIC_IOKIT
843#define SDL_DISABLE_WINDOWS_IME 1
844#define SDL_DISABLE_SCANCODENAMES 1
845
846#define _SDL_H
847#define _SDL_error_h
848#define _SDL_rwops_h
849#define _SDL_hints_h
850#define _SDL_assert_h
851#define _SDL_main_h
852#define _SDL_render_h
853#define _SDL_gesture_c_h
854#define _SDL_stdinc_h
855static SDL_INLINE int SDL_SetError(const char *errstr, ...) { (void)errstr; return 1; }
856#define SDL_assert(a)
857#define SDL_Error(e)
858#define SDL_ASSERT_LEVEL 0
859#define SDL_ClearError()
860static SDL_INLINE int SDL_OutOfMemory() { return 1; }
861#define SDL_Unsupported() 1
862#define SDL_InvalidParamError(p) 1
863#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
864#define SDL_RWops void
865#define SDL_RWFromMem(b,l) NULL
866#define SDL_RWread(ctx, ptr, size, n) 0
867#define SDL_RWwrite(ctx, ptr, size, n) 0
868#define SDL_RWclose(ctx) 0
869#define SDL_WriteLE16(a, b) 0
870#define SDL_WriteLE32(a, b) 0
871
872#define SDL_GestureAddTouch(t) NULL
873#define SDL_GestureProcessEvent(e) NULL
874
875#define SDL_GetHint(n) NULL
876#define SDL_AddHintCallback(n, f, x) NULL
877#define SDL_DelHintCallback(n, f, x) NULL
878#undef HAVE_M_PI
879#include <stdlib.h>
880#define HAVE_GETENV 1
881#undef getenv
882#define getenv(env) NULL
883#define HAVE_STRDUP 1
884#define HAVE_SNPRINTF 1
885#include <stdio.h>
886#ifndef snprintf
887#define snprintf _snprintf
888#endif
889
890#define SDL_Renderer void
891#define SDL_Texture void
892typedef struct SDL_RendererInfo { const char* name; int num_texture_formats; int *texture_formats; } SDL_RendererInfo;
893#define SDL_GetNumRenderDrivers() 0
894#define SDL_GetRenderDriverInfo(i, info) { (info)->name = NULL; (info)->num_texture_formats = 0; }
895#define SDL_CreateRenderer(a,b,c) NULL
896#define SDL_DestroyRenderer(a)
897#define SDL_DestroyTexture(a)
898#define SDL_GetRendererInfo(a, b) NULL
899#define SDL_TEXTUREACCESS_STREAMING 0
900#define SDL_RenderSetViewport(a,b)
901#define SDL_UpdateTexture(a,b,c,d) 0
902#define SDL_RenderCopy(a,b,c,d) 0
903#define SDL_RenderPresent(a)
904#define SDL_CreateTexture(a, b, c, d, e) NULL
905
906#define SDL_malloc(s) malloc(s)
907#define SDL_calloc(n,s) calloc(n,s)
908#define SDL_realloc(m,s) realloc(m,s)
909#define SDL_free(m) free(m)
910#define SDL_getenv(e) NULL
911#define SDL_qsort(a,b,c,d) NULL
912#define SDL_abs(v) abs(v)
913
914#define SDL_iconv_utf8_locale(S) strdup(S)
915#define SDL_iconv_string(t,f,S,l) strdup(S)
916
917#ifdef __WIN32__
918#define _INCLUDED_WINDOWS_H
919#define WIN32_LEAN_AND_MEAN
920#define STRICT 1
921#define UNICODE 1
922#undef _WIN32_WINNT
923#define _WIN32_WINNT 0x501
924#include <windows.h>
925#undef CreateWindow
926#ifdef __WINRT__
927#define WIN_CoInitialize() S_OK
928#define WIN_CoUninitialize() NULL
929#else
930#define WIN_CoInitialize() S_OK;{HRESULT hr=CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);if(hr==RPC_E_CHANGED_MODE)hr=CoInitializeEx(NULL,COINIT_MULTITHREADED);}
931#define WIN_CoUninitialize() {CoUninitialize();}
932#endif
933
934#define WIN_SetError(e) -1
935#define CreateWindow(a, b, c, d, e, f, g, h, i, j, k) CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
936#endif
937
938#ifndef _SDL_stdinc_h_ZL
939#define _SDL_stdinc_h_ZL
940
941#ifdef HAVE_SYS_TYPES_H
942#include <sys/types.h>
943#endif
944#ifdef HAVE_STDIO_H
945#include <stdio.h>
946#endif
947#if defined(STDC_HEADERS)
948# include <stdlib.h>
949# include <stddef.h>
950# include <stdarg.h>
951#else
952# if defined(HAVE_STDLIB_H)
953# include <stdlib.h>
954# elif defined(HAVE_MALLOC_H)
955# include <malloc.h>
956# endif
957# if defined(HAVE_STDDEF_H)
958# include <stddef.h>
959# endif
960# if defined(HAVE_STDARG_H)
961# include <stdarg.h>
962# endif
963#endif
964#ifdef HAVE_STRING_H
965# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
966# include <memory.h>
967# endif
968# include <string.h>
969#endif
970#ifdef HAVE_STRINGS_H
971# include <strings.h>
972#endif
973#if defined(HAVE_INTTYPES_H)
974# include <inttypes.h>
975#elif defined(HAVE_STDINT_H)
976# include <stdint.h>
977#endif
978#ifdef HAVE_CTYPE_H
979# include <ctype.h>
980#endif
981#ifdef HAVE_MATH_H
982# if defined(__WINRT__)
983
984# define _USE_MATH_DEFINES
985# endif
986# include <math.h>
987#endif
988#ifdef HAVE_FLOAT_H
989# include <float.h>
990#endif
991#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
992# include <iconv.h>
993#endif
994
995#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
996#define SDL_TABLESIZE(table) SDL_arraysize(table)
997
998#ifdef __cplusplus
999#define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
1000#define SDL_static_cast(type, expression) static_cast<type>(expression)
1001#define SDL_const_cast(type, expression) const_cast<type>(expression)
1002#else
1003#define SDL_reinterpret_cast(type, expression) ((type)(expression))
1004#define SDL_static_cast(type, expression) ((type)(expression))
1005#define SDL_const_cast(type, expression) ((type)(expression))
1006#endif
1007
1008#define SDL_FOURCC(A, B, C, D) \
1009 ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \
1010 (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \
1011 (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \
1012 (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24))
1013
1014typedef enum
1015{
1016 SDL_FALSE = 0,
1017 SDL_TRUE = 1
1018} SDL_bool;
1019
1020typedef int8_t Sint8;
1021
1022typedef uint8_t Uint8;
1023
1024typedef int16_t Sint16;
1025
1026typedef uint16_t Uint16;
1027
1028typedef int32_t Sint32;
1029
1030typedef uint32_t Uint32;
1031
1032typedef int64_t Sint64;
1033
1034typedef uint64_t Uint64;
1035
1036#define SDL_COMPILE_TIME_ASSERT(name, x) \
1037 typedef int SDL_dummy_ ## name[(x) * 2 - 1]
1038
1039#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1040SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
1041SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
1042SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
1043SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
1044SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
1045SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
1046SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
1047SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
1048#endif
1049
1050#ifndef DOXYGEN_SHOULD_IGNORE_THIS
1051#if !defined(__ANDROID__)
1052
1053typedef enum
1054{
1055 DUMMY_ENUM_VALUE
1056} SDL_DUMMY_ENUM;
1057
1058SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
1059#endif
1060#endif
1061
1062#ifdef _begin_code_h
1063#error Nested inclusion of begin_code.h
1064#endif
1065#define _begin_code_h
1066
1067#ifndef SDL_DEPRECATED
1068# if (__GNUC__ >= 4)
1069# define SDL_DEPRECATED __attribute__((deprecated))
1070# else
1071# define SDL_DEPRECATED
1072# endif
1073#endif
1074
1075#ifndef DECLSPEC
1076# if defined(__WIN32__) || defined(__WINRT__)
1077# ifdef __BORLANDC__
1078# ifdef BUILD_SDL
1079# define DECLSPEC
1080# else
1081# define DECLSPEC __declspec(dllimport)
1082# endif
1083# else
1084# define DECLSPEC __declspec(dllexport)
1085# endif
1086# else
1087# if defined(__GNUC__) && __GNUC__ >= 4
1088# define DECLSPEC __attribute__ ((visibility("default")))
1089# elif defined(__GNUC__) && __GNUC__ >= 2
1090# define DECLSPEC __declspec(dllexport)
1091# else
1092# define DECLSPEC
1093# endif
1094# endif
1095#endif
1096
1097#ifndef SDLCALL
1098#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
1099#define SDLCALL __cdecl
1100#else
1101#define SDLCALL
1102#endif
1103#endif
1104
1105#ifdef __SYMBIAN32__
1106#undef DECLSPEC
1107#define DECLSPEC
1108#endif
1109
1110#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
1111#ifdef _MSC_VER
1112#pragma warning(disable: 4103)
1113#endif
1114#ifdef __BORLANDC__
1115#pragma nopackwarning
1116#endif
1117#ifdef _M_X64
1118
1119#pragma pack(push,8)
1120#else
1121#pragma pack(push,4)
1122#endif
1123#endif
1124
1125#ifndef SDL_INLINE
1126#if defined(__GNUC__)
1127#define SDL_INLINE __inline__
1128#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
1129 defined(__DMC__) || defined(__SC__) || \
1130 defined(__WATCOMC__) || defined(__LCC__) || \
1131 defined(__DECC)
1132#define SDL_INLINE __inline
1133#ifndef __inline__
1134#define __inline__ __inline
1135#endif
1136#else
1137#define SDL_INLINE inline
1138#ifndef __inline__
1139#define __inline__ inline
1140#endif
1141#endif
1142#endif
1143
1144#ifndef SDL_FORCE_INLINE
1145#if defined(_MSC_VER)
1146#define SDL_FORCE_INLINE __forceinline
1147#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
1148#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
1149#else
1150#define SDL_FORCE_INLINE static SDL_INLINE
1151#endif
1152#endif
1153
1154#if !defined(__MACH__)
1155#ifndef NULL
1156#ifdef __cplusplus
1157#define NULL 0
1158#else
1159#define NULL ((void *)0)
1160#endif
1161#endif
1162#endif
1163
1164#ifdef __cplusplus
1165extern "C" {
1166#endif
1167
1168#if defined(HAVE_ALLOCA) && !defined(alloca)
1169# if defined(HAVE_ALLOCA_H)
1170# include <alloca.h>
1171# elif defined(__GNUC__)
1172# define alloca __builtin_alloca
1173# elif defined(_MSC_VER)
1174# include <malloc.h>
1175# define alloca _alloca
1176# elif defined(__WATCOMC__)
1177# include <malloc.h>
1178# elif defined(__BORLANDC__)
1179# include <malloc.h>
1180# elif defined(__DMC__)
1181# include <stdlib.h>
1182# elif defined(__AIX__)
1183#pragma alloca
1184# elif defined(__MRC__)
1185void *alloca(unsigned);
1186# else
1187char *alloca();
1188# endif
1189#endif
1190#ifdef HAVE_ALLOCA
1191#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count))
1192#define SDL_stack_free(data)
1193#else
1194#define SDL_stack_alloc(type, count) (type*)malloc(sizeof(type)*(count))
1195#define SDL_stack_free(data) free(data)
1196#endif
1197
1198#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
1199#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
1200
1201#define SDL_isdigit isdigit
1202#define SDL_isspace isspace
1203#define SDL_toupper toupper
1204#define SDL_tolower tolower
1205#define SDL_memset memset
1206#define SDL_zero(x) memset(&(x), 0, sizeof((x)))
1207#define SDL_zerop(x) memset((x), 0, sizeof(*(x)))
1208#define SDL_memset4(dst, val, dwords) memset((dst), (val), (dwords)*4)
1209#define SDL_memcpy memcpy
1210#define SDL_memcpy4(dst, src, dwords) memcpy((dst), (src), (dwords)*4)
1211#define SDL_memmove memmove
1212#define SDL_memcmp memcmp
1213#define SDL_strlen strlen
1214#define SDL_strlcpy(dst,src,maxlen) strncpy(dst,src,maxlen-1)
1215#define SDL_utf8strlcpy(dst,src,dst_bytes) strncpy(dst,src,dst_bytes-1)
1216#define SDL_strlcat(dst,src,maxlen) strcat(dst,src)
1217#define SDL_strdup strdup
1218#define SDL_strchr strchr
1219#define SDL_strrchr strrchr
1220#define SDL_strstr strstr
1221
1222#define SDL_itoa(i, s, rdx) sprintf(s, "%i", (int)i); { typedef int _chk[(rdx==10)?1:-1]; }
1223
1224#define SDL_atoi atoi
1225#define SDL_atof atof
1226#define SDL_strtol strtol
1227#define SDL_strtoul strtoul
1228#define SDL_strtod strtod
1229
1230#define SDL_strcmp strcmp
1231#define SDL_strncmp strncmp
1232#define SDL_strcasecmp strcmp
1233#define SDL_strncasecmp strncmp
1234#if __STDC_WANT_SECURE_LIB__
1235static SDL_INLINE int SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...) { va_list ap; va_start(ap, fmt); return vsprintf_s(text, maxlen, fmt, ap); }
1236#else
1237static SDL_INLINE int SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...) { va_list ap; (void)maxlen; va_start(ap, fmt); return vsprintf(text, fmt, ap); }
1238#endif
1239#define SDL_sscanf(t,f,v) NULL
1240
1241#ifndef HAVE_M_PI
1242#ifndef M_PI
1243#define M_PI 3.14159265358979323846264338327950288
1244#endif
1245#endif
1246
1247#define SDL_ceil ceil
1248
1249#ifdef __cplusplus
1250}
1251#endif
1252
1253#undef _begin_code_h
1254
1255#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
1256#ifdef __BORLANDC__
1257#pragma nopackwarning
1258#endif
1259#pragma pack(pop)
1260#endif
1261
1262#endif
1263
1264#ifdef __cplusplus
1265extern "C" {
1266#endif
1267extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
1268extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
1269extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
1270#ifdef __WIN32__
1271extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
1272extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
1273char* WIN_StringToUTF8(const unsigned short* s);
1274unsigned short* WIN_UTF8ToString(const char* s);
1275#endif
1276#define SDL_TLSCreate() 0
1277#if defined(__LP64__) || defined(_LP64) || defined(__LLP64__) || defined(__x86_64__) || defined(__ia64__) || defined(_WIN64) || defined(_M_X64)
1278unsigned int SDL_TLSSet64(void*);
1279void* SDL_TLSGet64(unsigned int);
1280#define SDL_TLSSet(tls, v, cb) tls = SDL_TLSSet64(v)
1281#define SDL_TLSGet(tls) SDL_TLSGet64(tls)
1282#else
1283#define SDL_TLSSet(tls, v, cb) tls = (SDL_TLSID)(v)
1284#define SDL_TLSGet(tls) (tls)
1285#endif
1286#ifdef __cplusplus
1287}
1288#endif
1289
1290#endif
1291
1292#ifndef _SDL_audio_h
1293#define _SDL_audio_h
1294
1295#ifndef _SDL_error_h
1296#define _SDL_error_h
1297
1298#ifdef _begin_code_h
1299#error Nested inclusion of begin_code.h
1300#endif
1301#define _begin_code_h
1302
1303#ifndef SDL_DEPRECATED
1304# if (__GNUC__ >= 4)
1305# define SDL_DEPRECATED __attribute__((deprecated))
1306# else
1307# define SDL_DEPRECATED
1308# endif
1309#endif
1310
1311#ifndef DECLSPEC
1312# if defined(__WIN32__) || defined(__WINRT__)
1313# ifdef __BORLANDC__
1314# ifdef BUILD_SDL
1315# define DECLSPEC
1316# else
1317# define DECLSPEC __declspec(dllimport)
1318# endif
1319# else
1320# define DECLSPEC __declspec(dllexport)
1321# endif
1322# else
1323# if defined(__GNUC__) && __GNUC__ >= 4
1324# define DECLSPEC __attribute__ ((visibility("default")))
1325# elif defined(__GNUC__) && __GNUC__ >= 2
1326# define DECLSPEC __declspec(dllexport)
1327# else
1328# define DECLSPEC
1329# endif
1330# endif
1331#endif
1332
1333#ifndef SDLCALL
1334#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
1335#define SDLCALL __cdecl
1336#else
1337#define SDLCALL
1338#endif
1339#endif
1340
1341#ifdef __SYMBIAN32__
1342#undef DECLSPEC
1343#define DECLSPEC
1344#endif
1345
1346#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
1347#ifdef _MSC_VER
1348#pragma warning(disable: 4103)
1349#endif
1350#ifdef __BORLANDC__
1351#pragma nopackwarning
1352#endif
1353#ifdef _M_X64
1354
1355#pragma pack(push,8)
1356#else
1357#pragma pack(push,4)
1358#endif
1359#endif
1360
1361#ifndef SDL_INLINE
1362#if defined(__GNUC__)
1363#define SDL_INLINE __inline__
1364#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
1365 defined(__DMC__) || defined(__SC__) || \
1366 defined(__WATCOMC__) || defined(__LCC__) || \
1367 defined(__DECC)
1368#define SDL_INLINE __inline
1369#ifndef __inline__
1370#define __inline__ __inline
1371#endif
1372#else
1373#define SDL_INLINE inline
1374#ifndef __inline__
1375#define __inline__ inline
1376#endif
1377#endif
1378#endif
1379
1380#ifndef SDL_FORCE_INLINE
1381#if defined(_MSC_VER)
1382#define SDL_FORCE_INLINE __forceinline
1383#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
1384#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
1385#else
1386#define SDL_FORCE_INLINE static SDL_INLINE
1387#endif
1388#endif
1389
1390#if !defined(__MACH__)
1391#ifndef NULL
1392#ifdef __cplusplus
1393#define NULL 0
1394#else
1395#define NULL ((void *)0)
1396#endif
1397#endif
1398#endif
1399
1400#ifdef __cplusplus
1401extern "C" {
1402#endif
1403
1404extern DECLSPEC int SDLCALL SDL_SetError(const char *fmt, ...);
1405extern DECLSPEC const char *SDLCALL SDL_GetError(void);
1406extern DECLSPEC void SDLCALL SDL_ClearError(void);
1407
1408#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
1409#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
1410#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
1411typedef enum
1412{
1413 SDL_ENOMEM,
1414 SDL_EFREAD,
1415 SDL_EFWRITE,
1416 SDL_EFSEEK,
1417 SDL_UNSUPPORTED,
1418 SDL_LASTERROR
1419} SDL_errorcode;
1420
1421extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
1422
1423#ifdef __cplusplus
1424}
1425#endif
1426
1427#undef _begin_code_h
1428
1429#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
1430#ifdef __BORLANDC__
1431#pragma nopackwarning
1432#endif
1433#pragma pack(pop)
1434#endif
1435
1436#endif
1437
1438#ifndef _SDL_endian_h
1439#define _SDL_endian_h
1440
1441#define SDL_LIL_ENDIAN 1234
1442#define SDL_BIG_ENDIAN 4321
1443
1444#ifndef SDL_BYTEORDER
1445#ifdef __linux__
1446#include <endian.h>
1447#define SDL_BYTEORDER __BYTE_ORDER
1448#else
1449#if defined(__hppa__) || \
1450 defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
1451 (defined(__MIPS__) && defined(__MISPEB__)) || \
1452 defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
1453 defined(__sparc__)
1454#define SDL_BYTEORDER SDL_BIG_ENDIAN
1455#else
1456#define SDL_BYTEORDER SDL_LIL_ENDIAN
1457#endif
1458#endif
1459#endif
1460
1461#ifdef _begin_code_h
1462#error Nested inclusion of begin_code.h
1463#endif
1464#define _begin_code_h
1465
1466#ifndef SDL_DEPRECATED
1467# if (__GNUC__ >= 4)
1468# define SDL_DEPRECATED __attribute__((deprecated))
1469# else
1470# define SDL_DEPRECATED
1471# endif
1472#endif
1473
1474#ifndef DECLSPEC
1475# if defined(__WIN32__) || defined(__WINRT__)
1476# ifdef __BORLANDC__
1477# ifdef BUILD_SDL
1478# define DECLSPEC
1479# else
1480# define DECLSPEC __declspec(dllimport)
1481# endif
1482# else
1483# define DECLSPEC __declspec(dllexport)
1484# endif
1485# else
1486# if defined(__GNUC__) && __GNUC__ >= 4
1487# define DECLSPEC __attribute__ ((visibility("default")))
1488# elif defined(__GNUC__) && __GNUC__ >= 2
1489# define DECLSPEC __declspec(dllexport)
1490# else
1491# define DECLSPEC
1492# endif
1493# endif
1494#endif
1495
1496#ifndef SDLCALL
1497#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
1498#define SDLCALL __cdecl
1499#else
1500#define SDLCALL
1501#endif
1502#endif
1503
1504#ifdef __SYMBIAN32__
1505#undef DECLSPEC
1506#define DECLSPEC
1507#endif
1508
1509#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
1510#ifdef _MSC_VER
1511#pragma warning(disable: 4103)
1512#endif
1513#ifdef __BORLANDC__
1514#pragma nopackwarning
1515#endif
1516#ifdef _M_X64
1517
1518#pragma pack(push,8)
1519#else
1520#pragma pack(push,4)
1521#endif
1522#endif
1523
1524#ifndef SDL_INLINE
1525#if defined(__GNUC__)
1526#define SDL_INLINE __inline__
1527#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
1528 defined(__DMC__) || defined(__SC__) || \
1529 defined(__WATCOMC__) || defined(__LCC__) || \
1530 defined(__DECC)
1531#define SDL_INLINE __inline
1532#ifndef __inline__
1533#define __inline__ __inline
1534#endif
1535#else
1536#define SDL_INLINE inline
1537#ifndef __inline__
1538#define __inline__ inline
1539#endif
1540#endif
1541#endif
1542
1543#ifndef SDL_FORCE_INLINE
1544#if defined(_MSC_VER)
1545#define SDL_FORCE_INLINE __forceinline
1546#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
1547#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
1548#else
1549#define SDL_FORCE_INLINE static SDL_INLINE
1550#endif
1551#endif
1552
1553#if !defined(__MACH__)
1554#ifndef NULL
1555#ifdef __cplusplus
1556#define NULL 0
1557#else
1558#define NULL ((void *)0)
1559#endif
1560#endif
1561#endif
1562
1563#ifdef __cplusplus
1564extern "C" {
1565#endif
1566
1567#if defined(__GNUC__) && defined(__i386__) && \
1568 !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
1569SDL_FORCE_INLINE Uint16
1570SDL_Swap16(Uint16 x)
1571{
1572 __asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
1573 return x;
1574}
1575#elif defined(__GNUC__) && defined(__x86_64__)
1576SDL_FORCE_INLINE Uint16
1577SDL_Swap16(Uint16 x)
1578{
1579 __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
1580 return x;
1581}
1582#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
1583SDL_FORCE_INLINE Uint16
1584SDL_Swap16(Uint16 x)
1585{
1586 int result;
1587
1588 __asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
1589 return (Uint16)result;
1590}
1591#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
1592SDL_FORCE_INLINE Uint16
1593SDL_Swap16(Uint16 x)
1594{
1595 __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
1596 return x;
1597}
1598#else
1599SDL_FORCE_INLINE Uint16
1600SDL_Swap16(Uint16 x)
1601{
1602 return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
1603}
1604#endif
1605
1606#if defined(__GNUC__) && defined(__i386__)
1607SDL_FORCE_INLINE Uint32
1608SDL_Swap32(Uint32 x)
1609{
1610 __asm__("bswap %0": "=r"(x):"0"(x));
1611 return x;
1612}
1613#elif defined(__GNUC__) && defined(__x86_64__)
1614SDL_FORCE_INLINE Uint32
1615SDL_Swap32(Uint32 x)
1616{
1617 __asm__("bswapl %0": "=r"(x):"0"(x));
1618 return x;
1619}
1620#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
1621SDL_FORCE_INLINE Uint32
1622SDL_Swap32(Uint32 x)
1623{
1624 Uint32 result;
1625
1626 __asm__("rlwimi %0,%2,24,16,23": "=&r"(result):"0"(x >> 24), "r"(x));
1627 __asm__("rlwimi %0,%2,8,8,15": "=&r"(result):"0"(result), "r"(x));
1628 __asm__("rlwimi %0,%2,24,0,7": "=&r"(result):"0"(result), "r"(x));
1629 return result;
1630}
1631#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__)
1632SDL_FORCE_INLINE Uint32
1633SDL_Swap32(Uint32 x)
1634{
1635 __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
1636 return x;
1637}
1638#else
1639SDL_FORCE_INLINE Uint32
1640SDL_Swap32(Uint32 x)
1641{
1642 return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
1643 ((x >> 8) & 0x0000FF00) | (x >> 24)));
1644}
1645#endif
1646
1647#if defined(__GNUC__) && defined(__i386__)
1648SDL_FORCE_INLINE Uint64
1649SDL_Swap64(Uint64 x)
1650{
1651 union
1652 {
1653 struct
1654 {
1655 Uint32 a, b;
1656 } s;
1657 Uint64 u;
1658 } v;
1659 v.u = x;
1660 __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a),
1661 "1"(v.s.
1662 b));
1663 return v.u;
1664}
1665#elif defined(__GNUC__) && defined(__x86_64__)
1666SDL_FORCE_INLINE Uint64
1667SDL_Swap64(Uint64 x)
1668{
1669 __asm__("bswapq %0": "=r"(x):"0"(x));
1670 return x;
1671}
1672#else
1673SDL_FORCE_INLINE Uint64
1674SDL_Swap64(Uint64 x)
1675{
1676 Uint32 hi, lo;
1677
1678 lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
1679 x >>= 32;
1680 hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
1681 x = SDL_Swap32(lo);
1682 x <<= 32;
1683 x |= SDL_Swap32(hi);
1684 return (x);
1685}
1686#endif
1687
1688SDL_FORCE_INLINE float
1689SDL_SwapFloat(float x)
1690{
1691 union
1692 {
1693 float f;
1694 Uint32 ui32;
1695 } swapper;
1696 swapper.f = x;
1697 swapper.ui32 = SDL_Swap32(swapper.ui32);
1698 return swapper.f;
1699}
1700
1701#if SDL_BYTEORDER == SDL_LIL_ENDIAN
1702#define SDL_SwapLE16(X) (X)
1703#define SDL_SwapLE32(X) (X)
1704#define SDL_SwapLE64(X) (X)
1705#define SDL_SwapFloatLE(X) (X)
1706#define SDL_SwapBE16(X) SDL_Swap16(X)
1707#define SDL_SwapBE32(X) SDL_Swap32(X)
1708#define SDL_SwapBE64(X) SDL_Swap64(X)
1709#define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
1710#else
1711#define SDL_SwapLE16(X) SDL_Swap16(X)
1712#define SDL_SwapLE32(X) SDL_Swap32(X)
1713#define SDL_SwapLE64(X) SDL_Swap64(X)
1714#define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
1715#define SDL_SwapBE16(X) (X)
1716#define SDL_SwapBE32(X) (X)
1717#define SDL_SwapBE64(X) (X)
1718#define SDL_SwapFloatBE(X) (X)
1719#endif
1720
1721#ifdef __cplusplus
1722}
1723#endif
1724
1725#undef _begin_code_h
1726
1727#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
1728#ifdef __BORLANDC__
1729#pragma nopackwarning
1730#endif
1731#pragma pack(pop)
1732#endif
1733
1734#endif
1735
1736#ifndef _SDL_mutex_h
1737#define _SDL_mutex_h
1738
1739#ifdef _begin_code_h
1740#error Nested inclusion of begin_code.h
1741#endif
1742#define _begin_code_h
1743
1744#ifndef SDL_DEPRECATED
1745# if (__GNUC__ >= 4)
1746# define SDL_DEPRECATED __attribute__((deprecated))
1747# else
1748# define SDL_DEPRECATED
1749# endif
1750#endif
1751
1752#ifndef DECLSPEC
1753# if defined(__WIN32__) || defined(__WINRT__)
1754# ifdef __BORLANDC__
1755# ifdef BUILD_SDL
1756# define DECLSPEC
1757# else
1758# define DECLSPEC __declspec(dllimport)
1759# endif
1760# else
1761# define DECLSPEC __declspec(dllexport)
1762# endif
1763# else
1764# if defined(__GNUC__) && __GNUC__ >= 4
1765# define DECLSPEC __attribute__ ((visibility("default")))
1766# elif defined(__GNUC__) && __GNUC__ >= 2
1767# define DECLSPEC __declspec(dllexport)
1768# else
1769# define DECLSPEC
1770# endif
1771# endif
1772#endif
1773
1774#ifndef SDLCALL
1775#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
1776#define SDLCALL __cdecl
1777#else
1778#define SDLCALL
1779#endif
1780#endif
1781
1782#ifdef __SYMBIAN32__
1783#undef DECLSPEC
1784#define DECLSPEC
1785#endif
1786
1787#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
1788#ifdef _MSC_VER
1789#pragma warning(disable: 4103)
1790#endif
1791#ifdef __BORLANDC__
1792#pragma nopackwarning
1793#endif
1794#ifdef _M_X64
1795
1796#pragma pack(push,8)
1797#else
1798#pragma pack(push,4)
1799#endif
1800#endif
1801
1802#ifndef SDL_INLINE
1803#if defined(__GNUC__)
1804#define SDL_INLINE __inline__
1805#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
1806 defined(__DMC__) || defined(__SC__) || \
1807 defined(__WATCOMC__) || defined(__LCC__) || \
1808 defined(__DECC)
1809#define SDL_INLINE __inline
1810#ifndef __inline__
1811#define __inline__ __inline
1812#endif
1813#else
1814#define SDL_INLINE inline
1815#ifndef __inline__
1816#define __inline__ inline
1817#endif
1818#endif
1819#endif
1820
1821#ifndef SDL_FORCE_INLINE
1822#if defined(_MSC_VER)
1823#define SDL_FORCE_INLINE __forceinline
1824#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
1825#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
1826#else
1827#define SDL_FORCE_INLINE static SDL_INLINE
1828#endif
1829#endif
1830
1831#if !defined(__MACH__)
1832#ifndef NULL
1833#ifdef __cplusplus
1834#define NULL 0
1835#else
1836#define NULL ((void *)0)
1837#endif
1838#endif
1839#endif
1840
1841#ifdef __cplusplus
1842extern "C" {
1843#endif
1844
1845#define SDL_MUTEX_TIMEDOUT 1
1846
1847#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
1848
1849struct SDL_mutex;
1850typedef struct SDL_mutex SDL_mutex;
1851
1852extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
1853
1854#define SDL_mutexP(m) SDL_LockMutex(m)
1855extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex);
1856
1857extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex);
1858
1859#define SDL_mutexV(m) SDL_UnlockMutex(m)
1860extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex);
1861
1862extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex);
1863
1864struct SDL_semaphore;
1865typedef struct SDL_semaphore SDL_sem;
1866
1867extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
1868
1869extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
1870
1871extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
1872
1873extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
1874
1875extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms);
1876
1877extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
1878
1879extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem);
1880
1881struct SDL_cond;
1882typedef struct SDL_cond SDL_cond;
1883
1884extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void);
1885
1886extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond);
1887
1888extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
1889
1890extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
1891
1892extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
1893
1894extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond,
1895 SDL_mutex * mutex, Uint32 ms);
1896
1897#ifdef __cplusplus
1898}
1899#endif
1900
1901#undef _begin_code_h
1902
1903#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
1904#ifdef __BORLANDC__
1905#pragma nopackwarning
1906#endif
1907#pragma pack(pop)
1908#endif
1909
1910#endif
1911
1912#ifndef _SDL_thread_h
1913#define _SDL_thread_h
1914
1915#ifndef _SDL_atomic_h_
1916#define _SDL_atomic_h_
1917
1918#ifdef _begin_code_h
1919#error Nested inclusion of begin_code.h
1920#endif
1921#define _begin_code_h
1922
1923#ifndef SDL_DEPRECATED
1924# if (__GNUC__ >= 4)
1925# define SDL_DEPRECATED __attribute__((deprecated))
1926# else
1927# define SDL_DEPRECATED
1928# endif
1929#endif
1930
1931#ifndef DECLSPEC
1932# if defined(__WIN32__) || defined(__WINRT__)
1933# ifdef __BORLANDC__
1934# ifdef BUILD_SDL
1935# define DECLSPEC
1936# else
1937# define DECLSPEC __declspec(dllimport)
1938# endif
1939# else
1940# define DECLSPEC __declspec(dllexport)
1941# endif
1942# else
1943# if defined(__GNUC__) && __GNUC__ >= 4
1944# define DECLSPEC __attribute__ ((visibility("default")))
1945# elif defined(__GNUC__) && __GNUC__ >= 2
1946# define DECLSPEC __declspec(dllexport)
1947# else
1948# define DECLSPEC
1949# endif
1950# endif
1951#endif
1952
1953#ifndef SDLCALL
1954#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
1955#define SDLCALL __cdecl
1956#else
1957#define SDLCALL
1958#endif
1959#endif
1960
1961#ifdef __SYMBIAN32__
1962#undef DECLSPEC
1963#define DECLSPEC
1964#endif
1965
1966#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
1967#ifdef _MSC_VER
1968#pragma warning(disable: 4103)
1969#endif
1970#ifdef __BORLANDC__
1971#pragma nopackwarning
1972#endif
1973#ifdef _M_X64
1974
1975#pragma pack(push,8)
1976#else
1977#pragma pack(push,4)
1978#endif
1979#endif
1980
1981#ifndef SDL_INLINE
1982#if defined(__GNUC__)
1983#define SDL_INLINE __inline__
1984#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
1985 defined(__DMC__) || defined(__SC__) || \
1986 defined(__WATCOMC__) || defined(__LCC__) || \
1987 defined(__DECC)
1988#define SDL_INLINE __inline
1989#ifndef __inline__
1990#define __inline__ __inline
1991#endif
1992#else
1993#define SDL_INLINE inline
1994#ifndef __inline__
1995#define __inline__ inline
1996#endif
1997#endif
1998#endif
1999
2000#ifndef SDL_FORCE_INLINE
2001#if defined(_MSC_VER)
2002#define SDL_FORCE_INLINE __forceinline
2003#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
2004#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
2005#else
2006#define SDL_FORCE_INLINE static SDL_INLINE
2007#endif
2008#endif
2009
2010#if !defined(__MACH__)
2011#ifndef NULL
2012#ifdef __cplusplus
2013#define NULL 0
2014#else
2015#define NULL ((void *)0)
2016#endif
2017#endif
2018#endif
2019
2020#ifdef __cplusplus
2021extern "C" {
2022#endif
2023
2024typedef int SDL_SpinLock;
2025
2026extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
2027
2028extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
2029
2030extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
2031
2032#if defined(_MSC_VER) && (_MSC_VER > 1200)
2033void _ReadWriteBarrier(void);
2034#pragma intrinsic(_ReadWriteBarrier)
2035#define SDL_CompilerBarrier() _ReadWriteBarrier()
2036#elif defined(__GNUC__)
2037#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
2038#else
2039#define SDL_CompilerBarrier() \
2040{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
2041#endif
2042
2043#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
2044#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
2045#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
2046#elif defined(__GNUC__) && defined(__arm__)
2047#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
2048#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
2049#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
2050#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
2051#ifdef __thumb__
2052
2053extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease();
2054extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire();
2055#else
2056#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
2057#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
2058#endif
2059#else
2060#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
2061#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
2062#endif
2063#else
2064
2065#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
2066#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
2067#endif
2068
2069typedef struct { int value; } SDL_atomic_t;
2070
2071extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
2072
2073extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v);
2074
2075extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
2076
2077extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v);
2078
2079#ifndef SDL_AtomicIncRef
2080#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1)
2081#endif
2082
2083#ifndef SDL_AtomicDecRef
2084#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1)
2085#endif
2086
2087extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *newval);
2088
2089extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v);
2090
2091extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a);
2092
2093#ifdef __cplusplus
2094}
2095#endif
2096
2097#undef _begin_code_h
2098
2099#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
2100#ifdef __BORLANDC__
2101#pragma nopackwarning
2102#endif
2103#pragma pack(pop)
2104#endif
2105
2106#endif
2107
2108#ifdef _begin_code_h
2109#error Nested inclusion of begin_code.h
2110#endif
2111#define _begin_code_h
2112
2113#ifndef SDL_DEPRECATED
2114# if (__GNUC__ >= 4)
2115# define SDL_DEPRECATED __attribute__((deprecated))
2116# else
2117# define SDL_DEPRECATED
2118# endif
2119#endif
2120
2121#ifndef DECLSPEC
2122# if defined(__WIN32__) || defined(__WINRT__)
2123# ifdef __BORLANDC__
2124# ifdef BUILD_SDL
2125# define DECLSPEC
2126# else
2127# define DECLSPEC __declspec(dllimport)
2128# endif
2129# else
2130# define DECLSPEC __declspec(dllexport)
2131# endif
2132# else
2133# if defined(__GNUC__) && __GNUC__ >= 4
2134# define DECLSPEC __attribute__ ((visibility("default")))
2135# elif defined(__GNUC__) && __GNUC__ >= 2
2136# define DECLSPEC __declspec(dllexport)
2137# else
2138# define DECLSPEC
2139# endif
2140# endif
2141#endif
2142
2143#ifndef SDLCALL
2144#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
2145#define SDLCALL __cdecl
2146#else
2147#define SDLCALL
2148#endif
2149#endif
2150
2151#ifdef __SYMBIAN32__
2152#undef DECLSPEC
2153#define DECLSPEC
2154#endif
2155
2156#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
2157#ifdef _MSC_VER
2158#pragma warning(disable: 4103)
2159#endif
2160#ifdef __BORLANDC__
2161#pragma nopackwarning
2162#endif
2163#ifdef _M_X64
2164
2165#pragma pack(push,8)
2166#else
2167#pragma pack(push,4)
2168#endif
2169#endif
2170
2171#ifndef SDL_INLINE
2172#if defined(__GNUC__)
2173#define SDL_INLINE __inline__
2174#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
2175 defined(__DMC__) || defined(__SC__) || \
2176 defined(__WATCOMC__) || defined(__LCC__) || \
2177 defined(__DECC)
2178#define SDL_INLINE __inline
2179#ifndef __inline__
2180#define __inline__ __inline
2181#endif
2182#else
2183#define SDL_INLINE inline
2184#ifndef __inline__
2185#define __inline__ inline
2186#endif
2187#endif
2188#endif
2189
2190#ifndef SDL_FORCE_INLINE
2191#if defined(_MSC_VER)
2192#define SDL_FORCE_INLINE __forceinline
2193#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
2194#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
2195#else
2196#define SDL_FORCE_INLINE static SDL_INLINE
2197#endif
2198#endif
2199
2200#if !defined(__MACH__)
2201#ifndef NULL
2202#ifdef __cplusplus
2203#define NULL 0
2204#else
2205#define NULL ((void *)0)
2206#endif
2207#endif
2208#endif
2209
2210#ifdef __cplusplus
2211extern "C" {
2212#endif
2213
2214struct SDL_Thread;
2215typedef struct SDL_Thread SDL_Thread;
2216
2217typedef unsigned long SDL_threadID;
2218
2219typedef unsigned int SDL_TLSID;
2220
2221typedef enum {
2222 SDL_THREAD_PRIORITY_LOW,
2223 SDL_THREAD_PRIORITY_NORMAL,
2224 SDL_THREAD_PRIORITY_HIGH
2225} SDL_ThreadPriority;
2226
2227typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
2228
2229#if defined(__WIN32__) && !defined(HAVE_LIBC)
2230
2231#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
2232#include <process.h>
2233
2234typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
2235 unsigned (__stdcall *
2236 func) (void
2237 *),
2238 void *arg, unsigned,
2239 unsigned *threadID);
2240typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
2241
2242extern DECLSPEC SDL_Thread *SDLCALL
2243SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
2244 pfnSDL_CurrentBeginThread pfnBeginThread,
2245 pfnSDL_CurrentEndThread pfnEndThread);
2246
2247#if defined(SDL_CreateThread) && SDL_DYNAMIC_API
2248#undef SDL_CreateThread
2249#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
2250#else
2251#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
2252#endif
2253
2254#else
2255
2256extern DECLSPEC SDL_Thread *SDLCALL
2257SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
2258
2259#endif
2260
2261extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread);
2262
2263extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
2264
2265extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
2266
2267extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
2268
2269extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status);
2270
2271extern DECLSPEC void SDLCALL SDL_DetachThread(SDL_Thread * thread);
2272
2273#ifdef __cplusplus
2274}
2275#endif
2276
2277#undef _begin_code_h
2278
2279#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
2280#ifdef __BORLANDC__
2281#pragma nopackwarning
2282#endif
2283#pragma pack(pop)
2284#endif
2285
2286#endif
2287
2288#ifndef _SDL_rwops_h
2289#define _SDL_rwops_h
2290
2291#ifdef _begin_code_h
2292#error Nested inclusion of begin_code.h
2293#endif
2294#define _begin_code_h
2295
2296#ifndef SDL_DEPRECATED
2297# if (__GNUC__ >= 4)
2298# define SDL_DEPRECATED __attribute__((deprecated))
2299# else
2300# define SDL_DEPRECATED
2301# endif
2302#endif
2303
2304#ifndef DECLSPEC
2305# if defined(__WIN32__) || defined(__WINRT__)
2306# ifdef __BORLANDC__
2307# ifdef BUILD_SDL
2308# define DECLSPEC
2309# else
2310# define DECLSPEC __declspec(dllimport)
2311# endif
2312# else
2313# define DECLSPEC __declspec(dllexport)
2314# endif
2315# else
2316# if defined(__GNUC__) && __GNUC__ >= 4
2317# define DECLSPEC __attribute__ ((visibility("default")))
2318# elif defined(__GNUC__) && __GNUC__ >= 2
2319# define DECLSPEC __declspec(dllexport)
2320# else
2321# define DECLSPEC
2322# endif
2323# endif
2324#endif
2325
2326#ifndef SDLCALL
2327#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
2328#define SDLCALL __cdecl
2329#else
2330#define SDLCALL
2331#endif
2332#endif
2333
2334#ifdef __SYMBIAN32__
2335#undef DECLSPEC
2336#define DECLSPEC
2337#endif
2338
2339#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
2340#ifdef _MSC_VER
2341#pragma warning(disable: 4103)
2342#endif
2343#ifdef __BORLANDC__
2344#pragma nopackwarning
2345#endif
2346#ifdef _M_X64
2347
2348#pragma pack(push,8)
2349#else
2350#pragma pack(push,4)
2351#endif
2352#endif
2353
2354#ifndef SDL_INLINE
2355#if defined(__GNUC__)
2356#define SDL_INLINE __inline__
2357#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
2358 defined(__DMC__) || defined(__SC__) || \
2359 defined(__WATCOMC__) || defined(__LCC__) || \
2360 defined(__DECC)
2361#define SDL_INLINE __inline
2362#ifndef __inline__
2363#define __inline__ __inline
2364#endif
2365#else
2366#define SDL_INLINE inline
2367#ifndef __inline__
2368#define __inline__ inline
2369#endif
2370#endif
2371#endif
2372
2373#ifndef SDL_FORCE_INLINE
2374#if defined(_MSC_VER)
2375#define SDL_FORCE_INLINE __forceinline
2376#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
2377#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
2378#else
2379#define SDL_FORCE_INLINE static SDL_INLINE
2380#endif
2381#endif
2382
2383#if !defined(__MACH__)
2384#ifndef NULL
2385#ifdef __cplusplus
2386#define NULL 0
2387#else
2388#define NULL ((void *)0)
2389#endif
2390#endif
2391#endif
2392
2393#ifdef __cplusplus
2394extern "C" {
2395#endif
2396
2397#define SDL_RWOPS_UNKNOWN 0
2398#define SDL_RWOPS_WINFILE 1
2399#define SDL_RWOPS_STDFILE 2
2400#define SDL_RWOPS_JNIFILE 3
2401#define SDL_RWOPS_MEMORY 4
2402#define SDL_RWOPS_MEMORY_RO 5
2403
2404typedef struct SDL_RWops
2405{
2406
2407 Sint64 (SDLCALL * size) (struct SDL_RWops * context);
2408
2409 Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset,
2410 int whence);
2411
2412 size_t (SDLCALL * read) (struct SDL_RWops * context, void *ptr,
2413 size_t size, size_t maxnum);
2414
2415 size_t (SDLCALL * write) (struct SDL_RWops * context, const void *ptr,
2416 size_t size, size_t num);
2417
2418 int (SDLCALL * close) (struct SDL_RWops * context);
2419
2420 Uint32 type;
2421 union
2422 {
2423#if defined(ANDROID)
2424 struct
2425 {
2426 void *fileNameRef;
2427 void *inputStreamRef;
2428 void *readableByteChannelRef;
2429 void *readMethod;
2430 void *assetFileDescriptorRef;
2431 long position;
2432 long size;
2433 long offset;
2434 int fd;
2435 } androidio;
2436#elif defined(__WIN32__)
2437 struct
2438 {
2439 SDL_bool append;
2440 void *h;
2441 struct
2442 {
2443 void *data;
2444 size_t size;
2445 size_t left;
2446 } buffer;
2447 } windowsio;
2448#endif
2449
2450#ifdef HAVE_STDIO_H
2451 struct
2452 {
2453 SDL_bool autoclose;
2454 FILE *fp;
2455 } stdio;
2456#endif
2457 struct
2458 {
2459 Uint8 *base;
2460 Uint8 *here;
2461 Uint8 *stop;
2462 } mem;
2463 struct
2464 {
2465 void *data1;
2466 void *data2;
2467 } unknown;
2468 } hidden;
2469
2470} SDL_RWops;
2471
2472extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file,
2473 const char *mode);
2474
2475#ifdef HAVE_STDIO_H
2476extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp,
2477 SDL_bool autoclose);
2478#else
2479extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp,
2480 SDL_bool autoclose);
2481#endif
2482
2483extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size);
2484extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem,
2485 int size);
2486
2487extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
2488extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
2489
2490#define RW_SEEK_SET 0
2491#define RW_SEEK_CUR 1
2492#define RW_SEEK_END 2
2493
2494#define SDL_RWsize(ctx) (ctx)->size(ctx)
2495#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
2496#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
2497#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
2498#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
2499#define SDL_RWclose(ctx) (ctx)->close(ctx)
2500
2501extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src);
2502extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src);
2503extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src);
2504extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src);
2505extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src);
2506extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src);
2507extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
2508
2509extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value);
2510extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value);
2511extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value);
2512extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value);
2513extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value);
2514extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value);
2515extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value);
2516
2517#ifdef __cplusplus
2518}
2519#endif
2520
2521#undef _begin_code_h
2522
2523#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
2524#ifdef __BORLANDC__
2525#pragma nopackwarning
2526#endif
2527#pragma pack(pop)
2528#endif
2529
2530#endif
2531
2532#ifdef _begin_code_h
2533#error Nested inclusion of begin_code.h
2534#endif
2535#define _begin_code_h
2536
2537#ifndef SDL_DEPRECATED
2538# if (__GNUC__ >= 4)
2539# define SDL_DEPRECATED __attribute__((deprecated))
2540# else
2541# define SDL_DEPRECATED
2542# endif
2543#endif
2544
2545#ifndef DECLSPEC
2546# if defined(__WIN32__) || defined(__WINRT__)
2547# ifdef __BORLANDC__
2548# ifdef BUILD_SDL
2549# define DECLSPEC
2550# else
2551# define DECLSPEC __declspec(dllimport)
2552# endif
2553# else
2554# define DECLSPEC __declspec(dllexport)
2555# endif
2556# else
2557# if defined(__GNUC__) && __GNUC__ >= 4
2558# define DECLSPEC __attribute__ ((visibility("default")))
2559# elif defined(__GNUC__) && __GNUC__ >= 2
2560# define DECLSPEC __declspec(dllexport)
2561# else
2562# define DECLSPEC
2563# endif
2564# endif
2565#endif
2566
2567#ifndef SDLCALL
2568#if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__)
2569#define SDLCALL __cdecl
2570#else
2571#define SDLCALL
2572#endif
2573#endif
2574
2575#ifdef __SYMBIAN32__
2576#undef DECLSPEC
2577#define DECLSPEC
2578#endif
2579
2580#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
2581#ifdef _MSC_VER
2582#pragma warning(disable: 4103)
2583#endif
2584#ifdef __BORLANDC__
2585#pragma nopackwarning
2586#endif
2587#ifdef _M_X64
2588
2589#pragma pack(push,8)
2590#else
2591#pragma pack(push,4)
2592#endif
2593#endif
2594
2595#ifndef SDL_INLINE
2596#if defined(__GNUC__)
2597#define SDL_INLINE __inline__
2598#elif defined(_MSC_VER) || defined(__BORLANDC__) || \
2599 defined(__DMC__) || defined(__SC__) || \
2600 defined(__WATCOMC__) || defined(__LCC__) || \
2601 defined(__DECC)
2602#define SDL_INLINE __inline
2603#ifndef __inline__
2604#define __inline__ __inline
2605#endif
2606#else
2607#define SDL_INLINE inline
2608#ifndef __inline__
2609#define __inline__ inline
2610#endif
2611#endif
2612#endif
2613
2614#ifndef SDL_FORCE_INLINE
2615#if defined(_MSC_VER)
2616#define SDL_FORCE_INLINE __forceinline
2617#elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
2618#define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__
2619#else
2620#define SDL_FORCE_INLINE static SDL_INLINE
2621#endif
2622#endif
2623
2624#if !defined(__MACH__)
2625#ifndef NULL
2626#ifdef __cplusplus
2627#define NULL 0
2628#else
2629#define NULL ((void *)0)
2630#endif
2631#endif
2632#endif
2633
2634#ifdef __cplusplus
2635extern "C" {
2636#endif
2637
2638typedef Uint16 SDL_AudioFormat;
2639
2640#define SDL_AUDIO_MASK_BITSIZE (0xFF)
2641#define SDL_AUDIO_MASK_DATATYPE (1<<8)
2642#define SDL_AUDIO_MASK_ENDIAN (1<<12)
2643#define SDL_AUDIO_MASK_SIGNED (1<<15)
2644#define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE)
2645#define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE)
2646#define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN)
2647#define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED)
2648#define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x))
2649#define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x))
2650#define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x))
2651
2652#define AUDIO_U8 0x0008
2653#define AUDIO_S8 0x8008
2654#define AUDIO_U16LSB 0x0010
2655#define AUDIO_S16LSB 0x8010
2656#define AUDIO_U16MSB 0x1010
2657#define AUDIO_S16MSB 0x9010
2658#define AUDIO_U16 AUDIO_U16LSB
2659#define AUDIO_S16 AUDIO_S16LSB
2660
2661#define AUDIO_S32LSB 0x8020
2662#define AUDIO_S32MSB 0x9020
2663#define AUDIO_S32 AUDIO_S32LSB
2664
2665#define AUDIO_F32LSB 0x8120
2666#define AUDIO_F32MSB 0x9120
2667#define AUDIO_F32 AUDIO_F32LSB
2668
2669#if SDL_BYTEORDER == SDL_LIL_ENDIAN
2670#define AUDIO_U16SYS AUDIO_U16LSB
2671#define AUDIO_S16SYS AUDIO_S16LSB
2672#define AUDIO_S32SYS AUDIO_S32LSB
2673#define AUDIO_F32SYS AUDIO_F32LSB
2674#else
2675#define AUDIO_U16SYS AUDIO_U16MSB
2676#define AUDIO_S16SYS AUDIO_S16MSB
2677#define AUDIO_S32SYS AUDIO_S32MSB
2678#define AUDIO_F32SYS AUDIO_F32MSB
2679#endif
2680
2681#define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001
2682#define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002
2683#define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004
2684#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE)
2685
2686typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
2687 int len);
2688
2689typedef struct SDL_AudioSpec
2690{
2691 int freq;
2692 SDL_AudioFormat format;
2693 Uint8 channels;
2694 Uint8 silence;
2695 Uint16 samples;
2696 Uint16 padding;
2697 Uint32 size;
2698 SDL_AudioCallback callback;
2699 void *userdata;
2700} SDL_AudioSpec;
2701
2702struct SDL_AudioCVT;
2703typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
2704 SDL_AudioFormat format);
2705
2706#ifdef __GNUC__
2707
2708#define SDL_AUDIOCVT_PACKED __attribute__((packed))
2709#else
2710#define SDL_AUDIOCVT_PACKED
2711#endif
2712
2713typedef struct SDL_AudioCVT
2714{
2715 int needed;
2716 SDL_AudioFormat src_format;
2717 SDL_AudioFormat dst_format;
2718 double rate_incr;
2719 Uint8 *buf;
2720 int len;
2721 int len_cvt;
2722 int len_mult;
2723 double len_ratio;
2724 SDL_AudioFilter filters[10];
2725 int filter_index;
2726} SDL_AUDIOCVT_PACKED SDL_AudioCVT;
2727
2728extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void);
2729extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
2730
2731extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
2732extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
2733
2734extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void);
2735
2736extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired,
2737 SDL_AudioSpec * obtained);
2738
2739typedef Uint32 SDL_AudioDeviceID;
2740
2741extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
2742
2743extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
2744 int iscapture);
2745
2746extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char
2747 *device,
2748 int iscapture,
2749 const
2750 SDL_AudioSpec *
2751 desired,
2752 SDL_AudioSpec *
2753 obtained,
2754 int
2755 allowed_changes);
2756
2757typedef enum
2758{
2759 SDL_AUDIO_STOPPED = 0,
2760 SDL_AUDIO_PLAYING,
2761 SDL_AUDIO_PAUSED
2762} SDL_AudioStatus;
2763extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void);
2764
2765extern DECLSPEC SDL_AudioStatus SDLCALL
2766SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev);
2767
2768extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
2769extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
2770 int pause_on);
2771
2772extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
2773 int freesrc,
2774 SDL_AudioSpec * spec,
2775 Uint8 ** audio_buf,
2776 Uint32 * audio_len);
2777
2778#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
2779 SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
2780
2781extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
2782
2783extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
2784 SDL_AudioFormat src_format,
2785 Uint8 src_channels,
2786 int src_rate,
2787 SDL_AudioFormat dst_format,
2788 Uint8 dst_channels,
2789 int dst_rate);
2790
2791extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt);
2792
2793#define SDL_MIX_MAXVOLUME 128
2794
2795extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
2796 Uint32 len, int volume);
2797
2798extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
2799 const Uint8 * src,
2800 SDL_AudioFormat format,
2801 Uint32 len, int volume);
2802
2803extern DECLSPEC void SDLCALL SDL_LockAudio(void);
2804extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev);
2805extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
2806extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev);
2807
2808extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
2809extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev);
2810
2811#ifdef __cplusplus
2812}
2813#endif
2814
2815#undef _begin_code_h
2816
2817#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
2818#ifdef __BORLANDC__
2819#pragma nopackwarning
2820#endif
2821#pragma pack(pop)
2822#endif
2823
2824#endif