forked from Green-Sky/tomato
Merge commit '852f2a6343518919e5ca8d3c1bbcab9f493e3cd8'
This commit is contained in:
96
external/sdl/SDL/include/SDL3/SDL_stdinc.h
vendored
96
external/sdl/SDL/include/SDL3/SDL_stdinc.h
vendored
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
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 @@
|
||||
/**
|
||||
* \file SDL_stdinc.h
|
||||
*
|
||||
* \brief This is a general header that includes C language support.
|
||||
* This is a general header that includes C language support.
|
||||
*/
|
||||
|
||||
#ifndef SDL_stdinc_h_
|
||||
@ -37,26 +37,34 @@
|
||||
#include <stdint.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#ifndef alloca
|
||||
# ifdef HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
# elif defined(__GNUC__)
|
||||
# define alloca __builtin_alloca
|
||||
# elif defined(_MSC_VER)
|
||||
# include <malloc.h>
|
||||
# define alloca _alloca
|
||||
# elif defined(__WATCOMC__)
|
||||
# include <malloc.h>
|
||||
# elif defined(__BORLANDC__)
|
||||
# include <malloc.h>
|
||||
# elif defined(__DMC__)
|
||||
# include <stdlib.h>
|
||||
# elif defined(__AIX__)
|
||||
#pragma alloca
|
||||
# elif defined(__MRC__)
|
||||
#ifndef SDL_DISABLE_ALLOCA
|
||||
# ifndef alloca
|
||||
# ifdef HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
# elif defined(__NETBSD__)
|
||||
# if defined(__STRICT_ANSI__)
|
||||
# define SDL_DISABLE_ALLOCA
|
||||
# else
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
# elif defined(__GNUC__)
|
||||
# define alloca __builtin_alloca
|
||||
# elif defined(_MSC_VER)
|
||||
# include <malloc.h>
|
||||
# define alloca _alloca
|
||||
# elif defined(__WATCOMC__)
|
||||
# include <malloc.h>
|
||||
# elif defined(__BORLANDC__)
|
||||
# include <malloc.h>
|
||||
# elif defined(__DMC__)
|
||||
# include <stdlib.h>
|
||||
# elif defined(__AIX__)
|
||||
# pragma alloca
|
||||
# elif defined(__MRC__)
|
||||
void *alloca(unsigned);
|
||||
# else
|
||||
# else
|
||||
char *alloca();
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -120,64 +128,58 @@ char *alloca();
|
||||
*/
|
||||
/* @{ */
|
||||
|
||||
#ifdef __CC_ARM
|
||||
/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */
|
||||
/**
|
||||
* A boolean type.
|
||||
*/
|
||||
#define SDL_FALSE 0
|
||||
#define SDL_TRUE 1
|
||||
typedef int SDL_bool;
|
||||
#else
|
||||
typedef enum
|
||||
{
|
||||
SDL_FALSE = 0,
|
||||
SDL_TRUE = 1
|
||||
} SDL_bool;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief A signed 8-bit integer type.
|
||||
* A signed 8-bit integer type.
|
||||
*/
|
||||
#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */
|
||||
#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */
|
||||
typedef int8_t Sint8;
|
||||
/**
|
||||
* \brief An unsigned 8-bit integer type.
|
||||
* An unsigned 8-bit integer type.
|
||||
*/
|
||||
#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */
|
||||
#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */
|
||||
typedef uint8_t Uint8;
|
||||
/**
|
||||
* \brief A signed 16-bit integer type.
|
||||
* A signed 16-bit integer type.
|
||||
*/
|
||||
#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */
|
||||
#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */
|
||||
typedef int16_t Sint16;
|
||||
/**
|
||||
* \brief An unsigned 16-bit integer type.
|
||||
* An unsigned 16-bit integer type.
|
||||
*/
|
||||
#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */
|
||||
#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */
|
||||
typedef uint16_t Uint16;
|
||||
/**
|
||||
* \brief A signed 32-bit integer type.
|
||||
* A signed 32-bit integer type.
|
||||
*/
|
||||
#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */
|
||||
#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */
|
||||
typedef int32_t Sint32;
|
||||
/**
|
||||
* \brief An unsigned 32-bit integer type.
|
||||
* An unsigned 32-bit integer type.
|
||||
*/
|
||||
#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */
|
||||
#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */
|
||||
typedef uint32_t Uint32;
|
||||
|
||||
/**
|
||||
* \brief A signed 64-bit integer type.
|
||||
* A signed 64-bit integer type.
|
||||
*/
|
||||
#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */
|
||||
#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */
|
||||
typedef int64_t Sint64;
|
||||
/**
|
||||
* \brief An unsigned 64-bit integer type.
|
||||
* An unsigned 64-bit integer type.
|
||||
*/
|
||||
#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */
|
||||
#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */
|
||||
@ -285,7 +287,9 @@ typedef uint64_t Uint64;
|
||||
#define SDL_PRINTF_FORMAT_STRING
|
||||
#define SDL_SCANF_FORMAT_STRING
|
||||
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
|
||||
#define SDL_PRINTF_VARARG_FUNCV( fmtargnumber )
|
||||
#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
|
||||
#define SDL_SCANF_VARARG_FUNCV( fmtargnumber )
|
||||
#define SDL_WPRINTF_VARARG_FUNC( fmtargnumber )
|
||||
#define SDL_WSCANF_VARARG_FUNC( fmtargnumber )
|
||||
#else
|
||||
@ -313,12 +317,16 @@ typedef uint64_t Uint64;
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 )))
|
||||
#define SDL_PRINTF_VARARG_FUNCV( fmtargnumber ) __attribute__(( format( __printf__, fmtargnumber, 0 )))
|
||||
#define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 )))
|
||||
#define SDL_SCANF_VARARG_FUNCV( fmtargnumber ) __attribute__(( format( __scanf__, fmtargnumber, 0 )))
|
||||
#define SDL_WPRINTF_VARARG_FUNC( fmtargnumber ) /* __attribute__ (( format( __wprintf__, fmtargnumber, fmtargnumber+1 ))) */
|
||||
#define SDL_WSCANF_VARARG_FUNC( fmtargnumber ) /* __attribute__ (( format( __wscanf__, fmtargnumber, fmtargnumber+1 ))) */
|
||||
#else
|
||||
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
|
||||
#define SDL_PRINTF_VARARG_FUNCV( fmtargnumber )
|
||||
#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
|
||||
#define SDL_SCANF_VARARG_FUNCV( fmtargnumber )
|
||||
#define SDL_WPRINTF_VARARG_FUNC( fmtargnumber )
|
||||
#define SDL_WSCANF_VARARG_FUNC( fmtargnumber )
|
||||
#endif
|
||||
@ -379,7 +387,7 @@ SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ALLOCA
|
||||
#ifndef SDL_DISABLE_ALLOCA
|
||||
#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count))
|
||||
#define SDL_stack_free(data)
|
||||
#else
|
||||
@ -538,6 +546,7 @@ extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, c
|
||||
extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
|
||||
extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr);
|
||||
extern DECLSPEC wchar_t *SDLCALL SDL_wcsstr(const wchar_t *haystack, const wchar_t *needle);
|
||||
extern DECLSPEC wchar_t *SDLCALL SDL_wcsnstr(const wchar_t *haystack, const wchar_t *needle, size_t maxlen);
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
|
||||
extern DECLSPEC int SDLCALL SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen);
|
||||
@ -558,6 +567,7 @@ extern DECLSPEC char *SDLCALL SDL_strlwr(char *str);
|
||||
extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
|
||||
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
|
||||
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
|
||||
extern DECLSPEC char *SDLCALL SDL_strnstr(const char *haystack, const char *needle, size_t maxlen);
|
||||
extern DECLSPEC char *SDLCALL SDL_strcasestr(const char *haystack, const char *needle);
|
||||
extern DECLSPEC char *SDLCALL SDL_strtok_r(char *s1, const char *s2, char **saveptr);
|
||||
extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
|
||||
@ -584,13 +594,13 @@ extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
|
||||
extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len);
|
||||
|
||||
extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...) SDL_SCANF_VARARG_FUNC(2);
|
||||
extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap);
|
||||
extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, va_list ap) SDL_SCANF_VARARG_FUNCV(2);
|
||||
extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3);
|
||||
extern DECLSPEC int SDLCALL SDL_swprintf(SDL_OUT_Z_CAP(maxlen) wchar_t *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const wchar_t *fmt, ... ) SDL_WPRINTF_VARARG_FUNC(3);
|
||||
extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap);
|
||||
extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3);
|
||||
extern DECLSPEC int SDLCALL SDL_vswprintf(SDL_OUT_Z_CAP(maxlen) wchar_t *text, size_t maxlen, const wchar_t *fmt, va_list ap);
|
||||
extern DECLSPEC int SDLCALL SDL_asprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
|
||||
extern DECLSPEC int SDLCALL SDL_vasprintf(char **strp, const char *fmt, va_list ap);
|
||||
extern DECLSPEC int SDLCALL SDL_vasprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(2);
|
||||
|
||||
#ifndef SDL_PI_D
|
||||
#define SDL_PI_D 3.141592653589793238462643383279502884 /**< pi (double) */
|
||||
@ -684,8 +694,8 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
|
||||
const char *inbuf,
|
||||
size_t inbytesleft);
|
||||
#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
|
||||
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
|
||||
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
|
||||
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1)
|
||||
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1)
|
||||
#define SDL_iconv_wchar_utf8(S) SDL_iconv_string("UTF-8", "WCHAR_T", (char *)S, (SDL_wcslen(S)+1)*sizeof(wchar_t))
|
||||
|
||||
/* force builds using Clang's static analysis tools to use literal C runtime
|
||||
|
Reference in New Issue
Block a user