Mercurial > sdl-ios-xcode
comparison include/SDL_stdinc.h @ 1895:c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 10 Jul 2006 21:04:37 +0000 |
parents | 39a4f91b164a |
children | f1828a500391 |
comparison
equal
deleted
inserted
replaced
1894:c69cee13dd76 | 1895:c121d94672cb |
---|---|
18 | 18 |
19 Sam Lantinga | 19 Sam Lantinga |
20 slouken@libsdl.org | 20 slouken@libsdl.org |
21 */ | 21 */ |
22 | 22 |
23 /* This is a general header that includes C language support */ | 23 /** |
24 * \file SDL_stdinc.h | |
25 * | |
26 * This is a general header that includes C language support | |
27 */ | |
24 | 28 |
25 #ifndef _SDL_stdinc_h | 29 #ifndef _SDL_stdinc_h |
26 #define _SDL_stdinc_h | 30 #define _SDL_stdinc_h |
27 | 31 |
28 #include "SDL_config.h" | 32 #include "SDL_config.h" |
75 /* The number of elements in an array */ | 79 /* The number of elements in an array */ |
76 #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) | 80 #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) |
77 #define SDL_TABLESIZE(table) SDL_arraysize(table) | 81 #define SDL_TABLESIZE(table) SDL_arraysize(table) |
78 | 82 |
79 /* Basic data types */ | 83 /* Basic data types */ |
80 typedef enum SDL_bool { | 84 typedef enum SDL_bool |
81 SDL_FALSE = 0, | 85 { |
82 SDL_TRUE = 1 | 86 SDL_FALSE = 0, |
87 SDL_TRUE = 1 | |
83 } SDL_bool; | 88 } SDL_bool; |
84 | 89 |
85 typedef int8_t Sint8; | 90 /** |
86 typedef uint8_t Uint8; | 91 * \typedef Sint8 |
87 typedef int16_t Sint16; | 92 * \brief A signed 8-bit integer type. |
88 typedef uint16_t Uint16; | 93 */ |
89 typedef int32_t Sint32; | 94 typedef int8_t Sint8; |
90 typedef uint32_t Uint32; | 95 /** |
96 * \typedef Uint8 | |
97 * \brief An unsigned 8-bit integer type. | |
98 */ | |
99 typedef uint8_t Uint8; | |
100 /** | |
101 * \typedef Sint16 | |
102 * \brief A signed 16-bit integer type. | |
103 */ | |
104 typedef int16_t Sint16; | |
105 /** | |
106 * \typedef Uint16 | |
107 * \brief An unsigned 16-bit integer type. | |
108 */ | |
109 typedef uint16_t Uint16; | |
110 /** | |
111 * \typedef Sint32 | |
112 * \brief A signed 32-bit integer type. | |
113 */ | |
114 typedef int32_t Sint32; | |
115 /** | |
116 * \typedef Uint32 | |
117 * \brief An unsigned 32-bit integer type. | |
118 */ | |
119 typedef uint32_t Uint32; | |
91 | 120 |
92 #ifdef SDL_HAS_64BIT_TYPE | 121 #ifdef SDL_HAS_64BIT_TYPE |
93 typedef int64_t Sint64; | 122 /** |
94 typedef uint64_t Uint64; | 123 * \typedef Sint64 |
124 * \brief A signed 64-bit integer type. | |
125 * \warning On platforms without any sort of 64-bit datatype, this is equivalent to Sint32! | |
126 */ | |
127 typedef int64_t Sint64; | |
128 /** | |
129 * \typedef Uint64 | |
130 * \brief An unsigned 64-bit integer type. | |
131 * \warning On platforms without any sort of 64-bit datatype, this is equivalent to Uint32! | |
132 */ | |
133 typedef uint64_t Uint64; | |
95 #else | 134 #else |
96 /* This is really just a hack to prevent the compiler from complaining */ | 135 /* This is really just a hack to prevent the compiler from complaining */ |
97 typedef struct { | 136 typdef Sint32 Sint64; |
98 Uint32 hi; | 137 typdef Uint32 Uint32; |
99 Uint32 lo; | |
100 } Uint64, Sint64; | |
101 #endif | 138 #endif |
102 | 139 |
103 /* Make sure the types really have the right sizes */ | 140 /* Make sure the types really have the right sizes */ |
104 #define SDL_COMPILE_TIME_ASSERT(name, x) \ | 141 #define SDL_COMPILE_TIME_ASSERT(name, x) \ |
105 typedef int SDL_dummy_ ## name[(x) * 2 - 1] | 142 typedef int SDL_dummy_ ## name[(x) * 2 - 1] |
106 | 143 #ifndef DOXYGEN_SHOULD_IGNORE_THIS |
107 SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); | 144 SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); |
108 SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); | 145 SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); |
109 SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); | 146 SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); |
110 SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); | 147 SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); |
111 SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); | 148 SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); |
112 SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); | 149 SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); |
113 SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); | 150 SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); |
114 SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); | 151 SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); |
152 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ | |
115 | 153 |
116 /* Check to make sure enums are the size of ints, for structure packing. | 154 /* Check to make sure enums are the size of ints, for structure packing. |
117 For both Watcom C/C++ and Borland C/C++ the compiler option that makes | 155 For both Watcom C/C++ and Borland C/C++ the compiler option that makes |
118 enums having the size of an int must be enabled. | 156 enums having the size of an int must be enabled. |
119 This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). | 157 This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). |
121 /* Enable enums always int in CodeWarrior (for MPW use "-enum int") */ | 159 /* Enable enums always int in CodeWarrior (for MPW use "-enum int") */ |
122 #ifdef __MWERKS__ | 160 #ifdef __MWERKS__ |
123 #pragma enumsalwaysint on | 161 #pragma enumsalwaysint on |
124 #endif | 162 #endif |
125 | 163 |
126 typedef enum { | 164 #ifndef DOXYGEN_SHOULD_IGNORE_THIS |
127 DUMMY_ENUM_VALUE | 165 typedef enum |
166 { | |
167 DUMMY_ENUM_VALUE | |
128 } SDL_DUMMY_ENUM; | 168 } SDL_DUMMY_ENUM; |
129 | 169 |
130 SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); | 170 SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); |
131 | 171 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ |
132 | 172 |
133 #include "begin_code.h" | 173 #include "begin_code.h" |
134 /* Set up for C function definitions, even when using C++ */ | 174 /* Set up for C function definitions, even when using C++ */ |
135 #ifdef __cplusplus | 175 #ifdef __cplusplus |
176 /* *INDENT-OFF* */ | |
136 extern "C" { | 177 extern "C" { |
178 /* *INDENT-ON* */ | |
137 #endif | 179 #endif |
138 | 180 |
139 #ifdef HAVE_MALLOC | 181 #ifdef HAVE_MALLOC |
140 #define SDL_malloc malloc | 182 #define SDL_malloc malloc |
141 #else | 183 #else |
142 extern DECLSPEC void * SDLCALL SDL_malloc(size_t size); | 184 extern DECLSPEC void *SDLCALL SDL_malloc(size_t size); |
143 #endif | 185 #endif |
144 | 186 |
145 #ifdef HAVE_CALLOC | 187 #ifdef HAVE_CALLOC |
146 #define SDL_calloc calloc | 188 #define SDL_calloc calloc |
147 #else | 189 #else |
148 extern DECLSPEC void * SDLCALL SDL_calloc(size_t nmemb, size_t size); | 190 extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size); |
149 #endif | 191 #endif |
150 | 192 |
151 #ifdef HAVE_REALLOC | 193 #ifdef HAVE_REALLOC |
152 #define SDL_realloc realloc | 194 #define SDL_realloc realloc |
153 #else | 195 #else |
154 extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size); | 196 extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size); |
155 #endif | 197 #endif |
156 | 198 |
157 #ifdef HAVE_FREE | 199 #ifdef HAVE_FREE |
158 #define SDL_free free | 200 #define SDL_free free |
159 #else | 201 #else |
171 # elif defined(__WATCOMC__) | 213 # elif defined(__WATCOMC__) |
172 # include <malloc.h> | 214 # include <malloc.h> |
173 # elif defined(__DMC__) | 215 # elif defined(__DMC__) |
174 # include <stdlib.h> | 216 # include <stdlib.h> |
175 # elif defined(__AIX__) | 217 # elif defined(__AIX__) |
176 #pragma alloca | 218 #pragma alloca |
177 # elif defined(__MRC__) | 219 # elif defined(__MRC__) |
178 void *alloca (unsigned); | 220 void *alloca(unsigned); |
179 # else | 221 # else |
180 char *alloca (); | 222 char *alloca(); |
181 # endif | 223 # endif |
182 #endif | 224 #endif |
183 #ifdef HAVE_ALLOCA | 225 #ifdef HAVE_ALLOCA |
184 #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count) | 226 #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count) |
185 #define SDL_stack_free(data) | 227 #define SDL_stack_free(data) |
189 #endif | 231 #endif |
190 | 232 |
191 #ifdef HAVE_GETENV | 233 #ifdef HAVE_GETENV |
192 #define SDL_getenv getenv | 234 #define SDL_getenv getenv |
193 #else | 235 #else |
194 extern DECLSPEC char * SDLCALL SDL_getenv(const char *name); | 236 extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); |
195 #endif | 237 #endif |
196 | 238 |
197 #ifdef HAVE_PUTENV | 239 #ifdef HAVE_PUTENV |
198 #define SDL_putenv putenv | 240 #define SDL_putenv putenv |
199 #else | 241 #else |
202 | 244 |
203 #ifdef HAVE_QSORT | 245 #ifdef HAVE_QSORT |
204 #define SDL_qsort qsort | 246 #define SDL_qsort qsort |
205 #else | 247 #else |
206 extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, | 248 extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, |
207 int (*compare)(const void *, const void *)); | 249 int (*compare) (const void *, |
250 const void *)); | |
208 #endif | 251 #endif |
209 | 252 |
210 #ifdef HAVE_ABS | 253 #ifdef HAVE_ABS |
211 #define SDL_abs abs | 254 #define SDL_abs abs |
212 #else | 255 #else |
229 #endif | 272 #endif |
230 | 273 |
231 #ifdef HAVE_MEMSET | 274 #ifdef HAVE_MEMSET |
232 #define SDL_memset memset | 275 #define SDL_memset memset |
233 #else | 276 #else |
234 extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len); | 277 extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len); |
235 #endif | 278 #endif |
279 #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) | |
280 #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) | |
236 | 281 |
237 #if defined(__GNUC__) && defined(i386) | 282 #if defined(__GNUC__) && defined(i386) |
238 #define SDL_memset4(dst, val, len) \ | 283 #define SDL_memset4(dst, val, len) \ |
239 do { \ | 284 do { \ |
240 int u0, u1, u2; \ | 285 int u0, u1, u2; \ |
286 #ifdef HAVE_MEMCPY | 331 #ifdef HAVE_MEMCPY |
287 #define SDL_memcpy memcpy | 332 #define SDL_memcpy memcpy |
288 #elif defined(HAVE_BCOPY) | 333 #elif defined(HAVE_BCOPY) |
289 #define SDL_memcpy(d, s, n) bcopy((s), (d), (n)) | 334 #define SDL_memcpy(d, s, n) bcopy((s), (d), (n)) |
290 #else | 335 #else |
291 extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len); | 336 extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, |
337 size_t len); | |
292 #endif | 338 #endif |
293 #endif | 339 #endif |
294 | 340 |
295 #if defined(__GNUC__) && defined(i386) | 341 #if defined(__GNUC__) && defined(i386) |
296 #define SDL_memcpy4(dst, src, len) \ | 342 #define SDL_memcpy4(dst, src, len) \ |
333 break; \ | 379 break; \ |
334 } \ | 380 } \ |
335 } while(0) | 381 } while(0) |
336 #endif | 382 #endif |
337 #ifndef SDL_revcpy | 383 #ifndef SDL_revcpy |
338 extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len); | 384 extern DECLSPEC void *SDLCALL SDL_revcpy(void *dst, const void *src, |
385 size_t len); | |
339 #endif | 386 #endif |
340 | 387 |
341 #ifdef HAVE_MEMMOVE | 388 #ifdef HAVE_MEMMOVE |
342 #define SDL_memmove memmove | 389 #define SDL_memmove memmove |
343 #elif defined(HAVE_BCOPY) | 390 #elif defined(HAVE_BCOPY) |
354 #endif | 401 #endif |
355 | 402 |
356 #ifdef HAVE_MEMCMP | 403 #ifdef HAVE_MEMCMP |
357 #define SDL_memcmp memcmp | 404 #define SDL_memcmp memcmp |
358 #else | 405 #else |
359 extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); | 406 extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, |
407 size_t len); | |
360 #endif | 408 #endif |
361 | 409 |
362 #ifdef HAVE_STRLEN | 410 #ifdef HAVE_STRLEN |
363 #define SDL_strlen strlen | 411 #define SDL_strlen strlen |
364 #else | 412 #else |
366 #endif | 414 #endif |
367 | 415 |
368 #ifdef HAVE_STRLCPY | 416 #ifdef HAVE_STRLCPY |
369 #define SDL_strlcpy strlcpy | 417 #define SDL_strlcpy strlcpy |
370 #else | 418 #else |
371 extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen); | 419 extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, |
420 size_t maxlen); | |
372 #endif | 421 #endif |
373 | 422 |
374 #ifdef HAVE_STRLCAT | 423 #ifdef HAVE_STRLCAT |
375 #define SDL_strlcat strlcat | 424 #define SDL_strlcat strlcat |
376 #else | 425 #else |
377 extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen); | 426 extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, |
427 size_t maxlen); | |
378 #endif | 428 #endif |
379 | 429 |
380 #ifdef HAVE_STRDUP | 430 #ifdef HAVE_STRDUP |
381 #define SDL_strdup strdup | 431 #define SDL_strdup strdup |
382 #else | 432 #else |
383 extern DECLSPEC char * SDLCALL SDL_strdup(const char *string); | 433 extern DECLSPEC char *SDLCALL SDL_strdup(const char *string); |
384 #endif | 434 #endif |
385 | 435 |
386 #ifdef HAVE__STRREV | 436 #ifdef HAVE__STRREV |
387 #define SDL_strrev _strrev | 437 #define SDL_strrev _strrev |
388 #else | 438 #else |
389 extern DECLSPEC char * SDLCALL SDL_strrev(char *string); | 439 extern DECLSPEC char *SDLCALL SDL_strrev(char *string); |
390 #endif | 440 #endif |
391 | 441 |
392 #ifdef HAVE__STRUPR | 442 #ifdef HAVE__STRUPR |
393 #define SDL_strupr _strupr | 443 #define SDL_strupr _strupr |
394 #else | 444 #else |
395 extern DECLSPEC char * SDLCALL SDL_strupr(char *string); | 445 extern DECLSPEC char *SDLCALL SDL_strupr(char *string); |
396 #endif | 446 #endif |
397 | 447 |
398 #ifdef HAVE__STRLWR | 448 #ifdef HAVE__STRLWR |
399 #define SDL_strlwr _strlwr | 449 #define SDL_strlwr _strlwr |
400 #else | 450 #else |
401 extern DECLSPEC char * SDLCALL SDL_strlwr(char *string); | 451 extern DECLSPEC char *SDLCALL SDL_strlwr(char *string); |
402 #endif | 452 #endif |
403 | 453 |
404 #ifdef HAVE_STRCHR | 454 #ifdef HAVE_STRCHR |
405 #define SDL_strchr strchr | 455 #define SDL_strchr strchr |
406 #elif defined(HAVE_INDEX) | 456 #elif defined(HAVE_INDEX) |
407 #define SDL_strchr index | 457 #define SDL_strchr index |
408 #else | 458 #else |
409 extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c); | 459 extern DECLSPEC char *SDLCALL SDL_strchr(const char *string, int c); |
410 #endif | 460 #endif |
411 | 461 |
412 #ifdef HAVE_STRRCHR | 462 #ifdef HAVE_STRRCHR |
413 #define SDL_strrchr strrchr | 463 #define SDL_strrchr strrchr |
414 #elif defined(HAVE_RINDEX) | 464 #elif defined(HAVE_RINDEX) |
415 #define SDL_strrchr rindex | 465 #define SDL_strrchr rindex |
416 #else | 466 #else |
417 extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c); | 467 extern DECLSPEC char *SDLCALL SDL_strrchr(const char *string, int c); |
418 #endif | 468 #endif |
419 | 469 |
420 #ifdef HAVE_STRSTR | 470 #ifdef HAVE_STRSTR |
421 #define SDL_strstr strstr | 471 #define SDL_strstr strstr |
422 #else | 472 #else |
423 extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle); | 473 extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, |
474 const char *needle); | |
424 #endif | 475 #endif |
425 | 476 |
426 #ifdef HAVE_ITOA | 477 #ifdef HAVE_ITOA |
427 #define SDL_itoa itoa | 478 #define SDL_itoa itoa |
428 #else | 479 #else |
430 #endif | 481 #endif |
431 | 482 |
432 #ifdef HAVE__LTOA | 483 #ifdef HAVE__LTOA |
433 #define SDL_ltoa _ltoa | 484 #define SDL_ltoa _ltoa |
434 #else | 485 #else |
435 extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix); | 486 extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *string, int radix); |
436 #endif | 487 #endif |
437 | 488 |
438 #ifdef HAVE__UITOA | 489 #ifdef HAVE__UITOA |
439 #define SDL_uitoa _uitoa | 490 #define SDL_uitoa _uitoa |
440 #else | 491 #else |
442 #endif | 493 #endif |
443 | 494 |
444 #ifdef HAVE__ULTOA | 495 #ifdef HAVE__ULTOA |
445 #define SDL_ultoa _ultoa | 496 #define SDL_ultoa _ultoa |
446 #else | 497 #else |
447 extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix); | 498 extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *string, |
499 int radix); | |
448 #endif | 500 #endif |
449 | 501 |
450 #ifdef HAVE_STRTOL | 502 #ifdef HAVE_STRTOL |
451 #define SDL_strtol strtol | 503 #define SDL_strtol strtol |
452 #else | 504 #else |
453 extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base); | 505 extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, |
506 int base); | |
454 #endif | 507 #endif |
455 | 508 |
456 #ifdef HAVE_STRTOUL | 509 #ifdef HAVE_STRTOUL |
457 #define SDL_strtoul strtoul | 510 #define SDL_strtoul strtoul |
458 #else | 511 #else |
459 extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base); | 512 extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, |
513 char **endp, int base); | |
460 #endif | 514 #endif |
461 | 515 |
462 #ifdef SDL_HAS_64BIT_TYPE | 516 #ifdef SDL_HAS_64BIT_TYPE |
463 | 517 |
464 #ifdef HAVE__I64TOA | 518 #ifdef HAVE__I64TOA |
465 #define SDL_lltoa _i64toa | 519 #define SDL_lltoa _i64toa |
466 #else | 520 #else |
467 extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix); | 521 extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *string, |
522 int radix); | |
468 #endif | 523 #endif |
469 | 524 |
470 #ifdef HAVE__UI64TOA | 525 #ifdef HAVE__UI64TOA |
471 #define SDL_ulltoa _ui64toa | 526 #define SDL_ulltoa _ui64toa |
472 #else | 527 #else |
473 extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix); | 528 extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *string, |
529 int radix); | |
474 #endif | 530 #endif |
475 | 531 |
476 #ifdef HAVE_STRTOLL | 532 #ifdef HAVE_STRTOLL |
477 #define SDL_strtoll strtoll | 533 #define SDL_strtoll strtoll |
478 #else | 534 #else |
479 extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base); | 535 extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, |
536 int base); | |
480 #endif | 537 #endif |
481 | 538 |
482 #ifdef HAVE_STRTOULL | 539 #ifdef HAVE_STRTOULL |
483 #define SDL_strtoull strtoull | 540 #define SDL_strtoull strtoull |
484 #else | 541 #else |
485 extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base); | 542 extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, |
543 int base); | |
486 #endif | 544 #endif |
487 | 545 |
488 #endif /* SDL_HAS_64BIT_TYPE */ | 546 #endif /* SDL_HAS_64BIT_TYPE */ |
489 | 547 |
490 #ifdef HAVE_STRTOD | 548 #ifdef HAVE_STRTOD |
512 #endif | 570 #endif |
513 | 571 |
514 #ifdef HAVE_STRNCMP | 572 #ifdef HAVE_STRNCMP |
515 #define SDL_strncmp strncmp | 573 #define SDL_strncmp strncmp |
516 #else | 574 #else |
517 extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); | 575 extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, |
576 size_t maxlen); | |
518 #endif | 577 #endif |
519 | 578 |
520 #ifdef HAVE_STRCASECMP | 579 #ifdef HAVE_STRCASECMP |
521 #define SDL_strcasecmp strcasecmp | 580 #define SDL_strcasecmp strcasecmp |
522 #elif defined(HAVE__STRICMP) | 581 #elif defined(HAVE__STRICMP) |
523 #define SDL_strcasecmp _stricmp | 582 #define SDL_strcasecmp _stricmp |
524 #else | 583 #else |
525 extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); | 584 extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, |
585 const char *str2); | |
526 #endif | 586 #endif |
527 | 587 |
528 #ifdef HAVE_STRNCASECMP | 588 #ifdef HAVE_STRNCASECMP |
529 #define SDL_strncasecmp strncasecmp | 589 #define SDL_strncasecmp strncasecmp |
530 #elif defined(HAVE__STRNICMP) | 590 #elif defined(HAVE__STRNICMP) |
531 #define SDL_strncasecmp _strnicmp | 591 #define SDL_strncasecmp _strnicmp |
532 #else | 592 #else |
533 extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen); | 593 extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, |
594 const char *str2, size_t maxlen); | |
534 #endif | 595 #endif |
535 | 596 |
536 #ifdef HAVE_SSCANF | 597 #ifdef HAVE_SSCANF |
537 #define SDL_sscanf sscanf | 598 #define SDL_sscanf sscanf |
538 #else | 599 #else |
539 extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...); | 600 extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, |
601 ...); | |
540 #endif | 602 #endif |
541 | 603 |
542 #ifdef HAVE_SNPRINTF | 604 #ifdef HAVE_SNPRINTF |
543 #define SDL_snprintf snprintf | 605 #define SDL_snprintf snprintf |
544 #else | 606 #else |
545 extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); | 607 extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, |
608 const char *fmt, ...); | |
546 #endif | 609 #endif |
547 | 610 |
548 #ifdef HAVE_VSNPRINTF | 611 #ifdef HAVE_VSNPRINTF |
549 #define SDL_vsnprintf vsnprintf | 612 #define SDL_vsnprintf vsnprintf |
550 #else | 613 #else |
551 extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); | 614 extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, |
615 const char *fmt, va_list ap); | |
552 #endif | 616 #endif |
553 | 617 |
554 /* The SDL implementation of iconv() returns these error codes */ | 618 /* The SDL implementation of iconv() returns these error codes */ |
555 #define SDL_ICONV_ERROR (size_t)-1 | 619 #define SDL_ICONV_ERROR (size_t)-1 |
556 #define SDL_ICONV_E2BIG (size_t)-2 | 620 #define SDL_ICONV_E2BIG (size_t)-2 |
559 | 623 |
560 #ifdef HAVE_ICONV | 624 #ifdef HAVE_ICONV |
561 #define SDL_iconv_t iconv_t | 625 #define SDL_iconv_t iconv_t |
562 #define SDL_iconv_open iconv_open | 626 #define SDL_iconv_open iconv_open |
563 #define SDL_iconv_close iconv_close | 627 #define SDL_iconv_close iconv_close |
564 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); | 628 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, |
629 size_t * inbytesleft, char **outbuf, | |
630 size_t * outbytesleft); | |
565 #else | 631 #else |
566 typedef struct _SDL_iconv_t *SDL_iconv_t; | 632 typedef struct _SDL_iconv_t *SDL_iconv_t; |
567 extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode); | 633 extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, |
634 const char *fromcode); | |
568 extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); | 635 extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); |
569 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); | 636 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, |
637 size_t * inbytesleft, char **outbuf, | |
638 size_t * outbytesleft); | |
570 #endif | 639 #endif |
571 /* This function converts a string between encodings in one pass, returning a | 640 /* This function converts a string between encodings in one pass, returning a |
572 string that must be freed with SDL_free() or NULL on error. | 641 string that must be freed with SDL_free() or NULL on error. |
573 */ | 642 */ |
574 extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, char *inbuf, size_t inbytesleft); | 643 extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode, |
644 const char *fromcode, | |
645 char *inbuf, | |
646 size_t inbytesleft); | |
575 #define SDL_iconv_utf8_ascii(S) SDL_iconv_string("ASCII", "UTF-8", S, SDL_strlen(S)+1) | 647 #define SDL_iconv_utf8_ascii(S) SDL_iconv_string("ASCII", "UTF-8", S, SDL_strlen(S)+1) |
576 #define SDL_iconv_utf8_latin1(S) SDL_iconv_string("LATIN1", "UTF-8", S, SDL_strlen(S)+1) | 648 #define SDL_iconv_utf8_latin1(S) SDL_iconv_string("LATIN1", "UTF-8", S, SDL_strlen(S)+1) |
577 #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) | 649 #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) |
578 #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) | 650 #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) |
579 | 651 |
580 /* Ends C function definitions when using C++ */ | 652 /* Ends C function definitions when using C++ */ |
581 #ifdef __cplusplus | 653 #ifdef __cplusplus |
654 /* *INDENT-OFF* */ | |
582 } | 655 } |
656 /* *INDENT-ON* */ | |
583 #endif | 657 #endif |
584 #include "close_code.h" | 658 #include "close_code.h" |
585 | 659 |
586 #endif /* _SDL_stdinc_h */ | 660 #endif /* _SDL_stdinc_h */ |
661 | |
662 /* vi: set ts=4 sw=4 expandtab: */ |