Mercurial > sdl-ios-xcode
diff include/SDL_stdinc.h @ 1662:782fd950bd46 SDL-1.3
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.
The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce
The headers are being converted to automatically generate doxygen documentation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 28 May 2006 13:04:16 +0000 |
parents | 14717b52abc0 |
children | 4da1ee79c9af |
line wrap: on
line diff
--- a/include/SDL_stdinc.h Sun May 21 17:27:13 2006 +0000 +++ b/include/SDL_stdinc.h Sun May 28 13:04:16 2006 +0000 @@ -20,7 +20,11 @@ slouken@libsdl.org */ -/* This is a general header that includes C language support */ +/** + * \file SDL_stdinc.h + * + * This is a general header that includes C language support + */ #ifndef _SDL_stdinc_h #define _SDL_stdinc_h @@ -77,41 +81,75 @@ #define SDL_TABLESIZE(table) SDL_arraysize(table) /* Basic data types */ -typedef enum SDL_bool { - SDL_FALSE = 0, - SDL_TRUE = 1 +typedef enum SDL_bool +{ + SDL_FALSE = 0, + SDL_TRUE = 1 } SDL_bool; -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 Sint8 + * \brief A signed 8-bit integer type. + */ +typedef int8_t Sint8; +/** + * \typedef Uint8 + * \brief An unsigned 8-bit integer type. + */ +typedef uint8_t Uint8; +/** + * \typedef Sint16 + * \brief A signed 16-bit integer type. + */ +typedef int16_t Sint16; +/** + * \typedef Uint16 + * \brief An unsigned 16-bit integer type. + */ +typedef uint16_t Uint16; +/** + * \typedef Sint32 + * \brief A signed 32-bit integer type. + */ +typedef int32_t Sint32; +/** + * \typedef Uint32 + * \brief An unsigned 32-bit integer type. + */ +typedef uint32_t Uint32; #ifdef SDL_HAS_64BIT_TYPE -typedef int64_t Sint64; -typedef uint64_t Uint64; +/** + * \typedef Sint64 + * \brief A signed 64-bit integer type. + * \warning On platforms without any sort of 64-bit datatype, this is equivalent to Sint32! + */ +typedef int64_t Sint64; +/** + * \typedef Uint64 + * \brief An unsigned 64-bit integer type. + * \warning On platforms without any sort of 64-bit datatype, this is equivalent to Uint32! + */ +typedef uint64_t Uint64; #else /* This is really just a hack to prevent the compiler from complaining */ -typedef struct { - Uint32 hi; - Uint32 lo; -} Uint64, Sint64; +typdef Sint32 Sint64; +typdef Uint32 Uint32; #endif /* 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); +#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 */ /* 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 @@ -123,41 +161,45 @@ #pragma enumsalwaysint on #endif -typedef enum { - DUMMY_ENUM_VALUE +#ifndef DOXYGEN_SHOULD_IGNORE_THIS +typedef enum +{ + DUMMY_ENUM_VALUE } SDL_DUMMY_ENUM; -SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); - +SDL_COMPILE_TIME_ASSERT (enum, sizeof (SDL_DUMMY_ENUM) == sizeof (int)); +#endif /* DOXYGEN_SHOULD_IGNORE_THIS */ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus +/* *INDENT-OFF* */ extern "C" { +/* *INDENT-ON* */ #endif #ifdef HAVE_MALLOC #define SDL_malloc malloc #else -extern DECLSPEC void * SDLCALL SDL_malloc(size_t size); +extern DECLSPEC void *SDLCALL SDL_malloc (size_t size); #endif #ifdef HAVE_CALLOC #define SDL_calloc calloc #else -extern DECLSPEC void * SDLCALL SDL_calloc(size_t nmemb, size_t size); +extern DECLSPEC void *SDLCALL SDL_calloc (size_t nmemb, size_t size); #endif #ifdef HAVE_REALLOC #define SDL_realloc realloc #else -extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size); +extern DECLSPEC void *SDLCALL SDL_realloc (void *mem, size_t size); #endif #ifdef HAVE_FREE #define SDL_free free #else -extern DECLSPEC void SDLCALL SDL_free(void *mem); +extern DECLSPEC void SDLCALL SDL_free (void *mem); #endif #if defined(HAVE_ALLOCA) && !defined(alloca) @@ -171,11 +213,11 @@ # elif defined(__WATCOMC__) # include <malloc.h> # elif defined(__AIX__) - #pragma alloca +#pragma alloca # elif defined(__MRC__) - void *alloca (unsigned); +void *alloca (unsigned); # else - char *alloca (); +char *alloca (); # endif #endif #ifdef HAVE_ALLOCA @@ -189,20 +231,21 @@ #ifdef HAVE_GETENV #define SDL_getenv getenv #else -extern DECLSPEC char * SDLCALL SDL_getenv(const char *name); +extern DECLSPEC char *SDLCALL SDL_getenv (const char *name); #endif #ifdef HAVE_PUTENV #define SDL_putenv putenv #else -extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); +extern DECLSPEC int SDLCALL SDL_putenv (const char *variable); #endif #ifdef HAVE_QSORT #define SDL_qsort qsort #else -extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, - int (*compare)(const void *, const void *)); +extern DECLSPEC void SDLCALL SDL_qsort (void *base, size_t nmemb, size_t size, + int (*compare) (const void *, + const void *)); #endif #ifdef HAVE_ABS @@ -229,8 +272,10 @@ #ifdef HAVE_MEMSET #define SDL_memset memset #else -extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len); +extern DECLSPEC void *SDLCALL SDL_memset (void *dst, int c, size_t len); #endif +#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) +#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) #if defined(__GNUC__) && defined(i386) #define SDL_memset4(dst, val, len) \ @@ -286,7 +331,8 @@ #elif defined(HAVE_BCOPY) #define SDL_memcpy(d, s, n) bcopy((s), (d), (n)) #else -extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len); +extern DECLSPEC void *SDLCALL SDL_memcpy (void *dst, const void *src, + size_t len); #endif #endif @@ -333,7 +379,8 @@ } while(0) #endif #ifndef SDL_revcpy -extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len); +extern DECLSPEC void *SDLCALL SDL_revcpy (void *dst, const void *src, + size_t len); #endif #ifdef HAVE_MEMMOVE @@ -354,49 +401,52 @@ #ifdef HAVE_MEMCMP #define SDL_memcmp memcmp #else -extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); +extern DECLSPEC int SDLCALL SDL_memcmp (const void *s1, const void *s2, + size_t len); #endif #ifdef HAVE_STRLEN #define SDL_strlen strlen #else -extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string); +extern DECLSPEC size_t SDLCALL SDL_strlen (const char *string); #endif #ifdef HAVE_STRLCPY #define SDL_strlcpy strlcpy #else -extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen); +extern DECLSPEC size_t SDLCALL SDL_strlcpy (char *dst, const char *src, + size_t maxlen); #endif #ifdef HAVE_STRLCAT #define SDL_strlcat strlcat #else -extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen); +extern DECLSPEC size_t SDLCALL SDL_strlcat (char *dst, const char *src, + size_t maxlen); #endif #ifdef HAVE_STRDUP #define SDL_strdup strdup #else -extern DECLSPEC char * SDLCALL SDL_strdup(const char *string); +extern DECLSPEC char *SDLCALL SDL_strdup (const char *string); #endif #ifdef HAVE__STRREV #define SDL_strrev _strrev #else -extern DECLSPEC char * SDLCALL SDL_strrev(char *string); +extern DECLSPEC char *SDLCALL SDL_strrev (char *string); #endif #ifdef HAVE__STRUPR #define SDL_strupr _strupr #else -extern DECLSPEC char * SDLCALL SDL_strupr(char *string); +extern DECLSPEC char *SDLCALL SDL_strupr (char *string); #endif #ifdef HAVE__STRLWR #define SDL_strlwr _strlwr #else -extern DECLSPEC char * SDLCALL SDL_strlwr(char *string); +extern DECLSPEC char *SDLCALL SDL_strlwr (char *string); #endif #ifdef HAVE_STRCHR @@ -404,7 +454,7 @@ #elif defined(HAVE_INDEX) #define SDL_strchr index #else -extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c); +extern DECLSPEC char *SDLCALL SDL_strchr (const char *string, int c); #endif #ifdef HAVE_STRRCHR @@ -412,13 +462,14 @@ #elif defined(HAVE_RINDEX) #define SDL_strrchr rindex #else -extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c); +extern DECLSPEC char *SDLCALL SDL_strrchr (const char *string, int c); #endif #ifdef HAVE_STRSTR #define SDL_strstr strstr #else -extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle); +extern DECLSPEC char *SDLCALL SDL_strstr (const char *haystack, + const char *needle); #endif #ifdef HAVE_ITOA @@ -430,7 +481,7 @@ #ifdef HAVE__LTOA #define SDL_ltoa _ltoa #else -extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix); +extern DECLSPEC char *SDLCALL SDL_ltoa (long value, char *string, int radix); #endif #ifdef HAVE__UITOA @@ -442,19 +493,22 @@ #ifdef HAVE__ULTOA #define SDL_ultoa _ultoa #else -extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix); +extern DECLSPEC char *SDLCALL SDL_ultoa (unsigned long value, char *string, + int radix); #endif #ifdef HAVE_STRTOL #define SDL_strtol strtol #else -extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base); +extern DECLSPEC long SDLCALL SDL_strtol (const char *string, char **endp, + int base); #endif #ifdef HAVE_STRTOUL #define SDL_strtoul strtoul #else -extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base); +extern DECLSPEC unsigned long SDLCALL SDL_strtoul (const char *string, + char **endp, int base); #endif #ifdef SDL_HAS_64BIT_TYPE @@ -462,25 +516,29 @@ #ifdef HAVE__I64TOA #define SDL_lltoa _i64toa #else -extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix); +extern DECLSPEC char *SDLCALL SDL_lltoa (Sint64 value, char *string, + int radix); #endif #ifdef HAVE__UI64TOA #define SDL_ulltoa _ui64toa #else -extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix); +extern DECLSPEC char *SDLCALL SDL_ulltoa (Uint64 value, char *string, + int radix); #endif #ifdef HAVE_STRTOLL #define SDL_strtoll strtoll #else -extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base); +extern DECLSPEC Sint64 SDLCALL SDL_strtoll (const char *string, char **endp, + int base); #endif #ifdef HAVE_STRTOULL #define SDL_strtoull strtoull #else -extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base); +extern DECLSPEC Uint64 SDLCALL SDL_strtoull (const char *string, char **endp, + int base); #endif #endif /* SDL_HAS_64BIT_TYPE */ @@ -488,7 +546,7 @@ #ifdef HAVE_STRTOD #define SDL_strtod strtod #else -extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp); +extern DECLSPEC double SDLCALL SDL_strtod (const char *string, char **endp); #endif #ifdef HAVE_ATOI @@ -506,13 +564,14 @@ #ifdef HAVE_STRCMP #define SDL_strcmp strcmp #else -extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); +extern DECLSPEC int SDLCALL SDL_strcmp (const char *str1, const char *str2); #endif #ifdef HAVE_STRNCMP #define SDL_strncmp strncmp #else -extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); +extern DECLSPEC int SDLCALL SDL_strncmp (const char *str1, const char *str2, + size_t maxlen); #endif #ifdef HAVE_STRCASECMP @@ -520,7 +579,8 @@ #elif defined(HAVE__STRICMP) #define SDL_strcasecmp _stricmp #else -extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); +extern DECLSPEC int SDLCALL SDL_strcasecmp (const char *str1, + const char *str2); #endif #ifdef HAVE_STRNCASECMP @@ -528,25 +588,29 @@ #elif defined(HAVE__STRNICMP) #define SDL_strncasecmp _strnicmp #else -extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen); +extern DECLSPEC int SDLCALL SDL_strncasecmp (const char *str1, + const char *str2, size_t maxlen); #endif #ifdef HAVE_SSCANF #define SDL_sscanf sscanf #else -extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...); +extern DECLSPEC int SDLCALL SDL_sscanf (const char *text, const char *fmt, + ...); #endif #ifdef HAVE_SNPRINTF #define SDL_snprintf snprintf #else -extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); +extern DECLSPEC int SDLCALL SDL_snprintf (char *text, size_t maxlen, + const char *fmt, ...); #endif #ifdef HAVE_VSNPRINTF #define SDL_vsnprintf vsnprintf #else -extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); +extern DECLSPEC int SDLCALL SDL_vsnprintf (char *text, size_t maxlen, + const char *fmt, va_list ap); #endif /* The SDL implementation of iconv() returns these error codes */ @@ -559,17 +623,25 @@ #define SDL_iconv_t iconv_t #define SDL_iconv_open iconv_open #define SDL_iconv_close iconv_close -extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); +extern DECLSPEC size_t SDLCALL SDL_iconv (SDL_iconv_t cd, char **inbuf, + size_t * inbytesleft, char **outbuf, + size_t * outbytesleft); #else 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, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); +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, char **inbuf, + size_t * inbytesleft, char **outbuf, + size_t * outbytesleft); #endif /* 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, char *inbuf, size_t inbytesleft); +extern DECLSPEC char *SDLCALL SDL_iconv_string (const char *tocode, + const char *fromcode, + char *inbuf, + size_t inbytesleft); #define SDL_iconv_utf8_ascii(S) SDL_iconv_string("ASCII", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_latin1(S) SDL_iconv_string("LATIN1", "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) @@ -577,8 +649,12 @@ /* Ends C function definitions when using C++ */ #ifdef __cplusplus +/* *INDENT-OFF* */ } +/* *INDENT-ON* */ #endif #include "close_code.h" #endif /* _SDL_stdinc_h */ + +/* vi: set ts=4 sw=4 expandtab: */