2015-06-21 15:33:46 +00:00
|
|
|
/*
|
|
|
|
Simple DirectMedia Layer
|
2021-01-02 18:25:38 +00:00
|
|
|
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
2015-06-21 15:33:46 +00:00
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied
|
|
|
|
warranty. In no event will the authors be held liable for any damages
|
|
|
|
arising from the use of this software.
|
|
|
|
|
|
|
|
Permission is granted to anyone to use this software for any purpose,
|
|
|
|
including commercial applications, and to alter it and redistribute it
|
|
|
|
freely, subject to the following restrictions:
|
|
|
|
|
|
|
|
1. The origin of this software must not be misrepresented; you must not
|
|
|
|
claim that you wrote the original software. If you use this software
|
|
|
|
in a product, an acknowledgment in the product documentation would be
|
|
|
|
appreciated but is not required.
|
|
|
|
2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
misrepresented as being the original software.
|
|
|
|
3. This notice may not be removed or altered from any source distribution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \file SDL_stdinc.h
|
|
|
|
*
|
|
|
|
* This is a general header that includes C language support.
|
|
|
|
*/
|
|
|
|
|
2016-11-21 05:34:54 +00:00
|
|
|
#ifndef SDL_stdinc_h_
|
|
|
|
#define SDL_stdinc_h_
|
2015-06-21 15:33:46 +00:00
|
|
|
|
|
|
|
#include "SDL_config.h"
|
|
|
|
|
2020-10-29 17:00:20 +00:00
|
|
|
#ifdef __APPLE__
|
2020-12-12 20:28:10 +00:00
|
|
|
#ifndef _DARWIN_C_SOURCE
|
|
|
|
#define _DARWIN_C_SOURCE 1 /* for memset_pattern4() */
|
|
|
|
#endif
|
2020-10-29 17:00:20 +00:00
|
|
|
#endif
|
|
|
|
|
2015-06-21 15:33:46 +00:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STDIO_H
|
|
|
|
#include <stdio.h>
|
|
|
|
#endif
|
|
|
|
#if defined(STDC_HEADERS)
|
|
|
|
# include <stdlib.h>
|
|
|
|
# include <stddef.h>
|
|
|
|
# include <stdarg.h>
|
|
|
|
#else
|
|
|
|
# if defined(HAVE_STDLIB_H)
|
|
|
|
# include <stdlib.h>
|
|
|
|
# elif defined(HAVE_MALLOC_H)
|
|
|
|
# include <malloc.h>
|
|
|
|
# endif
|
|
|
|
# if defined(HAVE_STDDEF_H)
|
|
|
|
# include <stddef.h>
|
|
|
|
# endif
|
|
|
|
# if defined(HAVE_STDARG_H)
|
|
|
|
# include <stdarg.h>
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
|
|
|
|
# include <memory.h>
|
|
|
|
# endif
|
|
|
|
# include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
2017-08-14 05:26:44 +00:00
|
|
|
#ifdef HAVE_WCHAR_H
|
|
|
|
# include <wchar.h>
|
|
|
|
#endif
|
2015-06-21 15:33:46 +00:00
|
|
|
#if defined(HAVE_INTTYPES_H)
|
|
|
|
# include <inttypes.h>
|
|
|
|
#elif defined(HAVE_STDINT_H)
|
|
|
|
# include <stdint.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_CTYPE_H
|
|
|
|
# include <ctype.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_MATH_H
|
|
|
|
# if defined(__WINRT__)
|
|
|
|
/* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on
|
|
|
|
WinRT. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
|
|
|
|
for more information.
|
|
|
|
*/
|
|
|
|
# define _USE_MATH_DEFINES
|
|
|
|
# endif
|
|
|
|
# include <math.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_FLOAT_H
|
|
|
|
# include <float.h>
|
|
|
|
#endif
|
2018-05-10 05:28:00 +00:00
|
|
|
#if defined(HAVE_ALLOCA) && !defined(alloca)
|
|
|
|
# if defined(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__)
|
|
|
|
void *alloca(unsigned);
|
|
|
|
# else
|
|
|
|
char *alloca();
|
|
|
|
# endif
|
|
|
|
#endif
|
2015-06-21 15:33:46 +00:00
|
|
|
|
2021-08-12 20:36:49 +00:00
|
|
|
/**
|
|
|
|
* Check if the compiler supports a given builtin.
|
|
|
|
* Supported by virtually all clang versions and recent gcc. Use this
|
|
|
|
* instead of checking the clang version if possible.
|
|
|
|
*/
|
|
|
|
#ifdef __has_builtin
|
|
|
|
#define _SDL_HAS_BUILTIN(x) __has_builtin(x)
|
|
|
|
#else
|
|
|
|
#define _SDL_HAS_BUILTIN(x) 0
|
|
|
|
#endif
|
|
|
|
|
2015-06-21 15:33:46 +00:00
|
|
|
/**
|
|
|
|
* The number of elements in an array.
|
|
|
|
*/
|
|
|
|
#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
|
|
|
|
#define SDL_TABLESIZE(table) SDL_arraysize(table)
|
|
|
|
|
2016-10-01 17:28:00 +00:00
|
|
|
/**
|
|
|
|
* Macro useful for building other macros with strings in them
|
|
|
|
*
|
|
|
|
* e.g. #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n")
|
|
|
|
*/
|
|
|
|
#define SDL_STRINGIFY_ARG(arg) #arg
|
|
|
|
|
2015-06-21 15:33:46 +00:00
|
|
|
/**
|
|
|
|
* \name Cast operators
|
|
|
|
*
|
|
|
|
* Use proper C++ casts when compiled as C++ to be compatible with the option
|
|
|
|
* -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above).
|
|
|
|
*/
|
|
|
|
/* @{ */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
|
|
|
|
#define SDL_static_cast(type, expression) static_cast<type>(expression)
|
|
|
|
#define SDL_const_cast(type, expression) const_cast<type>(expression)
|
|
|
|
#else
|
|
|
|
#define SDL_reinterpret_cast(type, expression) ((type)(expression))
|
|
|
|
#define SDL_static_cast(type, expression) ((type)(expression))
|
|
|
|
#define SDL_const_cast(type, expression) ((type)(expression))
|
|
|
|
#endif
|
|
|
|
/* @} *//* Cast operators */
|
|
|
|
|
|
|
|
/* Define a four character code as a Uint32 */
|
|
|
|
#define SDL_FOURCC(A, B, C, D) \
|
|
|
|
((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \
|
|
|
|
(SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \
|
|
|
|
(SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \
|
|
|
|
(SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \name Basic data types
|
|
|
|
*/
|
|
|
|
/* @{ */
|
|
|
|
|
2017-03-03 21:38:17 +00:00
|
|
|
#ifdef __CC_ARM
|
|
|
|
/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */
|
|
|
|
#define SDL_FALSE 0
|
|
|
|
#define SDL_TRUE 1
|
|
|
|
typedef int SDL_bool;
|
|
|
|
#else
|
2015-06-21 15:33:46 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
SDL_FALSE = 0,
|
|
|
|
SDL_TRUE = 1
|
|
|
|
} SDL_bool;
|
2017-03-03 21:38:17 +00:00
|
|
|
#endif
|
2015-06-21 15:33:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief A signed 8-bit integer type.
|
|
|
|
*/
|
2017-10-16 21:39:56 +00:00
|
|
|
#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */
|
|
|
|
#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */
|
2015-06-21 15:33:46 +00:00
|
|
|
typedef int8_t Sint8;
|
|
|
|
/**
|
|
|
|
* \brief An unsigned 8-bit integer type.
|
|
|
|
*/
|
2017-10-16 21:39:56 +00:00
|
|
|
#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */
|
|
|
|
#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */
|
2015-06-21 15:33:46 +00:00
|
|
|
typedef uint8_t Uint8;
|
|
|
|
/**
|
|
|
|
* \brief A signed 16-bit integer type.
|
|
|
|
*/
|
2017-10-16 21:39:56 +00:00
|
|
|
#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */
|
|
|
|
#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */
|
2015-06-21 15:33:46 +00:00
|
|
|
typedef int16_t Sint16;
|
|
|
|
/**
|
|
|
|
* \brief An unsigned 16-bit integer type.
|
|
|
|
*/
|
2017-10-16 21:39:56 +00:00
|
|
|
#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */
|
|
|
|
#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */
|
2015-06-21 15:33:46 +00:00
|
|
|
typedef uint16_t Uint16;
|
|
|
|
/**
|
|
|
|
* \brief A signed 32-bit integer type.
|
|
|
|
*/
|
2017-10-16 21:39:56 +00:00
|
|
|
#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */
|
|
|
|
#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */
|
2015-06-21 15:33:46 +00:00
|
|
|
typedef int32_t Sint32;
|
|
|
|
/**
|
|
|
|
* \brief An unsigned 32-bit integer type.
|
|
|
|
*/
|
2017-10-16 21:39:56 +00:00
|
|
|
#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */
|
|
|
|
#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */
|
2015-06-21 15:33:46 +00:00
|
|
|
typedef uint32_t Uint32;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief A signed 64-bit integer type.
|
|
|
|
*/
|
2017-10-16 21:39:56 +00:00
|
|
|
#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */
|
|
|
|
#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */
|
2015-06-21 15:33:46 +00:00
|
|
|
typedef int64_t Sint64;
|
|
|
|
/**
|
|
|
|
* \brief An unsigned 64-bit integer type.
|
|
|
|
*/
|
2017-10-16 21:39:56 +00:00
|
|
|
#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */
|
|
|
|
#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */
|
2015-06-21 15:33:46 +00:00
|
|
|
typedef uint64_t Uint64;
|
|
|
|
|
|
|
|
/* @} *//* Basic data types */
|
|
|
|
|
2021-02-11 07:05:02 +00:00
|
|
|
/* Make sure we have macros for printing width-based integers.
|
2015-06-21 15:33:46 +00:00
|
|
|
* <stdint.h> should define these but this is not true all platforms.
|
|
|
|
* (for example win32) */
|
|
|
|
#ifndef SDL_PRIs64
|
|
|
|
#ifdef PRIs64
|
|
|
|
#define SDL_PRIs64 PRIs64
|
|
|
|
#elif defined(__WIN32__)
|
|
|
|
#define SDL_PRIs64 "I64d"
|
|
|
|
#elif defined(__LINUX__) && defined(__LP64__)
|
|
|
|
#define SDL_PRIs64 "ld"
|
|
|
|
#else
|
|
|
|
#define SDL_PRIs64 "lld"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifndef SDL_PRIu64
|
|
|
|
#ifdef PRIu64
|
|
|
|
#define SDL_PRIu64 PRIu64
|
|
|
|
#elif defined(__WIN32__)
|
|
|
|
#define SDL_PRIu64 "I64u"
|
|
|
|
#elif defined(__LINUX__) && defined(__LP64__)
|
|
|
|
#define SDL_PRIu64 "lu"
|
|
|
|
#else
|
|
|
|
#define SDL_PRIu64 "llu"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifndef SDL_PRIx64
|
|
|
|
#ifdef PRIx64
|
|
|
|
#define SDL_PRIx64 PRIx64
|
|
|
|
#elif defined(__WIN32__)
|
|
|
|
#define SDL_PRIx64 "I64x"
|
|
|
|
#elif defined(__LINUX__) && defined(__LP64__)
|
|
|
|
#define SDL_PRIx64 "lx"
|
|
|
|
#else
|
|
|
|
#define SDL_PRIx64 "llx"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifndef SDL_PRIX64
|
|
|
|
#ifdef PRIX64
|
|
|
|
#define SDL_PRIX64 PRIX64
|
|
|
|
#elif defined(__WIN32__)
|
|
|
|
#define SDL_PRIX64 "I64X"
|
|
|
|
#elif defined(__LINUX__) && defined(__LP64__)
|
|
|
|
#define SDL_PRIX64 "lX"
|
|
|
|
#else
|
|
|
|
#define SDL_PRIX64 "llX"
|
|
|
|
#endif
|
|
|
|
#endif
|
2021-02-11 07:05:02 +00:00
|
|
|
#ifndef SDL_PRIs32
|
|
|
|
#ifdef PRId32
|
|
|
|
#define SDL_PRIs32 PRId32
|
|
|
|
#else
|
|
|
|
#define SDL_PRIs32 "d"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifndef SDL_PRIu32
|
|
|
|
#ifdef PRIu32
|
|
|
|
#define SDL_PRIu32 PRIu32
|
|
|
|
#else
|
|
|
|
#define SDL_PRIu32 "u"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifndef SDL_PRIx32
|
|
|
|
#ifdef PRIx32
|
|
|
|
#define SDL_PRIx32 PRIx32
|
|
|
|
#else
|
|
|
|
#define SDL_PRIx32 "x"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifndef SDL_PRIX32
|
|
|
|
#ifdef PRIX32
|
|
|
|
#define SDL_PRIX32 PRIX32
|
|
|
|
#else
|
|
|
|
#define SDL_PRIX32 "X"
|
|
|
|
#endif
|
|
|
|
#endif
|
2015-06-21 15:33:46 +00:00
|
|
|
|
|
|
|
/* Annotations to help code analysis tools */
|
|
|
|
#ifdef SDL_DISABLE_ANALYZE_MACROS
|
|
|
|
#define SDL_IN_BYTECAP(x)
|
|
|
|
#define SDL_INOUT_Z_CAP(x)
|
|
|
|
#define SDL_OUT_Z_CAP(x)
|
|
|
|
#define SDL_OUT_CAP(x)
|
|
|
|
#define SDL_OUT_BYTECAP(x)
|
|
|
|
#define SDL_OUT_Z_BYTECAP(x)
|
|
|
|
#define SDL_PRINTF_FORMAT_STRING
|
|
|
|
#define SDL_SCANF_FORMAT_STRING
|
|
|
|
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
|
|
|
|
#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
|
|
|
|
#else
|
|
|
|
#if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */
|
|
|
|
#include <sal.h>
|
|
|
|
|
|
|
|
#define SDL_IN_BYTECAP(x) _In_bytecount_(x)
|
|
|
|
#define SDL_INOUT_Z_CAP(x) _Inout_z_cap_(x)
|
|
|
|
#define SDL_OUT_Z_CAP(x) _Out_z_cap_(x)
|
|
|
|
#define SDL_OUT_CAP(x) _Out_cap_(x)
|
|
|
|
#define SDL_OUT_BYTECAP(x) _Out_bytecap_(x)
|
|
|
|
#define SDL_OUT_Z_BYTECAP(x) _Out_z_bytecap_(x)
|
|
|
|
|
|
|
|
#define SDL_PRINTF_FORMAT_STRING _Printf_format_string_
|
|
|
|
#define SDL_SCANF_FORMAT_STRING _Scanf_format_string_impl_
|
|
|
|
#else
|
|
|
|
#define SDL_IN_BYTECAP(x)
|
|
|
|
#define SDL_INOUT_Z_CAP(x)
|
|
|
|
#define SDL_OUT_Z_CAP(x)
|
|
|
|
#define SDL_OUT_CAP(x)
|
|
|
|
#define SDL_OUT_BYTECAP(x)
|
|
|
|
#define SDL_OUT_Z_BYTECAP(x)
|
|
|
|
#define SDL_PRINTF_FORMAT_STRING
|
|
|
|
#define SDL_SCANF_FORMAT_STRING
|
|
|
|
#endif
|
|
|
|
#if defined(__GNUC__)
|
|
|
|
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 )))
|
|
|
|
#define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 )))
|
|
|
|
#else
|
|
|
|
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
|
|
|
|
#define SDL_SCANF_VARARG_FUNC( fmtargnumber )
|
|
|
|
#endif
|
|
|
|
#endif /* SDL_DISABLE_ANALYZE_MACROS */
|
|
|
|
|
|
|
|
#define SDL_COMPILE_TIME_ASSERT(name, x) \
|
2017-06-10 19:38:14 +00:00
|
|
|
typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]
|
2015-06-21 15:33:46 +00:00
|
|
|
/** \cond */
|
|
|
|
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
|
|
|
|
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
|
|
|
|
SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
|
|
|
|
SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
|
|
|
|
SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
|
|
|
|
SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
|
|
|
|
SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
|
|
|
|
SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
|
|
|
|
SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
|
|
|
|
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
|
|
|
|
/** \endcond */
|
|
|
|
|
|
|
|
/* Check to make sure enums are the size of ints, for structure packing.
|
|
|
|
For both Watcom C/C++ and Borland C/C++ the compiler option that makes
|
|
|
|
enums having the size of an int must be enabled.
|
|
|
|
This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \cond */
|
|
|
|
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
|
2020-12-18 13:34:24 +00:00
|
|
|
#if !defined(__ANDROID__) && !defined(__VITA__)
|
2015-06-21 15:33:46 +00:00
|
|
|
/* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
DUMMY_ENUM_VALUE
|
|
|
|
} SDL_DUMMY_ENUM;
|
|
|
|
|
|
|
|
SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
|
|
|
|
#endif
|
|
|
|
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
|
|
|
|
/** \endcond */
|
|
|
|
|
|
|
|
#include "begin_code.h"
|
|
|
|
/* Set up for C function definitions, even when using C++ */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_ALLOCA
|
|
|
|
#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count))
|
|
|
|
#define SDL_stack_free(data)
|
|
|
|
#else
|
|
|
|
#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count))
|
|
|
|
#define SDL_stack_free(data) SDL_free(data)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
|
|
|
|
extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
|
|
|
|
extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
|
|
|
|
extern DECLSPEC void SDLCALL SDL_free(void *mem);
|
|
|
|
|
2017-10-12 20:44:28 +00:00
|
|
|
typedef void *(SDLCALL *SDL_malloc_func)(size_t size);
|
|
|
|
typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size);
|
|
|
|
typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size);
|
|
|
|
typedef void (SDLCALL *SDL_free_func)(void *mem);
|
|
|
|
|
|
|
|
/**
|
2021-07-14 21:07:04 +00:00
|
|
|
* Get the current set of SDL memory functions
|
2017-10-12 20:44:28 +00:00
|
|
|
*/
|
|
|
|
extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func,
|
|
|
|
SDL_calloc_func *calloc_func,
|
|
|
|
SDL_realloc_func *realloc_func,
|
|
|
|
SDL_free_func *free_func);
|
|
|
|
|
|
|
|
/**
|
2021-07-14 21:07:04 +00:00
|
|
|
* Replace SDL's memory allocation functions with a custom set
|
2017-10-12 20:44:28 +00:00
|
|
|
*/
|
|
|
|
extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func,
|
|
|
|
SDL_calloc_func calloc_func,
|
|
|
|
SDL_realloc_func realloc_func,
|
|
|
|
SDL_free_func free_func);
|
|
|
|
|
|
|
|
/**
|
2021-07-14 21:07:04 +00:00
|
|
|
* Get the number of outstanding (unfreed) allocations
|
2017-10-12 20:44:28 +00:00
|
|
|
*/
|
2017-10-13 00:17:09 +00:00
|
|
|
extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
|
2017-10-12 20:44:28 +00:00
|
|
|
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
|
|
|
|
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
|
|
|
|
|
|
|
|
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *));
|
|
|
|
|
|
|
|
extern DECLSPEC int SDLCALL SDL_abs(int x);
|
|
|
|
|
2021-08-10 23:51:03 +00:00
|
|
|
/* NOTE: these double-evaluate their arguments, so you should never have side effects in the parameters */
|
2015-06-21 15:33:46 +00:00
|
|
|
#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
|
|
|
|
#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
|
2021-08-14 20:11:17 +00:00
|
|
|
#define SDL_clamp(x, a, b) (((x) < (a)) ? (a) : (((x) > (b)) ? (b) : (x)))
|
2015-06-21 15:33:46 +00:00
|
|
|
|
2021-02-13 19:21:19 +00:00
|
|
|
extern DECLSPEC int SDLCALL SDL_isalpha(int x);
|
|
|
|
extern DECLSPEC int SDLCALL SDL_isalnum(int x);
|
|
|
|
extern DECLSPEC int SDLCALL SDL_isblank(int x);
|
|
|
|
extern DECLSPEC int SDLCALL SDL_iscntrl(int x);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC int SDLCALL SDL_isdigit(int x);
|
2021-02-13 19:21:19 +00:00
|
|
|
extern DECLSPEC int SDLCALL SDL_isxdigit(int x);
|
|
|
|
extern DECLSPEC int SDLCALL SDL_ispunct(int x);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC int SDLCALL SDL_isspace(int x);
|
2020-03-02 23:21:07 +00:00
|
|
|
extern DECLSPEC int SDLCALL SDL_isupper(int x);
|
|
|
|
extern DECLSPEC int SDLCALL SDL_islower(int x);
|
2021-02-13 19:21:19 +00:00
|
|
|
extern DECLSPEC int SDLCALL SDL_isprint(int x);
|
|
|
|
extern DECLSPEC int SDLCALL SDL_isgraph(int x);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC int SDLCALL SDL_toupper(int x);
|
|
|
|
extern DECLSPEC int SDLCALL SDL_tolower(int x);
|
|
|
|
|
2020-11-16 23:00:15 +00:00
|
|
|
extern DECLSPEC Uint32 SDLCALL SDL_crc32(Uint32 crc, const void *data, size_t len);
|
|
|
|
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
|
|
|
|
|
|
|
|
#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
|
|
|
|
#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
|
2019-07-30 22:22:02 +00:00
|
|
|
#define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x)))
|
2015-06-21 15:33:46 +00:00
|
|
|
|
|
|
|
/* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */
|
|
|
|
SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
|
|
|
|
{
|
2019-09-04 04:39:47 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
memset_pattern4(dst, &val, dwords * 4);
|
2021-02-15 00:02:32 +00:00
|
|
|
#elif defined(__GNUC__) && defined(__i386__)
|
2015-06-21 15:33:46 +00:00
|
|
|
int u0, u1, u2;
|
|
|
|
__asm__ __volatile__ (
|
|
|
|
"cld \n\t"
|
|
|
|
"rep ; stosl \n\t"
|
|
|
|
: "=&D" (u0), "=&a" (u1), "=&c" (u2)
|
|
|
|
: "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords))
|
|
|
|
: "memory"
|
|
|
|
);
|
|
|
|
#else
|
|
|
|
size_t _n = (dwords + 3) / 4;
|
|
|
|
Uint32 *_p = SDL_static_cast(Uint32 *, dst);
|
|
|
|
Uint32 _val = (val);
|
2021-06-10 17:56:22 +00:00
|
|
|
if (dwords == 0) {
|
2015-06-21 15:33:46 +00:00
|
|
|
return;
|
2021-06-10 17:56:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* !!! FIXME: there are better ways to do this, but this is just to clean this up for now. */
|
|
|
|
#ifdef __clang__
|
|
|
|
#pragma clang diagnostic push
|
|
|
|
#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
switch (dwords % 4) {
|
2017-09-06 11:32:30 +00:00
|
|
|
case 0: do { *_p++ = _val; /* fallthrough */
|
|
|
|
case 3: *_p++ = _val; /* fallthrough */
|
|
|
|
case 2: *_p++ = _val; /* fallthrough */
|
|
|
|
case 1: *_p++ = _val; /* fallthrough */
|
2015-06-21 15:33:46 +00:00
|
|
|
} while ( --_n );
|
|
|
|
}
|
2021-06-10 17:56:22 +00:00
|
|
|
|
|
|
|
#ifdef __clang__
|
|
|
|
#pragma clang diagnostic pop
|
|
|
|
#endif
|
|
|
|
|
2015-06-21 15:33:46 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
|
|
|
|
extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
|
2019-11-21 00:42:50 +00:00
|
|
|
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);
|
|
|
|
|
2017-08-14 03:37:49 +00:00
|
|
|
extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
|
2019-11-21 00:42:50 +00:00
|
|
|
extern DECLSPEC int SDLCALL SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen);
|
2020-11-24 20:43:01 +00:00
|
|
|
extern DECLSPEC int SDLCALL SDL_wcscasecmp(const wchar_t *str1, const wchar_t *str2);
|
|
|
|
extern DECLSPEC int SDLCALL SDL_wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t len);
|
2015-06-21 15:33:46 +00:00
|
|
|
|
|
|
|
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
|
|
|
|
extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
|
|
|
|
extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes);
|
|
|
|
extern DECLSPEC size_t SDLCALL SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
|
|
|
|
extern DECLSPEC char *SDLCALL SDL_strdup(const char *str);
|
|
|
|
extern DECLSPEC char *SDLCALL SDL_strrev(char *str);
|
|
|
|
extern DECLSPEC char *SDLCALL SDL_strupr(char *str);
|
|
|
|
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);
|
2019-11-20 17:40:50 +00:00
|
|
|
extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr);
|
2017-05-29 07:01:05 +00:00
|
|
|
extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
|
2015-06-21 15:33:46 +00:00
|
|
|
|
|
|
|
extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
|
|
|
|
extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix);
|
|
|
|
extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix);
|
|
|
|
extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix);
|
|
|
|
extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix);
|
|
|
|
extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix);
|
|
|
|
|
|
|
|
extern DECLSPEC int SDLCALL SDL_atoi(const char *str);
|
|
|
|
extern DECLSPEC double SDLCALL SDL_atof(const char *str);
|
|
|
|
extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base);
|
|
|
|
extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base);
|
|
|
|
extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base);
|
|
|
|
extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base);
|
|
|
|
extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp);
|
|
|
|
|
|
|
|
extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
|
|
|
|
extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
|
|
|
|
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_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_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap);
|
2021-09-14 19:37:35 +00:00
|
|
|
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);
|
2015-06-21 15:33:46 +00:00
|
|
|
|
|
|
|
#ifndef HAVE_M_PI
|
|
|
|
#ifndef M_PI
|
2017-06-04 21:15:39 +00:00
|
|
|
#define M_PI 3.14159265358979323846264338327950288 /**< pi */
|
2015-06-21 15:33:46 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2021-10-09 00:22:48 +00:00
|
|
|
/**
|
|
|
|
* Use this function to compute arc cosine of `x`.
|
|
|
|
*
|
|
|
|
* The definition of `y = acos(x)` is `x = cos(y)`.
|
|
|
|
*
|
|
|
|
* Domain: `-1 <= x <= 1`
|
|
|
|
*
|
|
|
|
* Range: `0 <= y <= Pi`
|
|
|
|
*
|
|
|
|
* \param x floating point value, in radians.
|
|
|
|
* \returns arc cosine of `x`.
|
|
|
|
*
|
|
|
|
* \since This function is available since SDL 2.0.2.
|
|
|
|
*/
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_acos(double x);
|
2017-11-04 22:34:14 +00:00
|
|
|
extern DECLSPEC float SDLCALL SDL_acosf(float x);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_asin(double x);
|
2017-11-04 22:34:14 +00:00
|
|
|
extern DECLSPEC float SDLCALL SDL_asinf(float x);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_atan(double x);
|
2017-11-04 22:34:14 +00:00
|
|
|
extern DECLSPEC float SDLCALL SDL_atanf(float x);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
|
2017-11-04 22:34:14 +00:00
|
|
|
extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_ceil(double x);
|
2017-11-04 22:34:14 +00:00
|
|
|
extern DECLSPEC float SDLCALL SDL_ceilf(float x);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
|
2017-11-04 22:34:14 +00:00
|
|
|
extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_cos(double x);
|
|
|
|
extern DECLSPEC float SDLCALL SDL_cosf(float x);
|
2018-08-04 15:52:46 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_exp(double x);
|
|
|
|
extern DECLSPEC float SDLCALL SDL_expf(float x);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_fabs(double x);
|
2017-11-04 22:34:14 +00:00
|
|
|
extern DECLSPEC float SDLCALL SDL_fabsf(float x);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_floor(double x);
|
2017-11-04 22:34:14 +00:00
|
|
|
extern DECLSPEC float SDLCALL SDL_floorf(float x);
|
2020-04-10 16:17:14 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_trunc(double x);
|
|
|
|
extern DECLSPEC float SDLCALL SDL_truncf(float x);
|
2017-11-05 00:35:03 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_fmod(double x, double y);
|
|
|
|
extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_log(double x);
|
2017-11-04 22:34:14 +00:00
|
|
|
extern DECLSPEC float SDLCALL SDL_logf(float x);
|
2018-02-08 14:07:47 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_log10(double x);
|
|
|
|
extern DECLSPEC float SDLCALL SDL_log10f(float x);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
|
2017-11-04 22:34:14 +00:00
|
|
|
extern DECLSPEC float SDLCALL SDL_powf(float x, float y);
|
2020-12-23 21:47:49 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_round(double x);
|
|
|
|
extern DECLSPEC float SDLCALL SDL_roundf(float x);
|
|
|
|
extern DECLSPEC long SDLCALL SDL_lround(double x);
|
|
|
|
extern DECLSPEC long SDLCALL SDL_lroundf(float x);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
|
2017-11-04 22:34:14 +00:00
|
|
|
extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n);
|
2015-06-21 15:33:46 +00:00
|
|
|
extern DECLSPEC double SDLCALL SDL_sin(double x);
|
|
|
|
extern DECLSPEC float SDLCALL SDL_sinf(float x);
|
|
|
|
extern DECLSPEC double SDLCALL SDL_sqrt(double x);
|
|
|
|
extern DECLSPEC float SDLCALL SDL_sqrtf(float x);
|
|
|
|
extern DECLSPEC double SDLCALL SDL_tan(double x);
|
|
|
|
extern DECLSPEC float SDLCALL SDL_tanf(float x);
|
|
|
|
|
|
|
|
/* The SDL implementation of iconv() returns these error codes */
|
|
|
|
#define SDL_ICONV_ERROR (size_t)-1
|
|
|
|
#define SDL_ICONV_E2BIG (size_t)-2
|
|
|
|
#define SDL_ICONV_EILSEQ (size_t)-3
|
|
|
|
#define SDL_ICONV_EINVAL (size_t)-4
|
|
|
|
|
|
|
|
/* SDL_iconv_* are now always real symbols/types, not macros or inlined. */
|
|
|
|
typedef struct _SDL_iconv_t *SDL_iconv_t;
|
|
|
|
extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
|
|
|
|
const char *fromcode);
|
|
|
|
extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
|
|
|
|
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
|
|
|
|
size_t * inbytesleft, char **outbuf,
|
|
|
|
size_t * outbytesleft);
|
2021-10-09 00:22:48 +00:00
|
|
|
|
2015-06-21 15:33:46 +00:00
|
|
|
/**
|
2021-07-14 21:07:04 +00:00
|
|
|
* This function converts a string between encodings in one pass, returning a
|
|
|
|
* string that must be freed with SDL_free() or NULL on error.
|
2015-06-21 15:33:46 +00:00
|
|
|
*/
|
|
|
|
extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
|
|
|
|
const char *fromcode,
|
|
|
|
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)
|
|
|
|
|
|
|
|
/* force builds using Clang's static analysis tools to use literal C runtime
|
|
|
|
here, since there are possibly tests that are ineffective otherwise. */
|
|
|
|
#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
|
2020-06-28 21:45:07 +00:00
|
|
|
|
|
|
|
/* The analyzer knows about strlcpy even when the system doesn't provide it */
|
|
|
|
#ifndef HAVE_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
|
|
|
|
size_t strlcat(char* dst, const char* src, size_t size);
|
|
|
|
#endif
|
|
|
|
|
2015-06-21 15:33:46 +00:00
|
|
|
#define SDL_malloc malloc
|
|
|
|
#define SDL_calloc calloc
|
|
|
|
#define SDL_realloc realloc
|
|
|
|
#define SDL_free free
|
|
|
|
#define SDL_memset memset
|
|
|
|
#define SDL_memcpy memcpy
|
|
|
|
#define SDL_memmove memmove
|
|
|
|
#define SDL_memcmp memcmp
|
|
|
|
#define SDL_strlcpy strlcpy
|
|
|
|
#define SDL_strlcat strlcat
|
2020-06-28 21:45:07 +00:00
|
|
|
#define SDL_strlen strlen
|
|
|
|
#define SDL_wcslen wcslen
|
|
|
|
#define SDL_wcslcpy wcslcpy
|
|
|
|
#define SDL_wcslcat wcslcat
|
2015-06-21 15:33:46 +00:00
|
|
|
#define SDL_strdup strdup
|
2020-06-28 21:45:07 +00:00
|
|
|
#define SDL_wcsdup wcsdup
|
2015-06-21 15:33:46 +00:00
|
|
|
#define SDL_strchr strchr
|
|
|
|
#define SDL_strrchr strrchr
|
|
|
|
#define SDL_strstr strstr
|
2020-06-28 21:45:07 +00:00
|
|
|
#define SDL_wcsstr wcsstr
|
2019-11-20 17:40:50 +00:00
|
|
|
#define SDL_strtokr strtok_r
|
2015-06-21 15:33:46 +00:00
|
|
|
#define SDL_strcmp strcmp
|
2020-06-28 21:45:07 +00:00
|
|
|
#define SDL_wcscmp wcscmp
|
2015-06-21 15:33:46 +00:00
|
|
|
#define SDL_strncmp strncmp
|
2020-06-28 21:45:07 +00:00
|
|
|
#define SDL_wcsncmp wcsncmp
|
2015-06-21 15:33:46 +00:00
|
|
|
#define SDL_strcasecmp strcasecmp
|
|
|
|
#define SDL_strncasecmp strncasecmp
|
|
|
|
#define SDL_sscanf sscanf
|
|
|
|
#define SDL_vsscanf vsscanf
|
|
|
|
#define SDL_snprintf snprintf
|
|
|
|
#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);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Ends C function definitions when using C++ */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#include "close_code.h"
|
|
|
|
|
2016-11-21 05:34:54 +00:00
|
|
|
#endif /* SDL_stdinc_h_ */
|
2015-06-21 15:33:46 +00:00
|
|
|
|
|
|
|
/* vi: set ts=4 sw=4 expandtab: */
|