forked from Green-Sky/tomato
sdl (master post 3.1 preview) Merge commit 'e4f454091a943345938608570b104400f62fd625'
This commit is contained in:
99
external/sdl/SDL/include/SDL3/SDL_stdinc.h
vendored
99
external/sdl/SDL/include/SDL3/SDL_stdinc.h
vendored
@@ -35,13 +35,14 @@
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#ifndef SDL_DISABLE_ALLOCA
|
||||
# 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
|
||||
@@ -58,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);
|
||||
@@ -185,6 +186,16 @@ typedef int64_t Sint64;
|
||||
#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */
|
||||
typedef uint64_t Uint64;
|
||||
|
||||
/**
|
||||
* SDL times are signed, 64-bit integers representing nanoseconds since the Unix epoch (Jan 1, 1970)
|
||||
*
|
||||
* They can be converted between POSIX time_t values with SDL_NS_TO_SECONDS() and SDL_SECONDS_TO_NS(),
|
||||
* and between Windows FILETIME values with SDL_TimeToWindows() and SDL_TimeFromWindows().
|
||||
*/
|
||||
#define SDL_MAX_TIME SDL_MAX_SINT64
|
||||
#define SDL_MIN_TIME SDL_MIN_SINT64
|
||||
typedef Sint64 SDL_Time;
|
||||
|
||||
/* @} *//* Basic data types */
|
||||
|
||||
/**
|
||||
@@ -206,9 +217,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"
|
||||
@@ -217,9 +228,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"
|
||||
@@ -228,9 +239,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"
|
||||
@@ -239,9 +250,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"
|
||||
@@ -369,7 +380,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
|
||||
{
|
||||
@@ -497,6 +508,9 @@ extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int
|
||||
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (const void *, const void *));
|
||||
extern DECLSPEC void * SDLCALL SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (const void *, const void *));
|
||||
|
||||
extern DECLSPEC void SDLCALL SDL_qsort_r(void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (void *, const void *, const void *), void *userdata);
|
||||
extern DECLSPEC void * SDLCALL SDL_bsearch_r(const void *key, const void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (void *, const void *, const void *), void *userdata);
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_abs(int x);
|
||||
|
||||
/* NOTE: these double-evaluate their arguments, so you should never have side effects in the parameters */
|
||||
@@ -522,22 +536,45 @@ extern DECLSPEC int SDLCALL SDL_tolower(int x);
|
||||
extern DECLSPEC Uint16 SDLCALL SDL_crc16(Uint16 crc, const void *data, size_t len);
|
||||
extern DECLSPEC Uint32 SDLCALL SDL_crc32(Uint32 crc, const void *data, size_t len);
|
||||
|
||||
extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
|
||||
|
||||
/* Take advantage of compiler optimizations for memcpy */
|
||||
#ifndef SDL_SLOW_MEMCPY
|
||||
#ifdef SDL_memcpy
|
||||
#undef SDL_memcpy
|
||||
#endif
|
||||
#define SDL_memcpy memcpy
|
||||
#endif
|
||||
|
||||
#define SDL_copyp(dst, src) \
|
||||
{ SDL_COMPILE_TIME_ASSERT(SDL_copyp, sizeof (*(dst)) == sizeof (*(src))); } \
|
||||
SDL_memcpy((dst), (src), sizeof(*(src)))
|
||||
|
||||
extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
|
||||
|
||||
/* Take advantage of compiler optimizations for memmove */
|
||||
#ifndef SDL_SLOW_MEMMOVE
|
||||
#ifdef SDL_memmove
|
||||
#undef SDL_memmove
|
||||
#endif
|
||||
#define SDL_memmove memmove
|
||||
#endif
|
||||
|
||||
extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
|
||||
extern DECLSPEC void *SDLCALL SDL_memset4(void *dst, Uint32 val, size_t dwords);
|
||||
|
||||
/* Take advantage of compiler optimizations for memset */
|
||||
#ifndef SDL_SLOW_MEMSET
|
||||
#ifdef SDL_memset
|
||||
#undef SDL_memset
|
||||
#endif
|
||||
#define SDL_memset memset
|
||||
#endif
|
||||
|
||||
#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
|
||||
#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
|
||||
#define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x)))
|
||||
|
||||
#define SDL_copyp(dst, src) \
|
||||
{ SDL_COMPILE_TIME_ASSERT(SDL_copyp, sizeof (*(dst)) == sizeof (*(src))); } \
|
||||
SDL_memcpy((dst), (src), sizeof (*(src)))
|
||||
|
||||
|
||||
|
||||
extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
|
||||
|
||||
extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len);
|
||||
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
|
||||
|
||||
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
|
||||
@@ -703,36 +740,41 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
|
||||
#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
|
||||
|
||||
/* The analyzer knows about strlcpy even when the system doesn't provide it */
|
||||
#ifndef HAVE_STRLCPY
|
||||
#if !defined(HAVE_STRLCPY) && !defined(strlcpy)
|
||||
size_t strlcpy(char* dst, const char* src, size_t size);
|
||||
#endif
|
||||
|
||||
/* The analyzer knows about strlcat even when the system doesn't provide it */
|
||||
#ifndef HAVE_STRLCAT
|
||||
#if !defined(HAVE_STRLCAT) && !defined(strlcat)
|
||||
size_t strlcat(char* dst, const char* src, size_t size);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WCSLCPY
|
||||
#if !defined(HAVE_WCSLCPY) && !defined(wcslcpy)
|
||||
size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t size);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WCSLCAT
|
||||
#if !defined(HAVE_WCSLCAT) && !defined(wcslcat)
|
||||
size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size);
|
||||
#endif
|
||||
|
||||
/* Starting LLVM 16, the analyser errors out if these functions do not have
|
||||
their prototype defined (clang-diagnostic-implicit-function-declaration) */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define SDL_malloc malloc
|
||||
#define SDL_calloc calloc
|
||||
#define SDL_realloc realloc
|
||||
#define SDL_free free
|
||||
#define SDL_memset memset
|
||||
#ifndef SDL_memcpy
|
||||
#define SDL_memcpy memcpy
|
||||
#endif
|
||||
#ifndef SDL_memmove
|
||||
#define SDL_memmove memmove
|
||||
#endif
|
||||
#ifndef SDL_memset
|
||||
#define SDL_memset memset
|
||||
#endif
|
||||
#define SDL_memcmp memcmp
|
||||
#define SDL_strlcpy strlcpy
|
||||
#define SDL_strlcat strlcat
|
||||
@@ -759,11 +801,6 @@ size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size);
|
||||
#define SDL_vsnprintf vsnprintf
|
||||
#endif
|
||||
|
||||
SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_BYTECAP(dwords*4) const void *src, size_t dwords)
|
||||
{
|
||||
return SDL_memcpy(dst, src, dwords * 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* If a * b would overflow, return -1. Otherwise store a * b via ret
|
||||
* and return 0.
|
||||
|
||||
Reference in New Issue
Block a user