forked from draconisPW/PWMAngband
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
107 changed files
with
18,884 additions
and
5,943 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2021 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2023 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
@@ -41,7 +41,9 @@ | |
#include "SDL_events.h" | ||
#include "SDL_filesystem.h" | ||
#include "SDL_gamecontroller.h" | ||
#include "SDL_guid.h" | ||
#include "SDL_haptic.h" | ||
#include "SDL_hidapi.h" | ||
#include "SDL_hints.h" | ||
#include "SDL_joystick.h" | ||
#include "SDL_loadso.h" | ||
|
@@ -132,6 +134,8 @@ extern "C" { | |
* \returns 0 on success or a negative error code on failure; call | ||
* SDL_GetError() for more information. | ||
* | ||
* \since This function is available since SDL 2.0.0. | ||
* | ||
* \sa SDL_InitSubSystem | ||
* \sa SDL_Quit | ||
* \sa SDL_SetMainReady | ||
|
@@ -148,6 +152,8 @@ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); | |
* \returns 0 on success or a negative error code on failure; call | ||
* SDL_GetError() for more information. | ||
* | ||
* \since This function is available since SDL 2.0.0. | ||
* | ||
* \sa SDL_Init | ||
* \sa SDL_Quit | ||
* \sa SDL_QuitSubSystem | ||
|
@@ -169,6 +175,8 @@ extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags); | |
* | ||
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details. | ||
* | ||
* \since This function is available since SDL 2.0.0. | ||
* | ||
* \sa SDL_InitSubSystem | ||
* \sa SDL_Quit | ||
*/ | ||
|
@@ -183,6 +191,8 @@ extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags); | |
* | ||
* The return value does not include SDL_INIT_NOPARACHUTE. | ||
* | ||
* \since This function is available since SDL 2.0.0. | ||
* | ||
* \sa SDL_Init | ||
* \sa SDL_InitSubSystem | ||
*/ | ||
|
@@ -205,6 +215,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags); | |
* application is shutdown, but it is not wise to do this from a library or | ||
* other dynamically loaded code. | ||
* | ||
* \since This function is available since SDL 2.0.0. | ||
* | ||
* \sa SDL_Init | ||
* \sa SDL_QuitSubSystem | ||
*/ | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2021 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2023 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
@@ -22,7 +22,7 @@ | |
#ifndef SDL_assert_h_ | ||
#define SDL_assert_h_ | ||
|
||
#include "SDL_config.h" | ||
#include "SDL_stdinc.h" | ||
|
||
#include "begin_code.h" | ||
/* Set up for C function definitions, even when using C++ */ | ||
|
@@ -51,6 +51,8 @@ assert can have unique static variables associated with it. | |
/* Don't include intrin.h here because it contains C++ code */ | ||
extern void __cdecl __debugbreak(void); | ||
#define SDL_TriggerBreakpoint() __debugbreak() | ||
#elif _SDL_HAS_BUILTIN(__builtin_debugtrap) | ||
#define SDL_TriggerBreakpoint() __builtin_debugtrap() | ||
#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) ) | ||
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) | ||
#elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */ | ||
|
@@ -69,7 +71,7 @@ assert can have unique static variables associated with it. | |
|
||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */ | ||
# define SDL_FUNCTION __func__ | ||
#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__)) | ||
#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined (__WATCOMC__)) | ||
# define SDL_FUNCTION __FUNCTION__ | ||
#else | ||
# define SDL_FUNCTION "???" | ||
|
@@ -123,12 +125,10 @@ typedef struct SDL_AssertData | |
const struct SDL_AssertData *next; | ||
} SDL_AssertData; | ||
|
||
#if (SDL_ASSERT_LEVEL > 0) | ||
|
||
/* Never call this directly. Use the SDL_assert* macros. */ | ||
extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *, | ||
const char *, | ||
const char *, int) | ||
const char *, | ||
const char *, int) | ||
#if defined(__clang__) | ||
#if __has_feature(attribute_analyzer_noreturn) | ||
/* this tells Clang's static analysis that we're a custom assert function, | ||
|
@@ -149,9 +149,7 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *, | |
#define SDL_enabled_assert(condition) \ | ||
do { \ | ||
while ( !(condition) ) { \ | ||
static struct SDL_AssertData sdl_assert_data = { \ | ||
0, 0, #condition, 0, 0, 0, 0 \ | ||
}; \ | ||
static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \ | ||
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \ | ||
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \ | ||
continue; /* go again. */ \ | ||
|
@@ -162,8 +160,6 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *, | |
} \ | ||
} while (SDL_NULL_WHILE_LOOP_CONDITION) | ||
|
||
#endif /* enabled assertions support code */ | ||
|
||
/* Enable various levels of assertions. */ | ||
#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */ | ||
# define SDL_assert(condition) SDL_disabled_assert(condition) | ||
|
@@ -217,6 +213,8 @@ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)( | |
* fails or NULL for the default handler | ||
* \param userdata a pointer that is passed to `handler` | ||
* | ||
* \since This function is available since SDL 2.0.0. | ||
* | ||
* \sa SDL_GetAssertionHandler | ||
*/ | ||
extern DECLSPEC void SDLCALL SDL_SetAssertionHandler( | ||
|
@@ -285,6 +283,8 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse | |
* \returns a list of all failed assertions or NULL if the list is empty. This | ||
* memory should not be modified or freed by the application. | ||
* | ||
* \since This function is available since SDL 2.0.0. | ||
* | ||
* \sa SDL_ResetAssertionReport | ||
*/ | ||
extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void); | ||
|
@@ -297,6 +297,8 @@ extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void); | |
* no items. In addition, any previously-triggered assertions will be reset to | ||
* a trigger_count of zero, and their always_ignore state will be false. | ||
* | ||
* \since This function is available since SDL 2.0.0. | ||
* | ||
* \sa SDL_GetAssertionReport | ||
*/ | ||
extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
Simple DirectMedia Layer | ||
Copyright (C) 1997-2021 Sam Lantinga <[email protected]> | ||
Copyright (C) 1997-2023 Sam Lantinga <[email protected]> | ||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
|
@@ -98,6 +98,8 @@ typedef int SDL_SpinLock; | |
* \returns SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already | ||
* held. | ||
* | ||
* \since This function is available since SDL 2.0.0. | ||
* | ||
* \sa SDL_AtomicLock | ||
* \sa SDL_AtomicUnlock | ||
*/ | ||
|
@@ -111,6 +113,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock); | |
* | ||
* \param lock a pointer to a lock variable | ||
* | ||
* \since This function is available since SDL 2.0.0. | ||
* | ||
* \sa SDL_AtomicTryLock | ||
* \sa SDL_AtomicUnlock | ||
*/ | ||
|
@@ -148,7 +152,7 @@ void _ReadWriteBarrier(void); | |
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */ | ||
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory") | ||
#elif defined(__WATCOMC__) | ||
extern _inline void SDL_CompilerBarrier (void); | ||
extern __inline void SDL_CompilerBarrier(void); | ||
#pragma aux SDL_CompilerBarrier = "" parm [] modify exact []; | ||
#else | ||
#define SDL_CompilerBarrier() \ | ||
|
@@ -173,6 +177,8 @@ extern _inline void SDL_CompilerBarrier (void); | |
* | ||
* For more information on these semantics, take a look at the blog post: | ||
* http://preshing.com/20120913/acquire-and-release-semantics | ||
* | ||
* \since This function is available since SDL 2.0.6. | ||
*/ | ||
extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void); | ||
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); | ||
|
@@ -231,6 +237,26 @@ typedef void (*SDL_KernelMemoryBarrierFunc)(); | |
#endif | ||
#endif | ||
|
||
/* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */ | ||
#if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) | ||
#define SDL_CPUPauseInstruction() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */ | ||
#elif (defined(__arm__) && __ARM_ARCH >= 7) || defined(__aarch64__) | ||
#define SDL_CPUPauseInstruction() __asm__ __volatile__("yield" ::: "memory") | ||
#elif (defined(__powerpc__) || defined(__powerpc64__)) | ||
#define SDL_CPUPauseInstruction() __asm__ __volatile__("or 27,27,27"); | ||
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) | ||
#define SDL_CPUPauseInstruction() _mm_pause() /* this is actually "rep nop" and not a SIMD instruction. No inline asm in MSVC x86-64! */ | ||
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64)) | ||
#define SDL_CPUPauseInstruction() __yield() | ||
#elif defined(__WATCOMC__) && defined(__386__) | ||
/* watcom assembler rejects PAUSE if CPU < i686, and it refuses REP NOP as an invalid combination. Hardcode the bytes. */ | ||
extern __inline void SDL_CPUPauseInstruction(void); | ||
#pragma aux SDL_CPUPauseInstruction = "db 0f3h,90h" | ||
#else | ||
#define SDL_CPUPauseInstruction() | ||
#endif | ||
|
||
|
||
/** | ||
* \brief A type representing an atomic integer value. It is a struct | ||
* so people don't accidentally use numeric operations on it. | ||
|
@@ -268,6 +294,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int | |
* \param v the desired value | ||
* \returns the previous value of the atomic variable. | ||
* | ||
* \since This function is available since SDL 2.0.2. | ||
* | ||
* \sa SDL_AtomicGet | ||
*/ | ||
extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v); | ||
|
@@ -281,6 +309,8 @@ extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v); | |
* \param a a pointer to an SDL_atomic_t variable | ||
* \returns the current value of an atomic variable. | ||
* | ||
* \since This function is available since SDL 2.0.2. | ||
* | ||
* \sa SDL_AtomicSet | ||
*/ | ||
extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a); | ||
|
@@ -297,6 +327,8 @@ extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a); | |
* \param v the desired value to add | ||
* \returns the previous value of the atomic variable. | ||
* | ||
* \since This function is available since SDL 2.0.2. | ||
* | ||
* \sa SDL_AtomicDecRef | ||
* \sa SDL_AtomicIncRef | ||
*/ | ||
|
@@ -348,6 +380,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void * | |
* \param v the desired pointer value | ||
* \returns the previous value of the pointer. | ||
* | ||
* \since This function is available since SDL 2.0.2. | ||
* | ||
* \sa SDL_AtomicCASPtr | ||
* \sa SDL_AtomicGetPtr | ||
*/ | ||
|
@@ -362,6 +396,8 @@ extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v); | |
* \param a a pointer to a pointer | ||
* \returns the current value of a pointer. | ||
* | ||
* \since This function is available since SDL 2.0.2. | ||
* | ||
* \sa SDL_AtomicCASPtr | ||
* \sa SDL_AtomicSetPtr | ||
*/ | ||
|
Oops, something went wrong.