#include "SDL_config.h"
#include "begin_code.h"
#include "close_code.h"
Go to the source code of this file.
Data Structures | |
struct | Uint64 |
Defines | |
#define | SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) |
#define | SDL_TABLESIZE(table) SDL_arraysize(table) |
#define | SDL_reinterpret_cast(type, expression) ((type)(expression)) |
#define | SDL_static_cast(type, expression) ((type)(expression)) |
#define | SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count)) |
#define | SDL_stack_free(data) SDL_free(data) |
#define | SDL_abs(X) ((X) < 0 ? -(X) : (X)) |
#define | SDL_min(x, y) (((x) < (y)) ? (x) : (y)) |
#define | SDL_max(x, y) (((x) > (y)) ? (x) : (y)) |
#define | SDL_isdigit(X) (((X) >= '0') && ((X) <= '9')) |
#define | SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n')) |
#define | SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X)) |
#define | SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X)) |
#define | SDL_memset4(dst, val, len) |
#define | SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2) |
#define | SDL_memmove(dst, src, len) |
#define | SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix) |
#define | SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix) |
#define | SDL_atoi(X) SDL_strtol(X, NULL, 0) |
#define | SDL_atof(X) SDL_strtod(X, NULL) |
#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", "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) |
SDL_ICONV Error Codes | |
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 |
Typedefs | |
typedef struct _SDL_iconv_t * | SDL_iconv_t |
Functions | |
DECLSPEC void *SDLCALL | SDL_malloc (size_t size) |
DECLSPEC void *SDLCALL | SDL_calloc (size_t nmemb, size_t size) |
DECLSPEC void *SDLCALL | SDL_realloc (void *mem, size_t size) |
DECLSPEC void SDLCALL | SDL_free (void *mem) |
DECLSPEC char *SDLCALL | SDL_getenv (const char *name) |
DECLSPEC int SDLCALL | SDL_putenv (const char *variable) |
DECLSPEC void SDLCALL | SDL_qsort (void *base, size_t nmemb, size_t size, int(*compare)(const void *, const void *)) |
DECLSPEC void *SDLCALL | SDL_memset (void *dst, int c, size_t len) |
DECLSPEC void *SDLCALL | SDL_memcpy (void *dst, const void *src, size_t len) |
DECLSPEC void *SDLCALL | SDL_revcpy (void *dst, const void *src, size_t len) |
DECLSPEC int SDLCALL | SDL_memcmp (const void *s1, const void *s2, size_t len) |
DECLSPEC size_t SDLCALL | SDL_strlen (const char *string) |
DECLSPEC size_t SDLCALL | SDL_strlcpy (char *dst, const char *src, size_t maxlen) |
DECLSPEC size_t SDLCALL | SDL_strlcat (char *dst, const char *src, size_t maxlen) |
DECLSPEC char *SDLCALL | SDL_strdup (const char *string) |
DECLSPEC char *SDLCALL | SDL_strrev (char *string) |
DECLSPEC char *SDLCALL | SDL_strupr (char *string) |
DECLSPEC char *SDLCALL | SDL_strlwr (char *string) |
DECLSPEC char *SDLCALL | SDL_strchr (const char *string, int c) |
DECLSPEC char *SDLCALL | SDL_strrchr (const char *string, int c) |
DECLSPEC char *SDLCALL | SDL_strstr (const char *haystack, const char *needle) |
DECLSPEC char *SDLCALL | SDL_ltoa (long value, char *string, int radix) |
DECLSPEC char *SDLCALL | SDL_ultoa (unsigned long value, char *string, int radix) |
DECLSPEC long SDLCALL | SDL_strtol (const char *string, char **endp, int base) |
DECLSPEC unsigned long SDLCALL | SDL_strtoul (const char *string, char **endp, int base) |
DECLSPEC double SDLCALL | SDL_strtod (const char *string, char **endp) |
DECLSPEC int SDLCALL | SDL_strcmp (const char *str1, const char *str2) |
DECLSPEC int SDLCALL | SDL_strncmp (const char *str1, const char *str2, size_t maxlen) |
DECLSPEC int SDLCALL | SDL_strcasecmp (const char *str1, const char *str2) |
DECLSPEC int SDLCALL | SDL_strncasecmp (const char *str1, const char *str2, size_t maxlen) |
DECLSPEC int SDLCALL | SDL_sscanf (const char *text, const char *fmt,...) |
DECLSPEC int SDLCALL | SDL_snprintf (char *text, size_t maxlen, const char *fmt,...) |
DECLSPEC int SDLCALL | SDL_vsnprintf (char *text, size_t maxlen, const char *fmt, va_list ap) |
DECLSPEC SDL_iconv_t SDLCALL | SDL_iconv_open (const char *tocode, const char *fromcode) |
DECLSPEC int SDLCALL | SDL_iconv_close (SDL_iconv_t cd) |
DECLSPEC size_t SDLCALL | SDL_iconv (SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) |
DECLSPEC char *SDLCALL | SDL_iconv_string (const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft) |
Make sure the types really have the right sizes | |
#define | SDL_COMPILE_TIME_ASSERT(name, x) typedef int SDL_dummy_ ## name[(x) * 2 - 1] |
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) | |
Basic data types | |
enum | SDL_bool { SDL_FALSE = 0, SDL_TRUE = 1 } |
typedef int8_t | Sint8 |
typedef uint8_t | Uint8 |
typedef int16_t | Sint16 |
typedef uint16_t | Uint16 |
typedef int32_t | Sint32 |
typedef uint32_t | Uint32 |
typedef struct Uint64 | Sint64 |
Enum Size Check | |
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). | |
enum | SDL_DUMMY_ENUM { DUMMY_ENUM_VALUE } |
SDL_COMPILE_TIME_ASSERT (enum, sizeof(SDL_DUMMY_ENUM)==sizeof(int)) |
#define SDL_arraysize | ( | array | ) | (sizeof(array)/sizeof(array[0])) |
The number of elements in an array
#define SDL_memmove | ( | dst, | |||
src, | |||||
len | ) |
Value:
do { \ if ( dst < src ) { \ SDL_memcpy(dst, src, len); \ } else { \ SDL_revcpy(dst, src, len); \ } \ } while(0)
#define SDL_memset4 | ( | dst, | |||
val, | |||||
len | ) |
Value:
do { \ unsigned _count = (len); \ unsigned _n = (_count + 3) / 4; \ Uint32 *_p = (Uint32 *)(dst); \ Uint32 _val = (val); \ if (len == 0) break; \ switch (_count % 4) { \ case 0: do { *_p++ = _val; \ case 3: *_p++ = _val; \ case 2: *_p++ = _val; \ case 1: *_p++ = _val; \ } while ( --_n ); \ } \ } while(0)
DECLSPEC char* SDLCALL SDL_iconv_string | ( | const char * | tocode, | |
const char * | fromcode, | |||
const char * | inbuf, | |||
size_t | inbytesleft | |||
) |
This function converts a string between encodings in one pass, returning a string that must be freed with SDL_free() or NULL on error.