SDL_stdinc.h
Go to the documentation of this file.
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 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
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.
*/
#ifndef SDL_stdinc_h_
#define SDL_stdinc_h_
#include "SDL_config.h"
#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
#ifdef HAVE_WCHAR_H
# include <wchar.h>
#endif
#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
/**
* The number of elements in an array.
*/
#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
#define SDL_TABLESIZE(table) SDL_arraysize(table)
/**
* 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
/**
* \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
*/
/* @{ */
#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
typedef enum
{
SDL_FALSE = 0,
SDL_TRUE = 1
} SDL_bool;
#endif
/**
* \brief 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.
*/
#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.
*/
#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.
*/
#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.
*/
#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.
*/
#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.
*/
#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.
*/
#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */
#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */
typedef uint64_t Uint64;
/* @} *//* Basic data types */
/* Make sure we have macros for printing 64 bit values.
* <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
/* 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) \
typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]
/** \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
#if !defined(__ANDROID__)
/* 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
#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
#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);
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);
/**
* \brief Get the current set of SDL memory functions
*/
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);
/**
* \brief Replace SDL's memory allocation functions with a custom set
*
* \note If you are replacing SDL's memory functions, you should call
* SDL_GetNumAllocations() and be very careful if it returns non-zero.
* That means that your free function will be called with memory
* allocated by the previous memory allocation functions.
*/
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);
/**
* \brief Get the number of outstanding (unfreed) allocations
*/
extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
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);
/* !!! FIXME: these have side effects. You probably shouldn't use them. */
/* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */
#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
extern DECLSPEC int SDLCALL SDL_isdigit(int x);
extern DECLSPEC int SDLCALL SDL_isspace(int x);
extern DECLSPEC int SDLCALL SDL_toupper(int x);
extern DECLSPEC int SDLCALL SDL_tolower(int x);
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)))
/* 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)
{
#if defined(__GNUC__) && defined(i386)
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);
if (dwords == 0)
return;
switch (dwords % 4)
{
case 0: do { *_p++ = _val; /* fallthrough */
case 3: *_p++ = _val; /* fallthrough */
case 2: *_p++ = _val; /* fallthrough */
case 1: *_p++ = _val; /* fallthrough */
} while ( --_n );
}
#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);
extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
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);
extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
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);
#ifndef HAVE_M_PI
#ifndef M_PI
#define M_PI 3.14159265358979323846264338327950288 /**< pi */
#endif
#endif
extern DECLSPEC double SDLCALL SDL_acos(double x);
extern DECLSPEC float SDLCALL SDL_acosf(float x);
extern DECLSPEC double SDLCALL SDL_asin(double x);
extern DECLSPEC float SDLCALL SDL_asinf(float x);
extern DECLSPEC double SDLCALL SDL_atan(double x);
extern DECLSPEC float SDLCALL SDL_atanf(float x);
extern DECLSPEC double SDLCALL SDL_atan2(double x, double y);
extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y);
extern DECLSPEC double SDLCALL SDL_ceil(double x);
extern DECLSPEC float SDLCALL SDL_ceilf(float x);
extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y);
extern DECLSPEC double SDLCALL SDL_cos(double x);
extern DECLSPEC float SDLCALL SDL_cosf(float x);
extern DECLSPEC double SDLCALL SDL_fabs(double x);
extern DECLSPEC float SDLCALL SDL_fabsf(float x);
extern DECLSPEC double SDLCALL SDL_floor(double x);
extern DECLSPEC float SDLCALL SDL_floorf(float x);
extern DECLSPEC double SDLCALL SDL_fmod(double x, double y);
extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y);
extern DECLSPEC double SDLCALL SDL_log(double x);
extern DECLSPEC float SDLCALL SDL_logf(float x);
extern DECLSPEC double SDLCALL SDL_log10(double x);
extern DECLSPEC float SDLCALL SDL_log10f(float x);
extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
extern DECLSPEC float SDLCALL SDL_powf(float x, float y);
extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n);
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);
/**
* This function converts a string between encodings in one pass, returning a
* string that must be freed with SDL_free() or NULL on error.
*/
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)
#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_strlen strlen
#define SDL_strlcpy strlcpy
#define SDL_strlcat strlcat
#define SDL_strdup strdup
#define SDL_strchr strchr
#define SDL_strrchr strrchr
#define SDL_strstr strstr
#define SDL_strcmp strcmp
#define SDL_strncmp strncmp
#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"
#endif /* SDL_stdinc_h_ */
/* vi: set ts=4 sw=4 expandtab: */
SDL_realloc
void * SDL_realloc(void *mem, size_t size)
Definition: SDL_malloc.c:5351
SDL_strlcat
size_t SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
Definition: SDL_string.c:547
SDL_getenv
char * SDL_getenv(const char *name)
Definition: SDL_getenv.c:219
SDL_atanf
float SDL_atanf(float x)
Definition: SDL_stdlib.c:45
SDL_strlcpy
size_t SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
Definition: SDL_string.c:481
SDL_copysign
double SDL_copysign(double x, double y)
Definition: SDL_stdlib.c:156
SDL_tolower
int SDL_tolower(int x)
Definition: SDL_stdlib.c:427
SDL_memcmp
int SDL_memcmp(const void *s1, const void *s2, size_t len)
Definition: SDL_string.c:387
SDL_OUT_Z_CAP
#define SDL_OUT_Z_CAP(x)
Definition: SDL_stdinc.h:274
SDL_strncmp
int SDL_strncmp(const char *str1, const char *str2, size_t maxlen)
Definition: SDL_string.c:945
SDL_TRUE
Definition: SDL_stdinc.h:142
SDL_IN_BYTECAP
#define SDL_IN_BYTECAP(x)
Definition: SDL_stdinc.h:272
SDL_fmodf
float SDL_fmodf(float x, float y)
Definition: SDL_stdlib.c:254
SDL_pow
double SDL_pow(double x, double y)
Definition: SDL_stdlib.c:304
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1574
SDL_atan2f
float SDL_atan2f(float x, float y)
Definition: SDL_stdlib.c:65
int32_t
signed int int32_t
Definition: SDL_config_windows.h:62
uint16_t
unsigned short uint16_t
Definition: SDL_config_windows.h:61
SDL_memset
void * SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len)
Definition: SDL_string.c:266
SDL_vsnprintf
int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap)
Definition: SDL_string.c:1524
SDL_cosf
float SDL_cosf(float x)
Definition: SDL_stdlib.c:194
SDL_SetMemoryFunctions
int SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, SDL_calloc_func calloc_func, SDL_realloc_func realloc_func, SDL_free_func free_func)
Replace SDL&#39;s memory allocation functions with a custom set.
Definition: SDL_malloc.c:5290
SDL_abs
int SDL_abs(int x)
Definition: SDL_stdlib.c:409
SDL_malloc
void * SDL_malloc(size_t size)
Definition: SDL_malloc.c:5320
SDL_FALSE
Definition: SDL_stdinc.h:141
SDL_wcslcat
size_t SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
Definition: SDL_string.c:450
SDL_memcpy
void * SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
Definition: SDL_string.c:310
SDL_scalbn
double SDL_scalbn(double x, int n)
Definition: SDL_stdlib.c:324
uint64_t
unsigned long long uint64_t
Definition: SDL_config_windows.h:65
SDL_ceilf
float SDL_ceilf(float x)
Definition: SDL_stdlib.c:146
SDL_sinf
float SDL_sinf(float x)
Definition: SDL_stdlib.c:360
SDL_floor
double SDL_floor(double x)
Definition: SDL_stdlib.c:224
SDL_setenv
int SDL_setenv(const char *name, const char *value, int overwrite)
Definition: SDL_getenv.c:110
SDL_ltoa
char * SDL_ltoa(long value, char *str, int radix)
Definition: SDL_string.c:706
SDL_calloc_func
void *(* SDL_calloc_func)(size_t nmemb, size_t size)
Definition: SDL_stdinc.h:367
SDL_iconv_open
SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode)
Definition: SDL_iconv.c:208
SDL_acos
double SDL_acos(double x)
Definition: SDL_stdlib.c:75
u1
GLfixed u1
Definition: SDL_opengl_glext.h:4558
SDL_wcslcpy
size_t SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen)
Definition: SDL_string.c:434
SDL_strcmp
int SDL_strcmp(const char *str1, const char *str2)
Definition: SDL_string.c:929
SDL_log
double SDL_log(double x)
Definition: SDL_stdlib.c:264
SDL_free_func
void(* SDL_free_func)(void *mem)
Definition: SDL_stdinc.h:369
SDL_sqrt
double SDL_sqrt(double x)
Definition: SDL_stdlib.c:370
SDL_floorf
float SDL_floorf(float x)
Definition: SDL_stdlib.c:234
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
int16_t
signed short int16_t
Definition: SDL_config_windows.h:60
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_copysignf
float SDL_copysignf(float x, float y)
Definition: SDL_stdlib.c:174
begin_code.h
SDL_itoa
char * SDL_itoa(int value, char *str, int radix)
Definition: SDL_string.c:686
SDL_SCANF_FORMAT_STRING
#define SDL_SCANF_FORMAT_STRING
Definition: SDL_stdinc.h:279
SDL_FORCE_INLINE
#define SDL_FORCE_INLINE
Definition: begin_code.h:144
SDL_lltoa
char * SDL_lltoa(Sint64 value, char *str, int radix)
Definition: SDL_string.c:750
Uint64
uint64_t Uint64
Definition: SDL_stdinc.h:194
SDL_vsscanf
int SDL_vsscanf(const char *text, const char *fmt, va_list ap)
Definition: SDL_string.c:1036
SDL_config.h
SDL_OUT_BYTECAP
#define SDL_OUT_BYTECAP(x)
Definition: SDL_stdinc.h:276
SDL_asinf
float SDL_asinf(float x)
Definition: SDL_stdlib.c:121
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2926
name
GLuint const GLchar * name
Definition: SDL_opengl_glext.h:660
SDL_ultoa
char * SDL_ultoa(unsigned long value, char *str, int radix)
Definition: SDL_string.c:725
SDL_tanf
float SDL_tanf(float x)
Definition: SDL_stdlib.c:400
realloc_func
SDL_realloc_func realloc_func
Definition: SDL_malloc.c:5264
SDL_ceil
double SDL_ceil(double x)
Definition: SDL_stdlib.c:131
SDL_atoi
int SDL_atoi(const char *str)
Definition: SDL_string.c:793
SDL_qsort
void SDL_qsort(void *base, size_t nmemb, size_t size, int(*compare)(const void *, const void *))
SDL_strncasecmp
int SDL_strncasecmp(const char *str1, const char *str2, size_t len)
Definition: SDL_string.c:989
u2
GLfixed GLfixed u2
Definition: SDL_opengl_glext.h:4558
SDL_powf
float SDL_powf(float x, float y)
Definition: SDL_stdlib.c:314
SDL_isdigit
int SDL_isdigit(int x)
Definition: SDL_stdlib.c:424
SDL_atan
double SDL_atan(double x)
Definition: SDL_stdlib.c:35
SDL_strtod
double SDL_strtod(const char *str, char **endp)
Definition: SDL_string.c:912
SDL_atof
double SDL_atof(const char *str)
Definition: SDL_string.c:802
SDL_utf8strlen
size_t SDL_utf8strlen(const char *str)
Definition: SDL_string.c:530
DECLSPEC
#define DECLSPEC
Definition: SDL_internal.h:44
SDL_snprintf
int SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(3)
Definition: SDL_string.c:1310
SDL_calloc
void * SDL_calloc(size_t nmemb, size_t size)
Definition: SDL_malloc.c:5335
SDL_strrchr
char * SDL_strrchr(const char *str, int c)
Definition: SDL_string.c:640
val
GLuint GLfloat * val
Definition: SDL_opengl_glext.h:1492
SDL_sscanf
int SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt,...) SDL_SCANF_VARARG_FUNC(2)
Definition: SDL_string.c:1018
SDL_toupper
int SDL_toupper(int x)
Definition: SDL_stdlib.c:426
close_code.h
SDL_malloc_func
void *(* SDL_malloc_func)(size_t size)
Definition: SDL_stdinc.h:366
Sint8
int8_t Sint8
Definition: SDL_stdinc.h:151
SDL_memset4
SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
Definition: SDL_stdinc.h:420
SDL_fabs
double SDL_fabs(double x)
Definition: SDL_stdlib.c:204
SDL_iconv_close
int SDL_iconv_close(SDL_iconv_t cd)
Definition: SDL_iconv.c:854
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
SDL_free
void SDL_free(void *mem)
Definition: SDL_malloc.c:5366
SDL_realloc_func
void *(* SDL_realloc_func)(void *mem, size_t size)
Definition: SDL_stdinc.h:368
SDL_INOUT_Z_CAP
#define SDL_INOUT_Z_CAP(x)
Definition: SDL_stdinc.h:273
SDL_logf
float SDL_logf(float x)
Definition: SDL_stdlib.c:274
SDL_static_cast
#define SDL_static_cast(type, expression)
Definition: SDL_stdinc.h:116
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
SDL_fmod
double SDL_fmod(double x, double y)
Definition: SDL_stdlib.c:244
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:698
malloc_func
SDL_malloc_func malloc_func
Definition: SDL_malloc.c:5262
SDL_strcasecmp
int SDL_strcasecmp(const char *str1, const char *str2)
Definition: SDL_string.c:965
SDL_uitoa
char * SDL_uitoa(unsigned int value, char *str, int radix)
Definition: SDL_string.c:696
SDL_strstr
char * SDL_strstr(const char *haystack, const char *needle)
Definition: SDL_string.c:659
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1574
SDL_GetNumAllocations
int SDL_GetNumAllocations(void)
Get the number of outstanding (unfreed) allocations.
Definition: SDL_malloc.c:5315
free_func
SDL_free_func free_func
Definition: SDL_malloc.c:5265
s1
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
Definition: SDL_opengl_glext.h:8583
Sint32
int32_t Sint32
Definition: SDL_stdinc.h:175
SDL_iconv_string
char * SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft)
Definition: SDL_iconv.c:865
SDL_sin
double SDL_sin(double x)
Definition: SDL_stdlib.c:350
SDL_log10f
float SDL_log10f(float x)
Definition: SDL_stdlib.c:294
size
GLsizeiptr size
Definition: SDL_opengl_glext.h:537
SDL_asin
double SDL_asin(double x)
Definition: SDL_stdlib.c:105
SDL_wcscmp
int SDL_wcscmp(const wchar_t *str1, const wchar_t *str2)
Definition: SDL_string.c:465
SDL_ulltoa
char * SDL_ulltoa(Uint64 value, char *str, int radix)
Definition: SDL_string.c:769
calloc_func
SDL_calloc_func calloc_func
Definition: SDL_malloc.c:5263
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:139
SDL_strlwr
char * SDL_strlwr(char *str)
Definition: SDL_string.c:607
uint8_t
unsigned char uint8_t
Definition: SDL_config_windows.h:59
uint32_t
unsigned int uint32_t
Definition: SDL_config_windows.h:63
SDL_strtoll
Sint64 SDL_strtoll(const char *str, char **endp, int base)
Definition: SDL_string.c:862
int8_t
signed char int8_t
Definition: SDL_config_windows.h:58
text
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:47
_SDL_iconv_t
Definition: SDL_iconv.c:129
SDL_iconv
size_t SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Definition: SDL_iconv.c:248
SDL_strtoul
unsigned long SDL_strtoul(const char *str, char **endp, int base)
Definition: SDL_string.c:837
SDL_utf8strlcpy
size_t SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes)
Definition: SDL_string.c:497
void
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
Definition: SDL_dynapi_procs.h:89
SDL_SCANF_VARARG_FUNC
#define SDL_SCANF_VARARG_FUNC(fmtargnumber)
Definition: SDL_stdinc.h:286
n
GLdouble n
Definition: SDL_opengl_glext.h:1952
SDL_strlen
size_t SDL_strlen(const char *str)
Definition: SDL_string.c:406
SDL_sqrtf
float SDL_sqrtf(float x)
Definition: SDL_stdlib.c:380
SDL_log10
double SDL_log10(double x)
Definition: SDL_stdlib.c:284
SDL_acosf
float SDL_acosf(float x)
Definition: SDL_stdlib.c:95
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:169
SDL_memmove
void * SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
Definition: SDL_string.c:363
SDL_strdup
char * SDL_strdup(const char *str)
Definition: SDL_string.c:562
SDL_GetMemoryFunctions
void SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func, SDL_calloc_func *calloc_func, SDL_realloc_func *realloc_func, SDL_free_func *free_func)
Get the current set of SDL memory functions.
Definition: SDL_malloc.c:5271
SDL_strtoull
Uint64 SDL_strtoull(const char *str, char **endp, int base)
Definition: SDL_string.c:887
SDL_strupr
char * SDL_strupr(char *str)
Definition: SDL_string.c:592
SDL_wcslen
size_t SDL_wcslen(const wchar_t *wstr)
Definition: SDL_string.c:420
Sint64
int64_t Sint64
Definition: SDL_stdinc.h:188
SDL_fabsf
float SDL_fabsf(float x)
Definition: SDL_stdlib.c:214
SDL_memcpy4
SDL_FORCE_INLINE void * SDL_memcpy4(SDL_OUT_BYTECAP(dwords *4) void *dst, SDL_IN_BYTECAP(dwords *4) const void *src, size_t dwords)
Definition: SDL_stdinc.h:592
SDL_strtol
long SDL_strtol(const char *str, char **endp, int base)
Definition: SDL_string.c:812
SDL_PRINTF_FORMAT_STRING
#define SDL_PRINTF_FORMAT_STRING
Definition: SDL_stdinc.h:278
SDL_strchr
char * SDL_strchr(const char *str, int c)
Definition: SDL_string.c:622
SDL_tan
double SDL_tan(double x)
Definition: SDL_stdlib.c:390
SDLCALL
#define SDLCALL
Definition: SDL_internal.h:45
SDL_scalbnf
float SDL_scalbnf(float x, int n)
Definition: SDL_stdlib.c:340
SDL_atan2
double SDL_atan2(double x, double y)
Definition: SDL_stdlib.c:55
SDL_strrev
char * SDL_strrev(char *str)
Definition: SDL_string.c:573
SDL_cos
double SDL_cos(double x)
Definition: SDL_stdlib.c:184
Sint16
int16_t Sint16
Definition: SDL_stdinc.h:163
int64_t
signed long long int64_t
Definition: SDL_config_windows.h:64
SDL_COMPILE_TIME_ASSERT
#define SDL_COMPILE_TIME_ASSERT(name, x)
Definition: SDL_stdinc.h:290
SDL_PRINTF_VARARG_FUNC
#define SDL_PRINTF_VARARG_FUNC(fmtargnumber)
Definition: SDL_stdinc.h:285
SDL_isspace
int SDL_isspace(int x)
Definition: SDL_stdlib.c:425