Define SDL_PLATFORM_* macros instead of underscored ones (#8875)

This commit is contained in:
Anonymous Maarten
2024-01-24 02:40:51 +01:00
committed by GitHub
parent ceccf24519
commit 31d133db40
208 changed files with 1293 additions and 1138 deletions

View File

@@ -66,9 +66,9 @@ assert can have unique static variables associated with it.
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
#elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv)
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "ebreak\n\t" )
#elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */
#elif ( defined(SDL_PLATFORM_APPLE) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
#elif defined(__APPLE__) && defined(__arm__)
#elif defined(SDL_PLATFORM_APPLE) && defined(__arm__)
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" )
#elif defined(__386__) && defined(__WATCOMC__)
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
@@ -167,7 +167,7 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *data
#ifndef SDL_AssertBreakpoint
#if defined(ANDROID) && defined(assert)
/* Define this as empty in case assert() is defined as SDL_assert */
#define SDL_AssertBreakpoint()
#define SDL_AssertBreakpoint()
#else
#define SDL_AssertBreakpoint() SDL_TriggerBreakpoint()
#endif

View File

@@ -153,7 +153,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockSpinlock(SDL_SpinLock *lock);
void _ReadWriteBarrier(void);
#pragma intrinsic(_ReadWriteBarrier)
#define SDL_CompilerBarrier() _ReadWriteBarrier()
#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
#elif (defined(__GNUC__) && !defined(SDL_PLATFORM_EMSCRIPTEN)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
#elif defined(__WATCOMC__)
@@ -199,7 +199,7 @@ extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
#elif defined(__GNUC__) && defined(__arm__)
#if 0 /* defined(__LINUX__) || defined(__ANDROID__) */
#if 0 /* defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_ANDROID) */
/* Information from:
https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19
@@ -226,7 +226,7 @@ typedef void (*SDL_KernelMemoryBarrierFunc)();
#else
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
#endif /* __LINUX__ || __ANDROID__ */
#endif /* SDL_PLATFORM_LINUX || SDL_PLATFORM_ANDROID */
#endif /* __GNUC__ && __arm__ */
#else
#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))

View File

@@ -53,7 +53,7 @@
/* Some compilers use a special export keyword */
#ifndef DECLSPEC
# if defined(__WIN32__) || defined(__WINRT__) || defined(__CYGWIN__) || defined(__GDK__)
# if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_CYGWIN) || defined(SDL_PLATFORM_GDK)
# ifdef DLL_EXPORT
# define DECLSPEC __declspec(dllexport)
# else
@@ -70,7 +70,7 @@
/* By default SDL uses the C calling convention */
#ifndef SDLCALL
#if (defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)) && !defined(__GNUC__)
#if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)) && !defined(__GNUC__)
#define SDLCALL __cdecl
#else
#define SDLCALL

View File

@@ -25,9 +25,11 @@
* This is a simple file to encapsulate the EGL API headers.
*/
#if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
#include "SDL_platform_defines.h"
#if defined(__vita__) || defined(__psp2__)
#if !defined(_MSC_VER) && !defined(SDL_PLATFORM_ANDROID) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
#if defined(SDL_PLATFORM_VITA)
#include <psp2/display.h>
#include <psp2/gxm.h>
#include <psp2/types.h>
@@ -419,7 +421,7 @@ typedef HDC EGLNativeDisplayType;
typedef HBITMAP EGLNativePixmapType;
typedef HWND EGLNativeWindowType;
#elif defined(__EMSCRIPTEN__)
#elif defined(SDL_PLATFORM_EMSCRIPTEN)
typedef int EGLNativeDisplayType;
typedef int EGLNativePixmapType;

View File

@@ -56,13 +56,13 @@ _m_prefetch(void *__P)
/* @} */
#ifndef SDL_BYTEORDER
#ifdef __linux__
#ifdef SDL_PLATFORM_LINUX
#include <endian.h>
#define SDL_BYTEORDER __BYTE_ORDER
#elif defined(__OpenBSD__) || defined(__DragonFly__)
#elif defined(SDL_PLATFORM_OPENBSD) || defined(__DragonFly__)
#include <endian.h>
#define SDL_BYTEORDER BYTE_ORDER
#elif defined(__FreeBSD__) || defined(__NetBSD__)
#elif defined(SDL_PLATFORM_FREEBSD) || defined(SDL_PLATFORM_NETBSD)
#include <sys/endian.h>
#define SDL_BYTEORDER BYTE_ORDER
/* predefs from newer gcc and clang versions: */
@@ -84,7 +84,7 @@ _m_prefetch(void *__P)
#else
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#endif
#endif /* __linux__ */
#endif /* SDL_PLATFORM_LINUX */
#endif /* !SDL_BYTEORDER */
#ifndef SDL_FLOATWORDORDER

View File

@@ -64,7 +64,7 @@ _m_prefetch(void *__P)
# ifdef __ARM_NEON
# define SDL_NEON_INTRINSICS 1
# include <arm_neon.h>
# elif defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__)
# elif defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)
/* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */
# ifdef _M_ARM
# define SDL_NEON_INTRINSICS 1

View File

@@ -22,6 +22,7 @@
#ifndef SDL_main_h_
#define SDL_main_h_
#include <SDL3/SDL_platform_defines.h>
#include <SDL3/SDL_stdinc.h>
#include <SDL3/SDL_events.h>
@@ -40,7 +41,7 @@
*/
#ifndef SDL_MAIN_HANDLED
#ifdef __WIN32__
#ifdef SDL_PLATFORM_WIN32
/* On Windows SDL provides WinMain(), which parses the command line and passes
the arguments to your main function.
@@ -48,7 +49,7 @@
*/
#define SDL_MAIN_AVAILABLE
#elif defined(__WINRT__)
#elif defined(SDL_PLATFORM_WINRT)
/* On WinRT, SDL provides a main function that initializes CoreApplication,
creating an instance of IFrameworkView in the process.
@@ -62,7 +63,7 @@
*/
#define SDL_MAIN_NEEDED
#elif defined(__GDK__)
#elif defined(SDL_PLATFORM_GDK)
/* On GDK, SDL provides a main function that initializes the game runtime.
If you prefer to write your own WinMain-function instead of having SDL
@@ -72,7 +73,7 @@
*/
#define SDL_MAIN_NEEDED
#elif defined(__IOS__)
#elif defined(SDL_PLATFORM_IOS)
/* On iOS SDL provides a main function that creates an application delegate
and starts the iOS application run loop.
@@ -83,7 +84,7 @@
*/
#define SDL_MAIN_NEEDED
#elif defined(__ANDROID__)
#elif defined(SDL_PLATFORM_ANDROID)
/* On Android SDL provides a Java class in SDLActivity.java that is the
main activity entry point.
@@ -94,7 +95,7 @@
/* We need to export SDL_main so it can be launched from Java */
#define SDLMAIN_DECLSPEC DECLSPEC
#elif defined(__PSP__)
#elif defined(SDL_PLATFORM_PSP)
/* On PSP SDL provides a main function that sets the module info,
activates the GPU and starts the thread required to be able to exit
the software.
@@ -103,14 +104,14 @@
*/
#define SDL_MAIN_AVAILABLE
#elif defined(__PS2__)
#elif defined(SDL_PLATFORM_PS2)
#define SDL_MAIN_AVAILABLE
#define SDL_PS2_SKIP_IOP_RESET() \
void reset_IOP(); \
void reset_IOP() {}
#elif defined(__3DS__)
#elif defined(SDL_PLATFORM_3DS)
/*
On N3DS, SDL provides a main function that sets up the screens
and storage.
@@ -119,7 +120,7 @@
*/
#define SDL_MAIN_AVAILABLE
#elif defined(__NGAGE__)
#elif defined(SDL_PLATFORM_NGAGE)
/*
TODO: not sure if it should be SDL_MAIN_NEEDED, in SDL2 ngage had a
@@ -422,7 +423,7 @@ extern DECLSPEC int SDLCALL SDL_RunApp(int argc, char* argv[], SDL_main_func mai
extern DECLSPEC int SDLCALL SDL_EnterAppMainCallbacks(int argc, char* argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit);
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
/**
* Register a win32 window class for SDL's use.
@@ -467,24 +468,24 @@ extern DECLSPEC int SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void
*/
extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
#endif /* defined(__WIN32__) || defined(__GDK__) */
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) */
#ifdef __WINRT__
#ifdef SDL_PLATFORM_WINRT
/* for compatibility with SDL2's function of this name */
#define SDL_WinRTRunApp(MAIN_FUNC, RESERVED) SDL_RunApp(0, NULL, MAIN_FUNC, RESERVED)
#endif /* __WINRT__ */
#endif /* SDL_PLATFORM_WINRT */
#ifdef __IOS__
#ifdef SDL_PLATFORM_IOS
/* for compatibility with SDL2's function of this name */
#define SDL_UIKitRunApp(ARGC, ARGV, MAIN_FUNC) SDL_RunApp(ARGC, ARGV, MAIN_FUNC, NULL)
#endif /* __IOS__ */
#endif /* SDL_PLATFORM_IOS */
#ifdef __GDK__
#ifdef SDL_PLATFORM_GDK
/* for compatibility with SDL2's function of this name */
#define SDL_GDKRunApp(MAIN_FUNC, RESERVED) SDL_RunApp(0, NULL, MAIN_FUNC, RESERVED)
@@ -496,7 +497,7 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
*/
extern DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
#endif /* __GDK__ */
#endif /* SDL_PLATFORM_GDK */
#ifdef __cplusplus
}
@@ -507,13 +508,13 @@ extern DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
#if !defined(SDL_MAIN_HANDLED) && !defined(SDL_MAIN_NOIMPL)
/* include header-only SDL_main implementations */
#if defined(SDL_MAIN_USE_CALLBACKS) \
|| defined(__WIN32__) || defined(__GDK__) || defined(__IOS__) || defined(__TVOS__) \
|| defined(__3DS__) || defined(__NGAGE__) || defined(__PS2__) || defined(__PSP__)
|| defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) \
|| defined(SDL_PLATFORM_3DS) || defined(SDL_PLATFORM_NGAGE) || defined(SDL_PLATFORM_PS2) || defined(SDL_PLATFORM_PSP)
/* platforms which main (-equivalent) can be implemented in plain C */
#include <SDL3/SDL_main_impl.h>
#elif defined(__WINRT__) /* C++ platforms */
#elif defined(SDL_PLATFORM_WINRT) /* C++ platforms */
#ifdef __cplusplus
#include <SDL3/SDL_main_impl.h>
@@ -528,7 +529,7 @@ extern DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
#endif /* __GNUC__ */
#endif /* __cplusplus */
#endif /* C++ platforms like __WINRT__ etc */
#endif /* C++ platforms like SDL_PLATFORM_WINRT etc */
#endif /* SDL_MAIN_HANDLED */

View File

@@ -65,7 +65,7 @@ int SDL_main(int argc, char **argv)
/* set up the usual SDL_main stuff if we're not using callbacks or if we are but need the normal entry point. */
#if !defined(SDL_MAIN_USE_CALLBACKS) || defined(SDL_MAIN_CALLBACK_STANDARD)
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
/* these defines/typedefs are needed for the WinMain() definition */
#ifndef WINAPI
@@ -77,7 +77,7 @@ typedef char* LPSTR;
typedef wchar_t* PWSTR;
/* The VC++ compiler needs main/wmain defined, but not for GDK */
#if defined(_MSC_VER) && !defined(__GDK__)
#if defined(_MSC_VER) && !defined(SDL_PLATFORM_GDK)
/* This is where execution begins [console apps] */
#if defined( UNICODE ) && UNICODE
@@ -97,7 +97,7 @@ int main(int argc, char *argv[])
}
#endif /* UNICODE */
#endif /* _MSC_VER && ! __GDK__ */
#endif /* _MSC_VER && ! SDL_PLATFORM_GDK */
/* This is where execution begins [windowed apps and GDK] */
@@ -120,8 +120,8 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
} /* extern "C" */
#endif
/* end of __WIN32__ and __GDK__ impls */
#elif defined(__WINRT__)
/* end of SDL_PLATFORM_WIN32 and SDL_PLATFORM_GDK impls */
#elif defined(SDL_PLATFORM_WINRT)
/* WinRT main based on SDL_winrt_main_NonXAML.cpp, placed in the public domain by David Ludwig 3/13/14 */
@@ -182,18 +182,18 @@ int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
#endif
/* end of WinRT impl */
#elif defined(__NGAGE__)
#elif defined(SDL_PLATFORM_NGAGE)
/* same typedef as in ngage SDKs e32def.h */
typedef signed int TInt;
/* TODO: if it turns out that this only works when built as C++,
move __NGAGE__ into the C++ section in SDL_main.h */
move SDL_PLATFORM_NGAGE into the C++ section in SDL_main.h */
TInt E32Main()
{
return SDL_RunApp(0, NULL, SDL_main, NULL);
}
/* end of __NGAGE__ impl */
/* end of SDL_PLATFORM_NGAGE impl */
#else /* platforms that use a standard main() and just call SDL_RunApp(), like iOS and 3DS */
@@ -204,7 +204,7 @@ int main(int argc, char *argv[])
/* end of impls for standard-conforming platforms */
#endif /* __WIN32__ etc */
#endif /* SDL_PLATFORM_WIN32 etc */
#endif /* !defined(SDL_MAIN_USE_CALLBACKS) || defined(SDL_MAIN_CALLBACK_STANDARD) */

View File

@@ -377,14 +377,6 @@
#define SDL_PIXELFORMAT_RGB888 SDL_PIXELFORMAT_XRGB8888
#define SDL_PixelFormatEnumToMasks SDL_GetMasksForPixelFormatEnum
/* ##SDL_platform.h */
#ifdef __IOS__
#define __IPHONEOS__ __IOS__
#endif
#ifdef __MACOS__
#define __MACOSX__ __MACOS__
#endif
/* ##SDL_rect.h */
#define SDL_EncloseFPoints SDL_GetRectEnclosingPointsFloat
#define SDL_EnclosePoints SDL_GetRectEnclosingPoints
@@ -853,14 +845,6 @@
#define SDL_PIXELFORMAT_RGB888 SDL_PIXELFORMAT_RGB888_renamed_SDL_PIXELFORMAT_XRGB8888
#define SDL_PixelFormatEnumToMasks SDL_PixelFormatEnumToMasks_renamed_SDL_GetMasksForPixelFormatEnum
/* ##SDL_platform.h */
#ifdef __IOS__
#define __IPHONEOS__ __IPHONEOS___renamed___IOS__
#endif
#ifdef __MACOS__
#define __MACOSX__ __MACOSX___renamed___MACOS__
#endif
/* ##SDL_rect.h */
#define SDL_EncloseFPoints SDL_EncloseFPoints_renamed_SDL_GetRectEnclosingPointsFloat
#define SDL_EnclosePoints SDL_EnclosePoints_renamed_SDL_GetRectEnclosingPoints

View File

@@ -37,7 +37,7 @@
#include <SDL3/SDL_platform.h>
#ifndef __IOS__ /* No OpenGL on iOS. */
#ifndef SDL_PLATFORM_IOS /* No OpenGL on iOS. */
/*
* Mesa 3-D graphics library
@@ -77,11 +77,7 @@
* Begin system-specific stuff.
*/
#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__)
#define __WIN32__
#endif
#if defined(__WIN32__) && !defined(__CYGWIN__)
#if defined(_WIN32) && !defined(__CYGWIN__)
# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
# define GLAPI __declspec(dllexport)
# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
@@ -90,7 +86,7 @@
# define GLAPI extern
# endif /* _STATIC_MESA support */
# if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */
# define GLAPIENTRY
# define GLAPIENTRY
# else
# define GLAPIENTRY __stdcall
# endif
@@ -2118,6 +2114,6 @@ typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLsh
#endif /* __gl_h_ */
#endif /* !__IOS__ */
#endif /* !SDL_PLATFORM_IOS */
#endif /* SDL_opengl_h_ */

View File

@@ -26,7 +26,7 @@
*/
#include <SDL3/SDL_platform_defines.h>
#ifdef __IOS__
#ifdef SDL_PLATFORM_IOS
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#else

View File

@@ -28,7 +28,7 @@
#if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
#ifdef __IOS__
#ifdef SDL_PLATFORM_IOS
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#else

View File

@@ -29,48 +29,40 @@
#define SDL_platform_defines_h_
#ifdef _AIX
#undef __AIX__
#define __AIX__ 1
#define SDL_PLATFORM_AIX 1
#endif
#ifdef __HAIKU__
#undef __HAIKU__
#define __HAIKU__ 1
#define SDL_PLATFORM_HAIKU 1
#endif
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
#undef __BSDI__
#define __BSDI__ 1
#endif
#ifdef _arch_dreamcast
#undef __DREAMCAST__
#define __DREAMCAST__ 1
#define SDL_PLATFORM_BSDI 1
#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#undef __FREEBSD__
#define __FREEBSD__ 1
#define SDL_PLATFORM_FREEBSD 1
#endif
#if defined(hpux) || defined(__hpux) || defined(__hpux__)
#undef __HPUX__
#define __HPUX__ 1
#define SDL_PLATFORM_HPUX 1
#endif
#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
#undef __IRIX__
#define __IRIX__ 1
#define SDL_PLATFORM_IRIX 1
#endif
#if (defined(linux) || defined(__linux) || defined(__linux__))
#undef __LINUX__
#define __LINUX__ 1
#define SDL_PLATFORM_LINUX 1
#endif
#if defined(ANDROID) || defined(__ANDROID__)
#undef __ANDROID__
#undef __LINUX__ /* do we need to do this? */
#define __ANDROID__ 1
#undef SDL_PLATFORM_LINUX /* do we need to do this? */
#define SDL_PLATFORM_ANDROID 1
#endif
#ifdef __NGAGE__
#undef __NGAGE__
#define __NGAGE__ 1
#define SDL_PLATFORM_NGAGE 1
#endif
#if defined(__unix__) || defined(__unix) || defined(unix)
#define SDL_PLATFORM_UNIX 1
#endif
#ifdef __APPLE__
#define SDL_PLATFORM_APPLE 1
/* lets us know what version of macOS we're compiling on */
#include <AvailabilityMacros.h>
#include <TargetConditionals.h>
@@ -99,51 +91,48 @@
#endif
#if TARGET_OS_TV
#undef __TVOS__
#define __TVOS__ 1
#define SDL_PLATFORM_TVOS 1
#endif
#if TARGET_OS_IPHONE
#undef __IOS__
#define __IOS__ 1
#define SDL_PLATFORM_IOS 1
#else
#undef __MACOS__
#define __MACOS__ 1
#define SDL_PLATFORM_MACOS 1
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
# error SDL for macOS only supports deploying on 10.7 and above.
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1070 */
#endif /* TARGET_OS_IPHONE */
#endif /* defined(__APPLE__) */
#endif /* defined(SDL_PLATFORM_APPLE) */
#ifdef __EMSCRIPTEN__
#define SDL_PLATFORM_EMSCRIPTEN 1
#endif
#ifdef __NetBSD__
#undef __NETBSD__
#define __NETBSD__ 1
#define SDL_PLATFORM_NETBSD 1
#endif
#ifdef __OpenBSD__
#undef __OPENBSD__
#define __OPENBSD__ 1
#define SDL_PLATFORM_OPENBSD 1
#endif
#if defined(__OS2__) || defined(__EMX__)
#undef __OS2__
#define __OS2__ 1
#define SDL_PLATFORM_OS2 1
#endif
#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
#undef __OSF__
#define __OSF__ 1
#define SDL_PLATFORM_OSF 1
#endif
#ifdef __QNXNTO__
#undef __QNXNTO__
#define __QNXNTO__ 1
#define SDL_PLATFORM_QNXNTO 1
#endif
#if defined(riscos) || defined(__riscos) || defined(__riscos__)
#undef __RISCOS__
#define __RISCOS__ 1
#define SDL_PLATFORM_RISCOS 1
#endif
#if defined(__sun) && defined(__SVR4)
#undef __SOLARIS__
#define __SOLARIS__ 1
#define SDL_PLATFORM_SOLARIS 1
#endif
#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
#if defined(__CYGWIN__)
#define SDL_PLATFORM_CYGWIN 1
#endif
#if defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) || defined(__MINGW32__)
/* Try to find out if we're compiling for WinRT, GDK or non-WinRT/GDK */
#if defined(_MSC_VER) && defined(__has_include)
#if __has_include(<winapifamily.h>)
@@ -173,47 +162,39 @@
#endif
#if WINAPI_FAMILY_WINRT
#undef __WINRT__
#define __WINRT__ 1
#define SDL_PLATFORM_WINRT 1
#elif defined(_GAMING_DESKTOP) /* GDK project configuration always defines _GAMING_XXX */
#undef __WINGDK__
#define __WINGDK__ 1
#define SDL_PLATFORM_WINGDK 1
#elif defined(_GAMING_XBOX_XBOXONE)
#undef __XBOXONE__
#define __XBOXONE__ 1
#define SDL_PLATFORM_XBOXONE 1
#elif defined(_GAMING_XBOX_SCARLETT)
#undef __XBOXSERIES__
#define __XBOXSERIES__ 1
#define SDL_PLATFORM_XBOXSERIES 1
#else
#undef __WINDOWS__
#define __WINDOWS__ 1
#define SDL_PLATFORM_WINDOWS 1
#endif
#endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */
#endif /* defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) */
#ifdef __WINDOWS__
#undef __WIN32__
#define __WIN32__ 1
#ifdef SDL_PLATFORM_WINDOWS
#define SDL_PLATFORM_WIN32 1
#endif
/* This is to support generic "any GDK" separate from a platform-specific GDK */
#if defined(__WINGDK__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)
#undef __GDK__
#define __GDK__ 1
#if defined(SDL_PLATFORM_WINGDK) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
#define SDL_PLATFORM_GDK 1
#endif
#ifdef __PSP__
#undef __PSP__
#define __PSP__ 1
#define SDL_PLATFORM_PSP 1
#endif
#ifdef PS2
#define __PS2__ 1
#if defined(__PS2__) || defined(PS2)
#define SDL_PLATFORM_PS2 1
#endif
#ifdef __vita__
#define __VITA__ 1
#if defined(__vita__) || defined(__psp2__)
#define SDL_PLATFORM_VITA 1
#endif
#ifdef __3DS__
#undef __3DS__
#define __3DS__ 1
#define SDL_PLATFORM_3DS 1
#endif
#endif /* SDL_platform_defines_h_ */

View File

@@ -103,13 +103,13 @@ typedef struct SDL_RWops
SDL_PropertiesID props;
union
{
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
struct
{
void *asset;
} androidio;
#elif defined(__WIN32__) || defined(__GDK__) || defined(__WINRT__)
#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_WINRT)
struct
{
SDL_bool append;

View File

@@ -42,7 +42,7 @@
# ifndef alloca
# ifdef HAVE_ALLOCA_H
# include <alloca.h>
# elif defined(__NETBSD__)
# elif defined(SDL_PLATFORM_NETBSD)
# if defined(__STRICT_ANSI__)
# define SDL_DISABLE_ALLOCA
# else
@@ -59,7 +59,7 @@
# include <malloc.h>
# elif defined(__DMC__)
# include <stdlib.h>
# elif defined(__AIX__)
# elif defined(SDL_PLATFORM_AIX)
# pragma alloca
# elif defined(__MRC__)
void *alloca(unsigned);
@@ -207,9 +207,9 @@ typedef uint64_t Uint64;
#ifndef SDL_PRIs64
#ifdef PRIs64
#define SDL_PRIs64 PRIs64
#elif defined(__WIN32__) || defined(__GDK__)
#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#define SDL_PRIs64 "I64d"
#elif defined(__LP64__) && !defined(__APPLE__)
#elif defined(__LP64__) && !defined(SDL_PLATFORM_APPLE)
#define SDL_PRIs64 "ld"
#else
#define SDL_PRIs64 "lld"
@@ -218,9 +218,9 @@ typedef uint64_t Uint64;
#ifndef SDL_PRIu64
#ifdef PRIu64
#define SDL_PRIu64 PRIu64
#elif defined(__WIN32__) || defined(__GDK__)
#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#define SDL_PRIu64 "I64u"
#elif defined(__LP64__) && !defined(__APPLE__)
#elif defined(__LP64__) && !defined(SDL_PLATFORM_APPLE)
#define SDL_PRIu64 "lu"
#else
#define SDL_PRIu64 "llu"
@@ -229,9 +229,9 @@ typedef uint64_t Uint64;
#ifndef SDL_PRIx64
#ifdef PRIx64
#define SDL_PRIx64 PRIx64
#elif defined(__WIN32__) || defined(__GDK__)
#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#define SDL_PRIx64 "I64x"
#elif defined(__LP64__) && !defined(__APPLE__)
#elif defined(__LP64__) && !defined(SDL_PLATFORM_APPLE)
#define SDL_PRIx64 "lx"
#else
#define SDL_PRIx64 "llx"
@@ -240,9 +240,9 @@ typedef uint64_t Uint64;
#ifndef SDL_PRIX64
#ifdef PRIX64
#define SDL_PRIX64 PRIX64
#elif defined(__WIN32__) || defined(__GDK__)
#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
#define SDL_PRIX64 "I64X"
#elif defined(__LP64__) && !defined(__APPLE__)
#elif defined(__LP64__) && !defined(SDL_PLATFORM_APPLE)
#define SDL_PRIX64 "lX"
#else
#define SDL_PRIX64 "llX"
@@ -370,7 +370,7 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
/** \cond */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
#if !defined(__ANDROID__) && !defined(__VITA__) && !defined(__3DS__)
#if !defined(SDL_PLATFORM_ANDROID) && !defined(SDL_PLATFORM_VITA) && !defined(SDL_PLATFORM_3DS)
/* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
typedef enum
{

View File

@@ -43,7 +43,7 @@ extern "C" {
/*
* Platform specific functions for Windows
*/
#if defined(__WIN32__) || defined(__GDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
typedef struct tagMSG MSG;
typedef SDL_bool (SDLCALL *SDL_WindowsMessageHook)(void *userdata, MSG *msg);
@@ -62,9 +62,9 @@ typedef SDL_bool (SDLCALL *SDL_WindowsMessageHook)(void *userdata, MSG *msg);
*/
extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata);
#endif /* defined(__WIN32__) || defined(__GDK__) */
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) */
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
/**
* Get the D3D9 adapter index that matches the specified display.
@@ -80,9 +80,9 @@ extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook ca
*/
extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID);
#endif /* defined(__WIN32__) || defined(__WINGDK__) */
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
#if defined(__WIN32__) || defined(__WINGDK__)
#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
/**
* Get the DXGI Adapter and Output indices for the specified display.
@@ -101,7 +101,7 @@ extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID
*/
extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex);
#endif /* defined(__WIN32__) || defined(__WINGDK__) */
#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
/*
* Platform specific functions for UNIX
@@ -127,7 +127,7 @@ extern DECLSPEC void SDLCALL SDL_SetX11EventHook(SDL_X11EventHook callback, void
/*
* Platform specific functions for Linux
*/
#ifdef __LINUX__
#ifdef SDL_PLATFORM_LINUX
/**
* Sets the UNIX nice value for a thread.
@@ -158,12 +158,12 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int prio
*/
extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy);
#endif /* __LINUX__ */
#endif /* SDL_PLATFORM_LINUX */
/*
* Platform specific functions for iOS
*/
#ifdef __IOS__
#ifdef SDL_PLATFORM_IOS
#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
@@ -219,13 +219,13 @@ extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window,
*/
extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
#endif /* __IOS__ */
#endif /* SDL_PLATFORM_IOS */
/*
* Platform specific functions for Android
*/
#ifdef __ANDROID__
#ifdef SDL_PLATFORM_ANDROID
/**
* Get the Android Java Native Interface Environment of the current thread.
@@ -451,12 +451,12 @@ extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int durati
*/
extern DECLSPEC int SDLCALL SDL_AndroidSendMessage(Uint32 command, int param);
#endif /* __ANDROID__ */
#endif /* SDL_PLATFORM_ANDROID */
/*
* Platform specific functions for WinRT
*/
#ifdef __WINRT__
#ifdef SDL_PLATFORM_WINRT
/**
* WinRT / Windows Phone path types
@@ -556,7 +556,7 @@ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathT
*/
extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
#endif /* __WINRT__ */
#endif /* SDL_PLATFORM_WINRT */
/**
* Query if the current device is a tablet.
@@ -610,7 +610,7 @@ extern DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void);
*/
extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void);
#ifdef __IOS__
#ifdef SDL_PLATFORM_IOS
/*
* \since This function is available since SDL 3.0.0.
*/
@@ -620,7 +620,7 @@ extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void
/*
* Functions used only by GDK
*/
#ifdef __GDK__
#ifdef SDL_PLATFORM_GDK
typedef struct XTaskQueueObject *XTaskQueueHandle;
typedef struct XUser *XUserHandle;

View File

@@ -34,10 +34,10 @@
#include <SDL3/SDL.h>
#ifdef __PSP__
#ifdef SDL_PLATFORM_PSP
#define DEFAULT_WINDOW_WIDTH 480
#define DEFAULT_WINDOW_HEIGHT 272
#elif defined(__VITA__)
#elif defined(SDL_PLATFORM_VITA)
#define DEFAULT_WINDOW_WIDTH 960
#define DEFAULT_WINDOW_HEIGHT 544
#else

View File

@@ -35,7 +35,7 @@
#include <SDL3/SDL_atomic.h>
#include <SDL3/SDL_mutex.h>
#if (defined(__WIN32__) || defined(__GDK__)) && !defined(__WINRT__)
#if (defined(SDL_PLATFORM_WIN32) || defined(__GDK__)) && !defined(SDL_PLATFORM_WINRT)
#include <process.h> /* _beginthreadex() and _endthreadex() */
#endif
@@ -81,7 +81,7 @@ typedef enum {
typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
#if (defined(__WIN32__) || defined(__GDK__)) && !defined(__WINRT__)
#if (defined(SDL_PLATFORM_WIN32) || defined(__GDK__)) && !defined(__WINRT__)
/**
* \file SDL_thread.h
*