Mercurial > sdl-ios-xcode
comparison 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 |
comparison
equal
deleted
inserted
replaced
1661:281d3f4870e5 | 1662:782fd950bd46 |
---|---|
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 |
160 extern DECLSPEC void SDLCALL SDL_free(void *mem); | 202 extern DECLSPEC void SDLCALL SDL_free (void *mem); |
161 #endif | 203 #endif |
162 | 204 |
163 #if defined(HAVE_ALLOCA) && !defined(alloca) | 205 #if defined(HAVE_ALLOCA) && !defined(alloca) |
164 # if defined(HAVE_ALLOCA_H) | 206 # if defined(HAVE_ALLOCA_H) |
165 # include <alloca.h> | 207 # include <alloca.h> |
169 # include <malloc.h> | 211 # include <malloc.h> |
170 # define alloca _alloca | 212 # define alloca _alloca |
171 # elif defined(__WATCOMC__) | 213 # elif defined(__WATCOMC__) |
172 # include <malloc.h> | 214 # include <malloc.h> |
173 # elif defined(__AIX__) | 215 # elif defined(__AIX__) |
174 #pragma alloca | 216 #pragma alloca |
175 # elif defined(__MRC__) | 217 # elif defined(__MRC__) |
176 void *alloca (unsigned); | 218 void *alloca (unsigned); |
177 # else | 219 # else |
178 char *alloca (); | 220 char *alloca (); |
179 # endif | 221 # endif |
180 #endif | 222 #endif |
181 #ifdef HAVE_ALLOCA | 223 #ifdef HAVE_ALLOCA |
182 #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count) | 224 #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count) |
183 #define SDL_stack_free(data) | 225 #define SDL_stack_free(data) |
187 #endif | 229 #endif |
188 | 230 |
189 #ifdef HAVE_GETENV | 231 #ifdef HAVE_GETENV |
190 #define SDL_getenv getenv | 232 #define SDL_getenv getenv |
191 #else | 233 #else |
192 extern DECLSPEC char * SDLCALL SDL_getenv(const char *name); | 234 extern DECLSPEC char *SDLCALL SDL_getenv (const char *name); |
193 #endif | 235 #endif |
194 | 236 |
195 #ifdef HAVE_PUTENV | 237 #ifdef HAVE_PUTENV |
196 #define SDL_putenv putenv | 238 #define SDL_putenv putenv |
197 #else | 239 #else |
198 extern DECLSPEC int SDLCALL SDL_putenv(const char *variable); | 240 extern DECLSPEC int SDLCALL SDL_putenv (const char *variable); |
199 #endif | 241 #endif |
200 | 242 |
201 #ifdef HAVE_QSORT | 243 #ifdef HAVE_QSORT |
202 #define SDL_qsort qsort | 244 #define SDL_qsort qsort |
203 #else | 245 #else |
204 extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, | 246 extern DECLSPEC void SDLCALL SDL_qsort (void *base, size_t nmemb, size_t size, |
205 int (*compare)(const void *, const void *)); | 247 int (*compare) (const void *, |
248 const void *)); | |
206 #endif | 249 #endif |
207 | 250 |
208 #ifdef HAVE_ABS | 251 #ifdef HAVE_ABS |
209 #define SDL_abs abs | 252 #define SDL_abs abs |
210 #else | 253 #else |
227 #endif | 270 #endif |
228 | 271 |
229 #ifdef HAVE_MEMSET | 272 #ifdef HAVE_MEMSET |
230 #define SDL_memset memset | 273 #define SDL_memset memset |
231 #else | 274 #else |
232 extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len); | 275 extern DECLSPEC void *SDLCALL SDL_memset (void *dst, int c, size_t len); |
233 #endif | 276 #endif |
277 #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) | |
278 #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) | |
234 | 279 |
235 #if defined(__GNUC__) && defined(i386) | 280 #if defined(__GNUC__) && defined(i386) |
236 #define SDL_memset4(dst, val, len) \ | 281 #define SDL_memset4(dst, val, len) \ |
237 do { \ | 282 do { \ |
238 int u0, u1, u2; \ | 283 int u0, u1, u2; \ |
284 #ifdef HAVE_MEMCPY | 329 #ifdef HAVE_MEMCPY |
285 #define SDL_memcpy memcpy | 330 #define SDL_memcpy memcpy |
286 #elif defined(HAVE_BCOPY) | 331 #elif defined(HAVE_BCOPY) |
287 #define SDL_memcpy(d, s, n) bcopy((s), (d), (n)) | 332 #define SDL_memcpy(d, s, n) bcopy((s), (d), (n)) |
288 #else | 333 #else |
289 extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len); | 334 extern DECLSPEC void *SDLCALL SDL_memcpy (void *dst, const void *src, |
335 size_t len); | |
290 #endif | 336 #endif |
291 #endif | 337 #endif |
292 | 338 |
293 #if defined(__GNUC__) && defined(i386) | 339 #if defined(__GNUC__) && defined(i386) |
294 #define SDL_memcpy4(dst, src, len) \ | 340 #define SDL_memcpy4(dst, src, len) \ |
331 break; \ | 377 break; \ |
332 } \ | 378 } \ |
333 } while(0) | 379 } while(0) |
334 #endif | 380 #endif |
335 #ifndef SDL_revcpy | 381 #ifndef SDL_revcpy |
336 extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len); | 382 extern DECLSPEC void *SDLCALL SDL_revcpy (void *dst, const void *src, |
383 size_t len); | |
337 #endif | 384 #endif |
338 | 385 |
339 #ifdef HAVE_MEMMOVE | 386 #ifdef HAVE_MEMMOVE |
340 #define SDL_memmove memmove | 387 #define SDL_memmove memmove |
341 #elif defined(HAVE_BCOPY) | 388 #elif defined(HAVE_BCOPY) |
352 #endif | 399 #endif |
353 | 400 |
354 #ifdef HAVE_MEMCMP | 401 #ifdef HAVE_MEMCMP |
355 #define SDL_memcmp memcmp | 402 #define SDL_memcmp memcmp |
356 #else | 403 #else |
357 extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); | 404 extern DECLSPEC int SDLCALL SDL_memcmp (const void *s1, const void *s2, |
405 size_t len); | |
358 #endif | 406 #endif |
359 | 407 |
360 #ifdef HAVE_STRLEN | 408 #ifdef HAVE_STRLEN |
361 #define SDL_strlen strlen | 409 #define SDL_strlen strlen |
362 #else | 410 #else |
363 extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string); | 411 extern DECLSPEC size_t SDLCALL SDL_strlen (const char *string); |
364 #endif | 412 #endif |
365 | 413 |
366 #ifdef HAVE_STRLCPY | 414 #ifdef HAVE_STRLCPY |
367 #define SDL_strlcpy strlcpy | 415 #define SDL_strlcpy strlcpy |
368 #else | 416 #else |
369 extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen); | 417 extern DECLSPEC size_t SDLCALL SDL_strlcpy (char *dst, const char *src, |
418 size_t maxlen); | |
370 #endif | 419 #endif |
371 | 420 |
372 #ifdef HAVE_STRLCAT | 421 #ifdef HAVE_STRLCAT |
373 #define SDL_strlcat strlcat | 422 #define SDL_strlcat strlcat |
374 #else | 423 #else |
375 extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen); | 424 extern DECLSPEC size_t SDLCALL SDL_strlcat (char *dst, const char *src, |
425 size_t maxlen); | |
376 #endif | 426 #endif |
377 | 427 |
378 #ifdef HAVE_STRDUP | 428 #ifdef HAVE_STRDUP |
379 #define SDL_strdup strdup | 429 #define SDL_strdup strdup |
380 #else | 430 #else |
381 extern DECLSPEC char * SDLCALL SDL_strdup(const char *string); | 431 extern DECLSPEC char *SDLCALL SDL_strdup (const char *string); |
382 #endif | 432 #endif |
383 | 433 |
384 #ifdef HAVE__STRREV | 434 #ifdef HAVE__STRREV |
385 #define SDL_strrev _strrev | 435 #define SDL_strrev _strrev |
386 #else | 436 #else |
387 extern DECLSPEC char * SDLCALL SDL_strrev(char *string); | 437 extern DECLSPEC char *SDLCALL SDL_strrev (char *string); |
388 #endif | 438 #endif |
389 | 439 |
390 #ifdef HAVE__STRUPR | 440 #ifdef HAVE__STRUPR |
391 #define SDL_strupr _strupr | 441 #define SDL_strupr _strupr |
392 #else | 442 #else |
393 extern DECLSPEC char * SDLCALL SDL_strupr(char *string); | 443 extern DECLSPEC char *SDLCALL SDL_strupr (char *string); |
394 #endif | 444 #endif |
395 | 445 |
396 #ifdef HAVE__STRLWR | 446 #ifdef HAVE__STRLWR |
397 #define SDL_strlwr _strlwr | 447 #define SDL_strlwr _strlwr |
398 #else | 448 #else |
399 extern DECLSPEC char * SDLCALL SDL_strlwr(char *string); | 449 extern DECLSPEC char *SDLCALL SDL_strlwr (char *string); |
400 #endif | 450 #endif |
401 | 451 |
402 #ifdef HAVE_STRCHR | 452 #ifdef HAVE_STRCHR |
403 #define SDL_strchr strchr | 453 #define SDL_strchr strchr |
404 #elif defined(HAVE_INDEX) | 454 #elif defined(HAVE_INDEX) |
405 #define SDL_strchr index | 455 #define SDL_strchr index |
406 #else | 456 #else |
407 extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c); | 457 extern DECLSPEC char *SDLCALL SDL_strchr (const char *string, int c); |
408 #endif | 458 #endif |
409 | 459 |
410 #ifdef HAVE_STRRCHR | 460 #ifdef HAVE_STRRCHR |
411 #define SDL_strrchr strrchr | 461 #define SDL_strrchr strrchr |
412 #elif defined(HAVE_RINDEX) | 462 #elif defined(HAVE_RINDEX) |
413 #define SDL_strrchr rindex | 463 #define SDL_strrchr rindex |
414 #else | 464 #else |
415 extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c); | 465 extern DECLSPEC char *SDLCALL SDL_strrchr (const char *string, int c); |
416 #endif | 466 #endif |
417 | 467 |
418 #ifdef HAVE_STRSTR | 468 #ifdef HAVE_STRSTR |
419 #define SDL_strstr strstr | 469 #define SDL_strstr strstr |
420 #else | 470 #else |
421 extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle); | 471 extern DECLSPEC char *SDLCALL SDL_strstr (const char *haystack, |
472 const char *needle); | |
422 #endif | 473 #endif |
423 | 474 |
424 #ifdef HAVE_ITOA | 475 #ifdef HAVE_ITOA |
425 #define SDL_itoa itoa | 476 #define SDL_itoa itoa |
426 #else | 477 #else |
428 #endif | 479 #endif |
429 | 480 |
430 #ifdef HAVE__LTOA | 481 #ifdef HAVE__LTOA |
431 #define SDL_ltoa _ltoa | 482 #define SDL_ltoa _ltoa |
432 #else | 483 #else |
433 extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix); | 484 extern DECLSPEC char *SDLCALL SDL_ltoa (long value, char *string, int radix); |
434 #endif | 485 #endif |
435 | 486 |
436 #ifdef HAVE__UITOA | 487 #ifdef HAVE__UITOA |
437 #define SDL_uitoa _uitoa | 488 #define SDL_uitoa _uitoa |
438 #else | 489 #else |
440 #endif | 491 #endif |
441 | 492 |
442 #ifdef HAVE__ULTOA | 493 #ifdef HAVE__ULTOA |
443 #define SDL_ultoa _ultoa | 494 #define SDL_ultoa _ultoa |
444 #else | 495 #else |
445 extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix); | 496 extern DECLSPEC char *SDLCALL SDL_ultoa (unsigned long value, char *string, |
497 int radix); | |
446 #endif | 498 #endif |
447 | 499 |
448 #ifdef HAVE_STRTOL | 500 #ifdef HAVE_STRTOL |
449 #define SDL_strtol strtol | 501 #define SDL_strtol strtol |
450 #else | 502 #else |
451 extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base); | 503 extern DECLSPEC long SDLCALL SDL_strtol (const char *string, char **endp, |
504 int base); | |
452 #endif | 505 #endif |
453 | 506 |
454 #ifdef HAVE_STRTOUL | 507 #ifdef HAVE_STRTOUL |
455 #define SDL_strtoul strtoul | 508 #define SDL_strtoul strtoul |
456 #else | 509 #else |
457 extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base); | 510 extern DECLSPEC unsigned long SDLCALL SDL_strtoul (const char *string, |
511 char **endp, int base); | |
458 #endif | 512 #endif |
459 | 513 |
460 #ifdef SDL_HAS_64BIT_TYPE | 514 #ifdef SDL_HAS_64BIT_TYPE |
461 | 515 |
462 #ifdef HAVE__I64TOA | 516 #ifdef HAVE__I64TOA |
463 #define SDL_lltoa _i64toa | 517 #define SDL_lltoa _i64toa |
464 #else | 518 #else |
465 extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix); | 519 extern DECLSPEC char *SDLCALL SDL_lltoa (Sint64 value, char *string, |
520 int radix); | |
466 #endif | 521 #endif |
467 | 522 |
468 #ifdef HAVE__UI64TOA | 523 #ifdef HAVE__UI64TOA |
469 #define SDL_ulltoa _ui64toa | 524 #define SDL_ulltoa _ui64toa |
470 #else | 525 #else |
471 extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix); | 526 extern DECLSPEC char *SDLCALL SDL_ulltoa (Uint64 value, char *string, |
527 int radix); | |
472 #endif | 528 #endif |
473 | 529 |
474 #ifdef HAVE_STRTOLL | 530 #ifdef HAVE_STRTOLL |
475 #define SDL_strtoll strtoll | 531 #define SDL_strtoll strtoll |
476 #else | 532 #else |
477 extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base); | 533 extern DECLSPEC Sint64 SDLCALL SDL_strtoll (const char *string, char **endp, |
534 int base); | |
478 #endif | 535 #endif |
479 | 536 |
480 #ifdef HAVE_STRTOULL | 537 #ifdef HAVE_STRTOULL |
481 #define SDL_strtoull strtoull | 538 #define SDL_strtoull strtoull |
482 #else | 539 #else |
483 extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base); | 540 extern DECLSPEC Uint64 SDLCALL SDL_strtoull (const char *string, char **endp, |
541 int base); | |
484 #endif | 542 #endif |
485 | 543 |
486 #endif /* SDL_HAS_64BIT_TYPE */ | 544 #endif /* SDL_HAS_64BIT_TYPE */ |
487 | 545 |
488 #ifdef HAVE_STRTOD | 546 #ifdef HAVE_STRTOD |
489 #define SDL_strtod strtod | 547 #define SDL_strtod strtod |
490 #else | 548 #else |
491 extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp); | 549 extern DECLSPEC double SDLCALL SDL_strtod (const char *string, char **endp); |
492 #endif | 550 #endif |
493 | 551 |
494 #ifdef HAVE_ATOI | 552 #ifdef HAVE_ATOI |
495 #define SDL_atoi atoi | 553 #define SDL_atoi atoi |
496 #else | 554 #else |
504 #endif | 562 #endif |
505 | 563 |
506 #ifdef HAVE_STRCMP | 564 #ifdef HAVE_STRCMP |
507 #define SDL_strcmp strcmp | 565 #define SDL_strcmp strcmp |
508 #else | 566 #else |
509 extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); | 567 extern DECLSPEC int SDLCALL SDL_strcmp (const char *str1, const char *str2); |
510 #endif | 568 #endif |
511 | 569 |
512 #ifdef HAVE_STRNCMP | 570 #ifdef HAVE_STRNCMP |
513 #define SDL_strncmp strncmp | 571 #define SDL_strncmp strncmp |
514 #else | 572 #else |
515 extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); | 573 extern DECLSPEC int SDLCALL SDL_strncmp (const char *str1, const char *str2, |
574 size_t maxlen); | |
516 #endif | 575 #endif |
517 | 576 |
518 #ifdef HAVE_STRCASECMP | 577 #ifdef HAVE_STRCASECMP |
519 #define SDL_strcasecmp strcasecmp | 578 #define SDL_strcasecmp strcasecmp |
520 #elif defined(HAVE__STRICMP) | 579 #elif defined(HAVE__STRICMP) |
521 #define SDL_strcasecmp _stricmp | 580 #define SDL_strcasecmp _stricmp |
522 #else | 581 #else |
523 extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); | 582 extern DECLSPEC int SDLCALL SDL_strcasecmp (const char *str1, |
583 const char *str2); | |
524 #endif | 584 #endif |
525 | 585 |
526 #ifdef HAVE_STRNCASECMP | 586 #ifdef HAVE_STRNCASECMP |
527 #define SDL_strncasecmp strncasecmp | 587 #define SDL_strncasecmp strncasecmp |
528 #elif defined(HAVE__STRNICMP) | 588 #elif defined(HAVE__STRNICMP) |
529 #define SDL_strncasecmp _strnicmp | 589 #define SDL_strncasecmp _strnicmp |
530 #else | 590 #else |
531 extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen); | 591 extern DECLSPEC int SDLCALL SDL_strncasecmp (const char *str1, |
592 const char *str2, size_t maxlen); | |
532 #endif | 593 #endif |
533 | 594 |
534 #ifdef HAVE_SSCANF | 595 #ifdef HAVE_SSCANF |
535 #define SDL_sscanf sscanf | 596 #define SDL_sscanf sscanf |
536 #else | 597 #else |
537 extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...); | 598 extern DECLSPEC int SDLCALL SDL_sscanf (const char *text, const char *fmt, |
599 ...); | |
538 #endif | 600 #endif |
539 | 601 |
540 #ifdef HAVE_SNPRINTF | 602 #ifdef HAVE_SNPRINTF |
541 #define SDL_snprintf snprintf | 603 #define SDL_snprintf snprintf |
542 #else | 604 #else |
543 extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...); | 605 extern DECLSPEC int SDLCALL SDL_snprintf (char *text, size_t maxlen, |
606 const char *fmt, ...); | |
544 #endif | 607 #endif |
545 | 608 |
546 #ifdef HAVE_VSNPRINTF | 609 #ifdef HAVE_VSNPRINTF |
547 #define SDL_vsnprintf vsnprintf | 610 #define SDL_vsnprintf vsnprintf |
548 #else | 611 #else |
549 extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap); | 612 extern DECLSPEC int SDLCALL SDL_vsnprintf (char *text, size_t maxlen, |
613 const char *fmt, va_list ap); | |
550 #endif | 614 #endif |
551 | 615 |
552 /* The SDL implementation of iconv() returns these error codes */ | 616 /* The SDL implementation of iconv() returns these error codes */ |
553 #define SDL_ICONV_ERROR (size_t)-1 | 617 #define SDL_ICONV_ERROR (size_t)-1 |
554 #define SDL_ICONV_E2BIG (size_t)-2 | 618 #define SDL_ICONV_E2BIG (size_t)-2 |
557 | 621 |
558 #ifdef HAVE_ICONV | 622 #ifdef HAVE_ICONV |
559 #define SDL_iconv_t iconv_t | 623 #define SDL_iconv_t iconv_t |
560 #define SDL_iconv_open iconv_open | 624 #define SDL_iconv_open iconv_open |
561 #define SDL_iconv_close iconv_close | 625 #define SDL_iconv_close iconv_close |
562 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); | 626 extern DECLSPEC size_t SDLCALL SDL_iconv (SDL_iconv_t cd, char **inbuf, |
627 size_t * inbytesleft, char **outbuf, | |
628 size_t * outbytesleft); | |
563 #else | 629 #else |
564 typedef struct _SDL_iconv_t *SDL_iconv_t; | 630 typedef struct _SDL_iconv_t *SDL_iconv_t; |
565 extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode); | 631 extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open (const char *tocode, |
566 extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); | 632 const char *fromcode); |
567 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); | 633 extern DECLSPEC int SDLCALL SDL_iconv_close (SDL_iconv_t cd); |
634 extern DECLSPEC size_t SDLCALL SDL_iconv (SDL_iconv_t cd, char **inbuf, | |
635 size_t * inbytesleft, char **outbuf, | |
636 size_t * outbytesleft); | |
568 #endif | 637 #endif |
569 /* This function converts a string between encodings in one pass, returning a | 638 /* This function converts a string between encodings in one pass, returning a |
570 string that must be freed with SDL_free() or NULL on error. | 639 string that must be freed with SDL_free() or NULL on error. |
571 */ | 640 */ |
572 extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, char *inbuf, size_t inbytesleft); | 641 extern DECLSPEC char *SDLCALL SDL_iconv_string (const char *tocode, |
642 const char *fromcode, | |
643 char *inbuf, | |
644 size_t inbytesleft); | |
573 #define SDL_iconv_utf8_ascii(S) SDL_iconv_string("ASCII", "UTF-8", S, SDL_strlen(S)+1) | 645 #define SDL_iconv_utf8_ascii(S) SDL_iconv_string("ASCII", "UTF-8", S, SDL_strlen(S)+1) |
574 #define SDL_iconv_utf8_latin1(S) SDL_iconv_string("LATIN1", "UTF-8", S, SDL_strlen(S)+1) | 646 #define SDL_iconv_utf8_latin1(S) SDL_iconv_string("LATIN1", "UTF-8", S, SDL_strlen(S)+1) |
575 #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) | 647 #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) |
576 #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) | 648 #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) |
577 | 649 |
578 /* Ends C function definitions when using C++ */ | 650 /* Ends C function definitions when using C++ */ |
579 #ifdef __cplusplus | 651 #ifdef __cplusplus |
652 /* *INDENT-OFF* */ | |
580 } | 653 } |
654 /* *INDENT-ON* */ | |
581 #endif | 655 #endif |
582 #include "close_code.h" | 656 #include "close_code.h" |
583 | 657 |
584 #endif /* _SDL_stdinc_h */ | 658 #endif /* _SDL_stdinc_h */ |
659 | |
660 /* vi: set ts=4 sw=4 expandtab: */ |