Mercurial > sdl-ios-xcode
comparison include/SDL_stdinc.h @ 1626:a80e1e0880b8
Fixed bug #176
[I'm fixing this for the public headers, but I'm not going to bother for the SDL library code (yet)]
To clarify: Normaly, GCC (or, to be precise, the preprocessor) will ignore
this, and compile the code happily. However, one can specify -Wundef to get a
warning about this.
One can probably argue whether to consider this a bug or not; but I think that
(a) from a semantic point of view, using "#if FOO" when FOO is not defined is
strange, and (b) since it is possible to trigger a warning about this, and a
trivial fix exists, it should be corrected.
I can think of two alternative patches, BTW:
1) Simply use #define HAVE_FOO 0, instead of not defining HAVE_FOO at all
2) Change
#if HAVE_FOO
to
#if HAVE_FOO+0
which always does the right thing.
But I think I still prefer the attached patch :-).
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 13 Apr 2006 13:38:40 +0000 |
parents | 845b1619c8f6 |
children | 14717b52abc0 290b5baf2fca |
comparison
equal
deleted
inserted
replaced
1625:7e89aa7843c5 | 1626:a80e1e0880b8 |
---|---|
26 #define _SDL_stdinc_h | 26 #define _SDL_stdinc_h |
27 | 27 |
28 #include "SDL_config.h" | 28 #include "SDL_config.h" |
29 | 29 |
30 | 30 |
31 #if HAVE_SYS_TYPES_H | 31 #ifdef HAVE_SYS_TYPES_H |
32 #include <sys/types.h> | 32 #include <sys/types.h> |
33 #endif | 33 #endif |
34 #if HAVE_STDIO_H | 34 #ifdef HAVE_STDIO_H |
35 #include <stdio.h> | 35 #include <stdio.h> |
36 #endif | 36 #endif |
37 #if STDC_HEADERS | 37 #if defined(STDC_HEADERS) |
38 # include <stdlib.h> | 38 # include <stdlib.h> |
39 # include <stddef.h> | 39 # include <stddef.h> |
40 # include <stdarg.h> | 40 # include <stdarg.h> |
41 #else | 41 #else |
42 # if HAVE_STDLIB_H | 42 # if defined(HAVE_STDLIB_H) |
43 # include <stdlib.h> | 43 # include <stdlib.h> |
44 # elif HAVE_MALLOC_H | 44 # elif defined(HAVE_MALLOC_H) |
45 # include <malloc.h> | 45 # include <malloc.h> |
46 # endif | 46 # endif |
47 # if HAVE_STDDEF_H | 47 # if defined(HAVE_STDDEF_H) |
48 # include <stddef.h> | 48 # include <stddef.h> |
49 # endif | 49 # endif |
50 # if HAVE_STDARG_H | 50 # if defined(HAVE_STDARG_H) |
51 # include <stdarg.h> | 51 # include <stdarg.h> |
52 # endif | 52 # endif |
53 #endif | 53 #endif |
54 #if HAVE_STRING_H | 54 #ifdef HAVE_STRING_H |
55 # if !STDC_HEADERS && HAVE_MEMORY_H | 55 # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) |
56 # include <memory.h> | 56 # include <memory.h> |
57 # endif | 57 # endif |
58 # include <string.h> | 58 # include <string.h> |
59 #endif | 59 #endif |
60 #if HAVE_STRINGS_H | 60 #ifdef HAVE_STRINGS_H |
61 # include <strings.h> | 61 # include <strings.h> |
62 #endif | 62 #endif |
63 #if HAVE_INTTYPES_H | 63 #if defined(HAVE_INTTYPES_H) |
64 # include <inttypes.h> | 64 # include <inttypes.h> |
65 #else | 65 #elif defined(HAVE_STDINT_H) |
66 # if HAVE_STDINT_H | |
67 # include <stdint.h> | 66 # include <stdint.h> |
68 # endif | 67 #endif |
69 #endif | 68 #ifdef HAVE_CTYPE_H |
70 #if HAVE_CTYPE_H | |
71 # include <ctype.h> | 69 # include <ctype.h> |
72 #endif | 70 #endif |
73 #if HAVE_ICONV_H | 71 #ifdef HAVE_ICONV_H |
74 # include <iconv.h> | 72 # include <iconv.h> |
75 #endif | 73 #endif |
76 | 74 |
77 /* The number of elements in an array */ | 75 /* The number of elements in an array */ |
78 #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) | 76 #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) |
136 /* Set up for C function definitions, even when using C++ */ | 134 /* Set up for C function definitions, even when using C++ */ |
137 #ifdef __cplusplus | 135 #ifdef __cplusplus |
138 extern "C" { | 136 extern "C" { |
139 #endif | 137 #endif |
140 | 138 |
141 #if HAVE_MALLOC | 139 #ifdef HAVE_MALLOC |
142 #define SDL_malloc malloc | 140 #define SDL_malloc malloc |
143 #else | 141 #else |
144 extern DECLSPEC void * SDLCALL SDL_malloc(size_t size); | 142 extern DECLSPEC void * SDLCALL SDL_malloc(size_t size); |
145 #endif | 143 #endif |
146 | 144 |
147 #if HAVE_CALLOC | 145 #ifdef HAVE_CALLOC |
148 #define SDL_calloc calloc | 146 #define SDL_calloc calloc |
149 #else | 147 #else |
150 extern DECLSPEC void * SDLCALL SDL_calloc(size_t nmemb, size_t size); | 148 extern DECLSPEC void * SDLCALL SDL_calloc(size_t nmemb, size_t size); |
151 #endif | 149 #endif |
152 | 150 |
153 #if HAVE_REALLOC | 151 #ifdef HAVE_REALLOC |
154 #define SDL_realloc realloc | 152 #define SDL_realloc realloc |
155 #else | 153 #else |
156 extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size); | 154 extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size); |
157 #endif | 155 #endif |
158 | 156 |
159 #if HAVE_FREE | 157 #ifdef HAVE_FREE |
160 #define SDL_free free | 158 #define SDL_free free |
161 #else | 159 #else |
162 extern DECLSPEC void SDLCALL SDL_free(void *mem); | 160 extern DECLSPEC void SDLCALL SDL_free(void *mem); |
163 #endif | 161 #endif |
164 | 162 |
165 #if HAVE_ALLOCA && !defined(alloca) | 163 #if defined(HAVE_ALLOCA) && !defined(alloca) |
166 # if HAVE_ALLOCA_H | 164 # if defined(HAVE_ALLOCA_H) |
167 # include <alloca.h> | 165 # include <alloca.h> |
168 # elif defined(__GNUC__) | 166 # elif defined(__GNUC__) |
169 # define alloca __builtin_alloca | 167 # define alloca __builtin_alloca |
170 # elif defined(_MSC_VER) | 168 # elif defined(_MSC_VER) |
171 # include <malloc.h> | 169 # include <malloc.h> |
174 #pragma alloca | 172 #pragma alloca |
175 # else | 173 # else |
176 char *alloca (); | 174 char *alloca (); |
177 # endif | 175 # endif |
178 #endif | 176 #endif |
179 #if HAVE_ALLOCA | 177 #ifdef HAVE_ALLOCA |
180 #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count) | 178 #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count) |
181 #define SDL_stack_free(data) | 179 #define SDL_stack_free(data) |
182 #else | 180 #else |
183 #define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*count) | 181 #define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*count) |
184 #define SDL_stack_free(data) SDL_free(data) | 182 #define SDL_stack_free(data) SDL_free(data) |
185 #endif | 183 #endif |
186 | 184 |
187 #if HAVE_GETENV | 185 #ifdef HAVE_GETENV |
188 #define SDL_getenv getenv | 186 #define SDL_getenv getenv |
189 #else | 187 #else |
190 extern DECLSPEC char * SDLCALL SDL_getenv(const char *name); | 188 extern DECLSPEC char * SDLCALL SDL_getenv(const char *name); |
191 #endif | 189 #endif |
192 | 190 |
193 #if HAVE_PUTENV | 191 #ifdef HAVE_PUTENV |
194 #define SDL_putenv putenv | 192 #define SDL_putenv putenv |
195 #else | 193 #else |
196 extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); | 194 extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); |
197 #endif | 195 #endif |
198 | 196 |
199 #if HAVE_QSORT | 197 #ifdef HAVE_QSORT |
200 #define SDL_qsort qsort | 198 #define SDL_qsort qsort |
201 #else | 199 #else |
202 extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, | 200 extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, |
203 int (*compare)(const void *, const void *)); | 201 int (*compare)(const void *, const void *)); |
204 #endif | 202 #endif |
205 | 203 |
206 #if HAVE_ABS | 204 #ifdef HAVE_ABS |
207 #define SDL_abs abs | 205 #define SDL_abs abs |
208 #else | 206 #else |
209 #define SDL_abs(X) ((X) < 0 ? -(X) : (X)) | 207 #define SDL_abs(X) ((X) < 0 ? -(X) : (X)) |
210 #endif | 208 #endif |
211 | 209 |
212 #define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) | 210 #define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) |
213 #define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) | 211 #define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) |
214 | 212 |
215 #if HAVE_CTYPE_H | 213 #ifdef HAVE_CTYPE_H |
216 #define SDL_isdigit(X) isdigit(X) | 214 #define SDL_isdigit(X) isdigit(X) |
217 #define SDL_isspace(X) isspace(X) | 215 #define SDL_isspace(X) isspace(X) |
218 #define SDL_toupper(X) toupper(X) | 216 #define SDL_toupper(X) toupper(X) |
219 #define SDL_tolower(X) tolower(X) | 217 #define SDL_tolower(X) tolower(X) |
220 #else | 218 #else |
222 #define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n')) | 220 #define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n')) |
223 #define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X)) | 221 #define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X)) |
224 #define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X)) | 222 #define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X)) |
225 #endif | 223 #endif |
226 | 224 |
227 #if HAVE_MEMSET | 225 #ifdef HAVE_MEMSET |
228 #define SDL_memset memset | 226 #define SDL_memset memset |
229 #else | 227 #else |
230 extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len); | 228 extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len); |
231 #endif | 229 #endif |
232 | 230 |
277 : "0" ((unsigned)(len)/4), "q" (len), "1" (dst),"2" (src) \ | 275 : "0" ((unsigned)(len)/4), "q" (len), "1" (dst),"2" (src) \ |
278 : "memory" ); \ | 276 : "memory" ); \ |
279 } while(0) | 277 } while(0) |
280 #endif | 278 #endif |
281 #ifndef SDL_memcpy | 279 #ifndef SDL_memcpy |
282 #if HAVE_MEMCPY | 280 #ifdef HAVE_MEMCPY |
283 #define SDL_memcpy memcpy | 281 #define SDL_memcpy memcpy |
284 #elif HAVE_BCOPY | 282 #elif defined(HAVE_BCOPY) |
285 #define SDL_memcpy(d, s, n) bcopy((s), (d), (n)) | 283 #define SDL_memcpy(d, s, n) bcopy((s), (d), (n)) |
286 #else | 284 #else |
287 extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len); | 285 extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len); |
288 #endif | 286 #endif |
289 #endif | 287 #endif |
332 #endif | 330 #endif |
333 #ifndef SDL_revcpy | 331 #ifndef SDL_revcpy |
334 extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len); | 332 extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len); |
335 #endif | 333 #endif |
336 | 334 |
337 #if HAVE_MEMMOVE | 335 #ifdef HAVE_MEMMOVE |
338 #define SDL_memmove memmove | 336 #define SDL_memmove memmove |
339 #elif HAVE_BCOPY | 337 #elif defined(HAVE_BCOPY) |
340 #define SDL_memmove(d, s, n) bcopy((s), (d), (n)) | 338 #define SDL_memmove(d, s, n) bcopy((s), (d), (n)) |
341 #else | 339 #else |
342 #define SDL_memmove(dst, src, len) \ | 340 #define SDL_memmove(dst, src, len) \ |
343 do { \ | 341 do { \ |
344 if ( dst < src ) { \ | 342 if ( dst < src ) { \ |
347 SDL_revcpy(dst, src, len); \ | 345 SDL_revcpy(dst, src, len); \ |
348 } \ | 346 } \ |
349 } while(0) | 347 } while(0) |
350 #endif | 348 #endif |
351 | 349 |
352 #if HAVE_MEMCMP | 350 #ifdef HAVE_MEMCMP |
353 #define SDL_memcmp memcmp | 351 #define SDL_memcmp memcmp |
354 #else | 352 #else |
355 extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); | 353 extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); |
356 #endif | 354 #endif |
357 | 355 |
358 #if HAVE_STRLEN | 356 #ifdef HAVE_STRLEN |
359 #define SDL_strlen strlen | 357 #define SDL_strlen strlen |
360 #else | 358 #else |
361 extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string); | 359 extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string); |
362 #endif | 360 #endif |
363 | 361 |
364 #if HAVE_STRLCPY | 362 #ifdef HAVE_STRLCPY |
365 #define SDL_strlcpy strlcpy | 363 #define SDL_strlcpy strlcpy |
366 #else | 364 #else |
367 extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen); | 365 extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen); |
368 #endif | 366 #endif |
369 | 367 |
370 #if HAVE_STRLCAT | 368 #ifdef HAVE_STRLCAT |
371 #define SDL_strlcat strlcat | 369 #define SDL_strlcat strlcat |
372 #else | 370 #else |
373 extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen); | 371 extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen); |
374 #endif | 372 #endif |
375 | 373 |
376 #if HAVE_STRDUP | 374 #ifdef HAVE_STRDUP |
377 #define SDL_strdup strdup | 375 #define SDL_strdup strdup |
378 #else | 376 #else |
379 extern DECLSPEC char * SDLCALL SDL_strdup(const char *string); | 377 extern DECLSPEC char * SDLCALL SDL_strdup(const char *string); |
380 #endif | 378 #endif |
381 | 379 |
382 #if HAVE__STRREV | 380 #ifdef HAVE__STRREV |
383 #define SDL_strrev _strrev | 381 #define SDL_strrev _strrev |
384 #else | 382 #else |
385 extern DECLSPEC char * SDLCALL SDL_strrev(char *string); | 383 extern DECLSPEC char * SDLCALL SDL_strrev(char *string); |
386 #endif | 384 #endif |
387 | 385 |
388 #if HAVE__STRUPR | 386 #ifdef HAVE__STRUPR |
389 #define SDL_strupr _strupr | 387 #define SDL_strupr _strupr |
390 #else | 388 #else |
391 extern DECLSPEC char * SDLCALL SDL_strupr(char *string); | 389 extern DECLSPEC char * SDLCALL SDL_strupr(char *string); |
392 #endif | 390 #endif |
393 | 391 |
394 #if HAVE__STRLWR | 392 #ifdef HAVE__STRLWR |
395 #define SDL_strlwr _strlwr | 393 #define SDL_strlwr _strlwr |
396 #else | 394 #else |
397 extern DECLSPEC char * SDLCALL SDL_strlwr(char *string); | 395 extern DECLSPEC char * SDLCALL SDL_strlwr(char *string); |
398 #endif | 396 #endif |
399 | 397 |
400 #if HAVE_STRCHR | 398 #ifdef HAVE_STRCHR |
401 #define SDL_strchr strchr | 399 #define SDL_strchr strchr |
402 #elif HAVE_INDEX | 400 #elif defined(HAVE_INDEX) |
403 #define SDL_strchr index | 401 #define SDL_strchr index |
404 #else | 402 #else |
405 extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c); | 403 extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c); |
406 #endif | 404 #endif |
407 | 405 |
408 #if HAVE_STRRCHR | 406 #ifdef HAVE_STRRCHR |
409 #define SDL_strrchr strrchr | 407 #define SDL_strrchr strrchr |
410 #elif HAVE_RINDEX | 408 #elif defined(HAVE_RINDEX) |
411 #define SDL_strrchr rindex | 409 #define SDL_strrchr rindex |
412 #else | 410 #else |
413 extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c); | 411 extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c); |
414 #endif | 412 #endif |
415 | 413 |
416 #if HAVE_STRSTR | 414 #ifdef HAVE_STRSTR |
417 #define SDL_strstr strstr | 415 #define SDL_strstr strstr |
418 #else | 416 #else |
419 extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle); | 417 extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle); |
420 #endif | 418 #endif |
421 | 419 |
422 #if HAVE_ITOA | 420 #ifdef HAVE_ITOA |
423 #define SDL_itoa itoa | 421 #define SDL_itoa itoa |
424 #else | 422 #else |
425 #define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix) | 423 #define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix) |
426 #endif | 424 #endif |
427 | 425 |
428 #if HAVE__LTOA | 426 #ifdef HAVE__LTOA |
429 #define SDL_ltoa _ltoa | 427 #define SDL_ltoa _ltoa |
430 #else | 428 #else |
431 extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix); | 429 extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix); |
432 #endif | 430 #endif |
433 | 431 |
434 #if HAVE__UITOA | 432 #ifdef HAVE__UITOA |
435 #define SDL_uitoa _uitoa | 433 #define SDL_uitoa _uitoa |
436 #else | 434 #else |
437 #define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix) | 435 #define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix) |
438 #endif | 436 #endif |
439 | 437 |
440 #if HAVE__ULTOA | 438 #ifdef HAVE__ULTOA |
441 #define SDL_ultoa _ultoa | 439 #define SDL_ultoa _ultoa |
442 #else | 440 #else |
443 extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix); | 441 extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix); |
444 #endif | 442 #endif |
445 | 443 |
446 #if HAVE_STRTOL | 444 #ifdef HAVE_STRTOL |
447 #define SDL_strtol strtol | 445 #define SDL_strtol strtol |
448 #else | 446 #else |
449 extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base); | 447 extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base); |
450 #endif | 448 #endif |
451 | 449 |
452 #if HAVE_STRTOUL | 450 #ifdef HAVE_STRTOUL |
453 #define SDL_strtoul strtoul | 451 #define SDL_strtoul strtoul |
454 #else | 452 #else |
455 extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base); | 453 extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base); |
456 #endif | 454 #endif |
457 | 455 |
458 #if SDL_HAS_64BIT_TYPE | 456 #ifdef SDL_HAS_64BIT_TYPE |
459 | 457 |
460 #if HAVE__I64TOA | 458 #ifdef HAVE__I64TOA |
461 #define SDL_lltoa _i64toa | 459 #define SDL_lltoa _i64toa |
462 #else | 460 #else |
463 extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix); | 461 extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix); |
464 #endif | 462 #endif |
465 | 463 |
466 #if HAVE__UI64TOA | 464 #ifdef HAVE__UI64TOA |
467 #define SDL_ulltoa _ui64toa | 465 #define SDL_ulltoa _ui64toa |
468 #else | 466 #else |
469 extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix); | 467 extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix); |
470 #endif | 468 #endif |
471 | 469 |
472 #if HAVE_STRTOLL | 470 #ifdef HAVE_STRTOLL |
473 #define SDL_strtoll strtoll | 471 #define SDL_strtoll strtoll |
474 #else | 472 #else |
475 extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base); | 473 extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base); |
476 #endif | 474 #endif |
477 | 475 |
478 #if HAVE_STRTOULL | 476 #ifdef HAVE_STRTOULL |
479 #define SDL_strtoull strtoull | 477 #define SDL_strtoull strtoull |
480 #else | 478 #else |
481 extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base); | 479 extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base); |
482 #endif | 480 #endif |
483 | 481 |
484 #endif /* SDL_HAS_64BIT_TYPE */ | 482 #endif /* SDL_HAS_64BIT_TYPE */ |
485 | 483 |
486 #if HAVE_STRTOD | 484 #ifdef HAVE_STRTOD |
487 #define SDL_strtod strtod | 485 #define SDL_strtod strtod |
488 #else | 486 #else |
489 extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp); | 487 extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp); |
490 #endif | 488 #endif |
491 | 489 |
492 #if HAVE_ATOI | 490 #ifdef HAVE_ATOI |
493 #define SDL_atoi atoi | 491 #define SDL_atoi atoi |
494 #else | 492 #else |
495 #define SDL_atoi(X) SDL_strtol(X, NULL, 0) | 493 #define SDL_atoi(X) SDL_strtol(X, NULL, 0) |
496 #endif | 494 #endif |
497 | 495 |
498 #if HAVE_ATOF | 496 #ifdef HAVE_ATOF |
499 #define SDL_atof atof | 497 #define SDL_atof atof |
500 #else | 498 #else |
501 #define SDL_atof(X) SDL_strtod(X, NULL) | 499 #define SDL_atof(X) SDL_strtod(X, NULL) |
502 #endif | 500 #endif |
503 | 501 |
504 #if HAVE_STRCMP | 502 #ifdef HAVE_STRCMP |
505 #define SDL_strcmp strcmp | 503 #define SDL_strcmp strcmp |
506 #else | 504 #else |
507 extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); | 505 extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); |
508 #endif | 506 #endif |
509 | 507 |
510 #if HAVE_STRNCMP | 508 #ifdef HAVE_STRNCMP |
511 #define SDL_strncmp strncmp | 509 #define SDL_strncmp strncmp |
512 #else | 510 #else |
513 extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); | 511 extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); |
514 #endif | 512 #endif |
515 | 513 |
516 #if HAVE_STRCASECMP | 514 #ifdef HAVE_STRCASECMP |
517 #define SDL_strcasecmp strcasecmp | 515 #define SDL_strcasecmp strcasecmp |
518 #elif HAVE__STRICMP | 516 #elif defined(HAVE__STRICMP) |
519 #define SDL_strcasecmp _stricmp | 517 #define SDL_strcasecmp _stricmp |
520 #else | 518 #else |
521 extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); | 519 extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); |
522 #endif | 520 #endif |
523 | 521 |
524 #if HAVE_STRNCASECMP | 522 #ifdef HAVE_STRNCASECMP |
525 #define SDL_strncasecmp strncasecmp | 523 #define SDL_strncasecmp strncasecmp |
526 #elif HAVE__STRNICMP | 524 #elif defined(HAVE__STRNICMP) |
527 #define SDL_strncasecmp _strnicmp | 525 #define SDL_strncasecmp _strnicmp |
528 #else | 526 #else |
529 extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen); | 527 extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen); |
530 #endif | 528 #endif |
531 | 529 |
532 #if HAVE_SSCANF | 530 #ifdef HAVE_SSCANF |
533 #define SDL_sscanf sscanf | 531 #define SDL_sscanf sscanf |
534 #else | 532 #else |
535 extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...); | 533 extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...); |
536 #endif | 534 #endif |
537 | 535 |
538 #if HAVE_SNPRINTF | 536 #ifdef HAVE_SNPRINTF |
539 #define SDL_snprintf snprintf | 537 #define SDL_snprintf snprintf |
540 #else | 538 #else |
541 extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); | 539 extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); |
542 #endif | 540 #endif |
543 | 541 |
544 #if HAVE_VSNPRINTF | 542 #ifdef HAVE_VSNPRINTF |
545 #define SDL_vsnprintf vsnprintf | 543 #define SDL_vsnprintf vsnprintf |
546 #else | 544 #else |
547 extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); | 545 extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); |
548 #endif | 546 #endif |
549 | 547 |
551 #define SDL_ICONV_ERROR (size_t)-1 | 549 #define SDL_ICONV_ERROR (size_t)-1 |
552 #define SDL_ICONV_E2BIG (size_t)-2 | 550 #define SDL_ICONV_E2BIG (size_t)-2 |
553 #define SDL_ICONV_EILSEQ (size_t)-3 | 551 #define SDL_ICONV_EILSEQ (size_t)-3 |
554 #define SDL_ICONV_EINVAL (size_t)-4 | 552 #define SDL_ICONV_EINVAL (size_t)-4 |
555 | 553 |
556 #if HAVE_ICONV | 554 #ifdef HAVE_ICONV |
557 #define SDL_iconv_t iconv_t | 555 #define SDL_iconv_t iconv_t |
558 #define SDL_iconv_open iconv_open | 556 #define SDL_iconv_open iconv_open |
559 #define SDL_iconv_close iconv_close | 557 #define SDL_iconv_close iconv_close |
560 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); | 558 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); |
561 #else | 559 #else |