include/SDL_stdinc.h
changeset 1626 a80e1e0880b8
parent 1512 845b1619c8f6
child 1659 14717b52abc0
child 1769 290b5baf2fca
     1.1 --- a/include/SDL_stdinc.h	Thu Apr 13 13:30:21 2006 +0000
     1.2 +++ b/include/SDL_stdinc.h	Thu Apr 13 13:38:40 2006 +0000
     1.3 @@ -28,49 +28,47 @@
     1.4  #include "SDL_config.h"
     1.5  
     1.6  
     1.7 -#if HAVE_SYS_TYPES_H
     1.8 +#ifdef HAVE_SYS_TYPES_H
     1.9  #include <sys/types.h>
    1.10  #endif
    1.11 -#if HAVE_STDIO_H
    1.12 +#ifdef HAVE_STDIO_H
    1.13  #include <stdio.h>
    1.14  #endif
    1.15 -#if STDC_HEADERS
    1.16 +#if defined(STDC_HEADERS)
    1.17  # include <stdlib.h>
    1.18  # include <stddef.h>
    1.19  # include <stdarg.h>
    1.20  #else
    1.21 -# if HAVE_STDLIB_H
    1.22 -# include <stdlib.h>
    1.23 -# elif HAVE_MALLOC_H
    1.24 -# include <malloc.h>
    1.25 +# if defined(HAVE_STDLIB_H)
    1.26 +#  include <stdlib.h>
    1.27 +# elif defined(HAVE_MALLOC_H)
    1.28 +#  include <malloc.h>
    1.29  # endif
    1.30 -# if HAVE_STDDEF_H
    1.31 -# include <stddef.h>
    1.32 +# if defined(HAVE_STDDEF_H)
    1.33 +#  include <stddef.h>
    1.34  # endif
    1.35 -# if HAVE_STDARG_H
    1.36 -# include <stdarg.h>
    1.37 +# if defined(HAVE_STDARG_H)
    1.38 +#  include <stdarg.h>
    1.39  # endif
    1.40  #endif
    1.41 -#if HAVE_STRING_H
    1.42 -# if !STDC_HEADERS && HAVE_MEMORY_H
    1.43 -# include <memory.h>
    1.44 +#ifdef HAVE_STRING_H
    1.45 +# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
    1.46 +#  include <memory.h>
    1.47  # endif
    1.48  # include <string.h>
    1.49  #endif
    1.50 -#if HAVE_STRINGS_H
    1.51 +#ifdef HAVE_STRINGS_H
    1.52  # include <strings.h>
    1.53  #endif
    1.54 -#if HAVE_INTTYPES_H
    1.55 +#if defined(HAVE_INTTYPES_H)
    1.56  # include <inttypes.h>
    1.57 -#else
    1.58 -# if HAVE_STDINT_H
    1.59 +#elif defined(HAVE_STDINT_H)
    1.60  # include <stdint.h>
    1.61 -# endif
    1.62  #endif
    1.63 -#if HAVE_CTYPE_H
    1.64 +#ifdef HAVE_CTYPE_H
    1.65  # include <ctype.h>
    1.66  #endif
    1.67 -#if HAVE_ICONV_H
    1.68 +#ifdef HAVE_ICONV_H
    1.69  # include <iconv.h>
    1.70  #endif
    1.71  
    1.72 @@ -138,32 +136,32 @@
    1.73  extern "C" {
    1.74  #endif
    1.75  
    1.76 -#if HAVE_MALLOC
    1.77 +#ifdef HAVE_MALLOC
    1.78  #define SDL_malloc	malloc
    1.79  #else
    1.80  extern DECLSPEC void * SDLCALL SDL_malloc(size_t size);
    1.81  #endif
    1.82  
    1.83 -#if HAVE_CALLOC
    1.84 +#ifdef HAVE_CALLOC
    1.85  #define SDL_calloc	calloc
    1.86  #else
    1.87  extern DECLSPEC void * SDLCALL SDL_calloc(size_t nmemb, size_t size);
    1.88  #endif
    1.89  
    1.90 -#if HAVE_REALLOC
    1.91 +#ifdef HAVE_REALLOC
    1.92  #define SDL_realloc	realloc
    1.93  #else
    1.94  extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size);
    1.95  #endif
    1.96  
    1.97 -#if HAVE_FREE
    1.98 +#ifdef HAVE_FREE
    1.99  #define SDL_free	free
   1.100  #else
   1.101  extern DECLSPEC void SDLCALL SDL_free(void *mem);
   1.102  #endif
   1.103  
   1.104 -#if HAVE_ALLOCA && !defined(alloca)
   1.105 -# if HAVE_ALLOCA_H
   1.106 +#if defined(HAVE_ALLOCA) && !defined(alloca)
   1.107 +# if defined(HAVE_ALLOCA_H)
   1.108  #  include <alloca.h>
   1.109  # elif defined(__GNUC__)
   1.110  #  define alloca __builtin_alloca
   1.111 @@ -176,7 +174,7 @@
   1.112     char *alloca ();
   1.113  # endif
   1.114  #endif
   1.115 -#if HAVE_ALLOCA
   1.116 +#ifdef HAVE_ALLOCA
   1.117  #define SDL_stack_alloc(type, count)    (type*)alloca(sizeof(type)*count)
   1.118  #define SDL_stack_free(data)
   1.119  #else
   1.120 @@ -184,26 +182,26 @@
   1.121  #define SDL_stack_free(data)            SDL_free(data)
   1.122  #endif
   1.123  
   1.124 -#if HAVE_GETENV
   1.125 +#ifdef HAVE_GETENV
   1.126  #define SDL_getenv	getenv
   1.127  #else
   1.128  extern DECLSPEC char * SDLCALL SDL_getenv(const char *name);
   1.129  #endif
   1.130  
   1.131 -#if HAVE_PUTENV
   1.132 +#ifdef HAVE_PUTENV
   1.133  #define SDL_putenv	putenv
   1.134  #else
   1.135  extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
   1.136  #endif
   1.137  
   1.138 -#if HAVE_QSORT
   1.139 +#ifdef HAVE_QSORT
   1.140  #define SDL_qsort	qsort
   1.141  #else
   1.142  extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
   1.143             int (*compare)(const void *, const void *));
   1.144  #endif
   1.145  
   1.146 -#if HAVE_ABS
   1.147 +#ifdef HAVE_ABS
   1.148  #define SDL_abs		abs
   1.149  #else
   1.150  #define SDL_abs(X)	((X) < 0 ? -(X) : (X))
   1.151 @@ -212,7 +210,7 @@
   1.152  #define SDL_min(x, y)	(((x) < (y)) ? (x) : (y))
   1.153  #define SDL_max(x, y)	(((x) > (y)) ? (x) : (y))
   1.154  
   1.155 -#if HAVE_CTYPE_H
   1.156 +#ifdef HAVE_CTYPE_H
   1.157  #define SDL_isdigit(X)  isdigit(X)
   1.158  #define SDL_isspace(X)  isspace(X)
   1.159  #define SDL_toupper(X)  toupper(X)
   1.160 @@ -224,7 +222,7 @@
   1.161  #define SDL_tolower(X)  (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X))
   1.162  #endif
   1.163  
   1.164 -#if HAVE_MEMSET
   1.165 +#ifdef HAVE_MEMSET
   1.166  #define SDL_memset      memset
   1.167  #else
   1.168  extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len);
   1.169 @@ -279,9 +277,9 @@
   1.170  } while(0)
   1.171  #endif
   1.172  #ifndef SDL_memcpy
   1.173 -#if HAVE_MEMCPY
   1.174 +#ifdef HAVE_MEMCPY
   1.175  #define SDL_memcpy      memcpy
   1.176 -#elif HAVE_BCOPY
   1.177 +#elif defined(HAVE_BCOPY)
   1.178  #define SDL_memcpy(d, s, n)	bcopy((s), (d), (n))
   1.179  #else
   1.180  extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len);
   1.181 @@ -334,9 +332,9 @@
   1.182  extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len);
   1.183  #endif
   1.184  
   1.185 -#if HAVE_MEMMOVE
   1.186 +#ifdef HAVE_MEMMOVE
   1.187  #define SDL_memmove     memmove
   1.188 -#elif HAVE_BCOPY
   1.189 +#elif defined(HAVE_BCOPY)
   1.190  #define SDL_memmove(d, s, n)	bcopy((s), (d), (n))
   1.191  #else
   1.192  #define SDL_memmove(dst, src, len)			\
   1.193 @@ -349,133 +347,133 @@
   1.194  } while(0)
   1.195  #endif
   1.196  
   1.197 -#if HAVE_MEMCMP
   1.198 +#ifdef HAVE_MEMCMP
   1.199  #define SDL_memcmp      memcmp
   1.200  #else
   1.201  extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
   1.202  #endif
   1.203  
   1.204 -#if HAVE_STRLEN
   1.205 +#ifdef HAVE_STRLEN
   1.206  #define SDL_strlen      strlen
   1.207  #else
   1.208  extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
   1.209  #endif
   1.210  
   1.211 -#if HAVE_STRLCPY
   1.212 +#ifdef HAVE_STRLCPY
   1.213  #define SDL_strlcpy     strlcpy
   1.214  #else
   1.215  extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen);
   1.216  #endif
   1.217  
   1.218 -#if HAVE_STRLCAT
   1.219 +#ifdef HAVE_STRLCAT
   1.220  #define SDL_strlcat    strlcat
   1.221  #else
   1.222  extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen);
   1.223  #endif
   1.224  
   1.225 -#if HAVE_STRDUP
   1.226 +#ifdef HAVE_STRDUP
   1.227  #define SDL_strdup     strdup
   1.228  #else
   1.229  extern DECLSPEC char * SDLCALL SDL_strdup(const char *string);
   1.230  #endif
   1.231  
   1.232 -#if HAVE__STRREV
   1.233 +#ifdef HAVE__STRREV
   1.234  #define SDL_strrev      _strrev
   1.235  #else
   1.236  extern DECLSPEC char * SDLCALL SDL_strrev(char *string);
   1.237  #endif
   1.238  
   1.239 -#if HAVE__STRUPR
   1.240 +#ifdef HAVE__STRUPR
   1.241  #define SDL_strupr      _strupr
   1.242  #else
   1.243  extern DECLSPEC char * SDLCALL SDL_strupr(char *string);
   1.244  #endif
   1.245  
   1.246 -#if HAVE__STRLWR
   1.247 +#ifdef HAVE__STRLWR
   1.248  #define SDL_strlwr      _strlwr
   1.249  #else
   1.250  extern DECLSPEC char * SDLCALL SDL_strlwr(char *string);
   1.251  #endif
   1.252  
   1.253 -#if HAVE_STRCHR
   1.254 +#ifdef HAVE_STRCHR
   1.255  #define SDL_strchr      strchr
   1.256 -#elif HAVE_INDEX
   1.257 +#elif defined(HAVE_INDEX)
   1.258  #define SDL_strchr      index
   1.259  #else
   1.260  extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c);
   1.261  #endif
   1.262  
   1.263 -#if HAVE_STRRCHR
   1.264 +#ifdef HAVE_STRRCHR
   1.265  #define SDL_strrchr     strrchr
   1.266 -#elif HAVE_RINDEX
   1.267 +#elif defined(HAVE_RINDEX)
   1.268  #define SDL_strrchr     rindex
   1.269  #else
   1.270  extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c);
   1.271  #endif
   1.272  
   1.273 -#if HAVE_STRSTR
   1.274 +#ifdef HAVE_STRSTR
   1.275  #define SDL_strstr      strstr
   1.276  #else
   1.277  extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle);
   1.278  #endif
   1.279  
   1.280 -#if HAVE_ITOA
   1.281 +#ifdef HAVE_ITOA
   1.282  #define SDL_itoa        itoa
   1.283  #else
   1.284  #define SDL_itoa(value, string, radix)	SDL_ltoa((long)value, string, radix)
   1.285  #endif
   1.286  
   1.287 -#if HAVE__LTOA
   1.288 +#ifdef HAVE__LTOA
   1.289  #define SDL_ltoa        _ltoa
   1.290  #else
   1.291  extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix);
   1.292  #endif
   1.293  
   1.294 -#if HAVE__UITOA
   1.295 +#ifdef HAVE__UITOA
   1.296  #define SDL_uitoa       _uitoa
   1.297  #else
   1.298  #define SDL_uitoa(value, string, radix)	SDL_ultoa((long)value, string, radix)
   1.299  #endif
   1.300  
   1.301 -#if HAVE__ULTOA
   1.302 +#ifdef HAVE__ULTOA
   1.303  #define SDL_ultoa       _ultoa
   1.304  #else
   1.305  extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix);
   1.306  #endif
   1.307  
   1.308 -#if HAVE_STRTOL
   1.309 +#ifdef HAVE_STRTOL
   1.310  #define SDL_strtol      strtol
   1.311  #else
   1.312  extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base);
   1.313  #endif
   1.314  
   1.315 -#if HAVE_STRTOUL
   1.316 +#ifdef HAVE_STRTOUL
   1.317  #define SDL_strtoul      strtoul
   1.318  #else
   1.319  extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base);
   1.320  #endif
   1.321  
   1.322 -#if SDL_HAS_64BIT_TYPE
   1.323 +#ifdef SDL_HAS_64BIT_TYPE
   1.324  
   1.325 -#if HAVE__I64TOA
   1.326 +#ifdef HAVE__I64TOA
   1.327  #define SDL_lltoa       _i64toa
   1.328  #else
   1.329  extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix);
   1.330  #endif
   1.331  
   1.332 -#if HAVE__UI64TOA
   1.333 +#ifdef HAVE__UI64TOA
   1.334  #define SDL_ulltoa      _ui64toa
   1.335  #else
   1.336  extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix);
   1.337  #endif
   1.338  
   1.339 -#if HAVE_STRTOLL
   1.340 +#ifdef HAVE_STRTOLL
   1.341  #define SDL_strtoll     strtoll
   1.342  #else
   1.343  extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base);
   1.344  #endif
   1.345  
   1.346 -#if HAVE_STRTOULL
   1.347 +#ifdef HAVE_STRTOULL
   1.348  #define SDL_strtoull     strtoull
   1.349  #else
   1.350  extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base);
   1.351 @@ -483,65 +481,65 @@
   1.352  
   1.353  #endif /* SDL_HAS_64BIT_TYPE */
   1.354  
   1.355 -#if HAVE_STRTOD
   1.356 +#ifdef HAVE_STRTOD
   1.357  #define SDL_strtod      strtod
   1.358  #else
   1.359  extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp);
   1.360  #endif
   1.361  
   1.362 -#if HAVE_ATOI
   1.363 +#ifdef HAVE_ATOI
   1.364  #define SDL_atoi        atoi
   1.365  #else
   1.366  #define SDL_atoi(X)     SDL_strtol(X, NULL, 0)
   1.367  #endif
   1.368  
   1.369 -#if HAVE_ATOF
   1.370 +#ifdef HAVE_ATOF
   1.371  #define SDL_atof        atof
   1.372  #else
   1.373  #define SDL_atof(X)     SDL_strtod(X, NULL)
   1.374  #endif
   1.375  
   1.376 -#if HAVE_STRCMP
   1.377 +#ifdef HAVE_STRCMP
   1.378  #define SDL_strcmp      strcmp
   1.379  #else
   1.380  extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
   1.381  #endif
   1.382  
   1.383 -#if HAVE_STRNCMP
   1.384 +#ifdef HAVE_STRNCMP
   1.385  #define SDL_strncmp     strncmp
   1.386  #else
   1.387  extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
   1.388  #endif
   1.389  
   1.390 -#if HAVE_STRCASECMP
   1.391 +#ifdef HAVE_STRCASECMP
   1.392  #define SDL_strcasecmp  strcasecmp
   1.393 -#elif HAVE__STRICMP
   1.394 +#elif defined(HAVE__STRICMP)
   1.395  #define SDL_strcasecmp  _stricmp
   1.396  #else
   1.397  extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
   1.398  #endif
   1.399  
   1.400 -#if HAVE_STRNCASECMP
   1.401 +#ifdef HAVE_STRNCASECMP
   1.402  #define SDL_strncasecmp strncasecmp
   1.403 -#elif HAVE__STRNICMP
   1.404 +#elif defined(HAVE__STRNICMP)
   1.405  #define SDL_strncasecmp _strnicmp
   1.406  #else
   1.407  extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen);
   1.408  #endif
   1.409  
   1.410 -#if HAVE_SSCANF
   1.411 +#ifdef HAVE_SSCANF
   1.412  #define SDL_sscanf      sscanf
   1.413  #else
   1.414  extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...);
   1.415  #endif
   1.416  
   1.417 -#if HAVE_SNPRINTF
   1.418 +#ifdef HAVE_SNPRINTF
   1.419  #define SDL_snprintf    snprintf
   1.420  #else
   1.421  extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...);
   1.422  #endif
   1.423  
   1.424 -#if HAVE_VSNPRINTF
   1.425 +#ifdef HAVE_VSNPRINTF
   1.426  #define SDL_vsnprintf   vsnprintf
   1.427  #else
   1.428  extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap);
   1.429 @@ -553,7 +551,7 @@
   1.430  #define SDL_ICONV_EILSEQ	(size_t)-3
   1.431  #define SDL_ICONV_EINVAL	(size_t)-4
   1.432  
   1.433 -#if HAVE_ICONV
   1.434 +#ifdef HAVE_ICONV
   1.435  #define SDL_iconv_t     iconv_t
   1.436  #define SDL_iconv_open  iconv_open
   1.437  #define SDL_iconv_close iconv_close