comparison include/SDL_stdinc.h @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children 3695d3637045
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
139 139
140 /* Make sure the types really have the right sizes */ 140 /* Make sure the types really have the right sizes */
141 #define SDL_COMPILE_TIME_ASSERT(name, x) \ 141 #define SDL_COMPILE_TIME_ASSERT(name, x) \
142 typedef int SDL_dummy_ ## name[(x) * 2 - 1] 142 typedef int SDL_dummy_ ## name[(x) * 2 - 1]
143 #ifndef DOXYGEN_SHOULD_IGNORE_THIS 143 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
144 SDL_COMPILE_TIME_ASSERT (uint8, sizeof (Uint8) == 1); 144 SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
145 SDL_COMPILE_TIME_ASSERT (sint8, sizeof (Sint8) == 1); 145 SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
146 SDL_COMPILE_TIME_ASSERT (uint16, sizeof (Uint16) == 2); 146 SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
147 SDL_COMPILE_TIME_ASSERT (sint16, sizeof (Sint16) == 2); 147 SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
148 SDL_COMPILE_TIME_ASSERT (uint32, sizeof (Uint32) == 4); 148 SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
149 SDL_COMPILE_TIME_ASSERT (sint32, sizeof (Sint32) == 4); 149 SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
150 SDL_COMPILE_TIME_ASSERT (uint64, sizeof (Uint64) == 8); 150 SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
151 SDL_COMPILE_TIME_ASSERT (sint64, sizeof (Sint64) == 8); 151 SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
152 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ 152 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
153 153
154 /* 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.
155 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
156 enums having the size of an int must be enabled. 156 enums having the size of an int must be enabled.
165 typedef enum 165 typedef enum
166 { 166 {
167 DUMMY_ENUM_VALUE 167 DUMMY_ENUM_VALUE
168 } SDL_DUMMY_ENUM; 168 } SDL_DUMMY_ENUM;
169 169
170 SDL_COMPILE_TIME_ASSERT (enum, sizeof (SDL_DUMMY_ENUM) == sizeof (int)); 170 SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
171 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ 171 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */
172 172
173 #include "begin_code.h" 173 #include "begin_code.h"
174 /* Set up for C function definitions, even when using C++ */ 174 /* Set up for C function definitions, even when using C++ */
175 #ifdef __cplusplus 175 #ifdef __cplusplus
179 #endif 179 #endif
180 180
181 #ifdef HAVE_MALLOC 181 #ifdef HAVE_MALLOC
182 #define SDL_malloc malloc 182 #define SDL_malloc malloc
183 #else 183 #else
184 extern DECLSPEC void *SDLCALL SDL_malloc (size_t size); 184 extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
185 #endif 185 #endif
186 186
187 #ifdef HAVE_CALLOC 187 #ifdef HAVE_CALLOC
188 #define SDL_calloc calloc 188 #define SDL_calloc calloc
189 #else 189 #else
190 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);
191 #endif 191 #endif
192 192
193 #ifdef HAVE_REALLOC 193 #ifdef HAVE_REALLOC
194 #define SDL_realloc realloc 194 #define SDL_realloc realloc
195 #else 195 #else
196 extern DECLSPEC void *SDLCALL SDL_realloc (void *mem, size_t size); 196 extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
197 #endif 197 #endif
198 198
199 #ifdef HAVE_FREE 199 #ifdef HAVE_FREE
200 #define SDL_free free 200 #define SDL_free free
201 #else 201 #else
202 extern DECLSPEC void SDLCALL SDL_free (void *mem); 202 extern DECLSPEC void SDLCALL SDL_free(void *mem);
203 #endif 203 #endif
204 204
205 #if defined(HAVE_ALLOCA) && !defined(alloca) 205 #if defined(HAVE_ALLOCA) && !defined(alloca)
206 # if defined(HAVE_ALLOCA_H) 206 # if defined(HAVE_ALLOCA_H)
207 # include <alloca.h> 207 # include <alloca.h>
213 # elif defined(__WATCOMC__) 213 # elif defined(__WATCOMC__)
214 # include <malloc.h> 214 # include <malloc.h>
215 # elif defined(__AIX__) 215 # elif defined(__AIX__)
216 #pragma alloca 216 #pragma alloca
217 # elif defined(__MRC__) 217 # elif defined(__MRC__)
218 void *alloca (unsigned); 218 void *alloca(unsigned);
219 # else 219 # else
220 char *alloca (); 220 char *alloca();
221 # endif 221 # endif
222 #endif 222 #endif
223 #ifdef HAVE_ALLOCA 223 #ifdef HAVE_ALLOCA
224 #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count) 224 #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count)
225 #define SDL_stack_free(data) 225 #define SDL_stack_free(data)
229 #endif 229 #endif
230 230
231 #ifdef HAVE_GETENV 231 #ifdef HAVE_GETENV
232 #define SDL_getenv getenv 232 #define SDL_getenv getenv
233 #else 233 #else
234 extern DECLSPEC char *SDLCALL SDL_getenv (const char *name); 234 extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
235 #endif 235 #endif
236 236
237 #ifdef HAVE_PUTENV 237 #ifdef HAVE_PUTENV
238 #define SDL_putenv putenv 238 #define SDL_putenv putenv
239 #else 239 #else
240 extern DECLSPEC int SDLCALL SDL_putenv (const char *variable); 240 extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
241 #endif 241 #endif
242 242
243 #ifdef HAVE_QSORT 243 #ifdef HAVE_QSORT
244 #define SDL_qsort qsort 244 #define SDL_qsort qsort
245 #else 245 #else
246 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,
247 int (*compare) (const void *, 247 int (*compare) (const void *,
248 const void *)); 248 const void *));
249 #endif 249 #endif
250 250
251 #ifdef HAVE_ABS 251 #ifdef HAVE_ABS
252 #define SDL_abs abs 252 #define SDL_abs abs
253 #else 253 #else
270 #endif 270 #endif
271 271
272 #ifdef HAVE_MEMSET 272 #ifdef HAVE_MEMSET
273 #define SDL_memset memset 273 #define SDL_memset memset
274 #else 274 #else
275 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);
276 #endif 276 #endif
277 #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) 277 #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
278 #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) 278 #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
279 279
280 #if defined(__GNUC__) && defined(i386) 280 #if defined(__GNUC__) && defined(i386)
329 #ifdef HAVE_MEMCPY 329 #ifdef HAVE_MEMCPY
330 #define SDL_memcpy memcpy 330 #define SDL_memcpy memcpy
331 #elif defined(HAVE_BCOPY) 331 #elif defined(HAVE_BCOPY)
332 #define SDL_memcpy(d, s, n) bcopy((s), (d), (n)) 332 #define SDL_memcpy(d, s, n) bcopy((s), (d), (n))
333 #else 333 #else
334 extern DECLSPEC void *SDLCALL SDL_memcpy (void *dst, const void *src, 334 extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src,
335 size_t len); 335 size_t len);
336 #endif 336 #endif
337 #endif 337 #endif
338 338
339 #if defined(__GNUC__) && defined(i386) 339 #if defined(__GNUC__) && defined(i386)
340 #define SDL_memcpy4(dst, src, len) \ 340 #define SDL_memcpy4(dst, src, len) \
377 break; \ 377 break; \
378 } \ 378 } \
379 } while(0) 379 } while(0)
380 #endif 380 #endif
381 #ifndef SDL_revcpy 381 #ifndef SDL_revcpy
382 extern DECLSPEC void *SDLCALL SDL_revcpy (void *dst, const void *src, 382 extern DECLSPEC void *SDLCALL SDL_revcpy(void *dst, const void *src,
383 size_t len); 383 size_t len);
384 #endif 384 #endif
385 385
386 #ifdef HAVE_MEMMOVE 386 #ifdef HAVE_MEMMOVE
387 #define SDL_memmove memmove 387 #define SDL_memmove memmove
388 #elif defined(HAVE_BCOPY) 388 #elif defined(HAVE_BCOPY)
399 #endif 399 #endif
400 400
401 #ifdef HAVE_MEMCMP 401 #ifdef HAVE_MEMCMP
402 #define SDL_memcmp memcmp 402 #define SDL_memcmp memcmp
403 #else 403 #else
404 extern DECLSPEC int SDLCALL SDL_memcmp (const void *s1, const void *s2, 404 extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2,
405 size_t len); 405 size_t len);
406 #endif 406 #endif
407 407
408 #ifdef HAVE_STRLEN 408 #ifdef HAVE_STRLEN
409 #define SDL_strlen strlen 409 #define SDL_strlen strlen
410 #else 410 #else
411 extern DECLSPEC size_t SDLCALL SDL_strlen (const char *string); 411 extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
412 #endif 412 #endif
413 413
414 #ifdef HAVE_STRLCPY 414 #ifdef HAVE_STRLCPY
415 #define SDL_strlcpy strlcpy 415 #define SDL_strlcpy strlcpy
416 #else 416 #else
417 extern DECLSPEC size_t SDLCALL SDL_strlcpy (char *dst, const char *src, 417 extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src,
418 size_t maxlen); 418 size_t maxlen);
419 #endif 419 #endif
420 420
421 #ifdef HAVE_STRLCAT 421 #ifdef HAVE_STRLCAT
422 #define SDL_strlcat strlcat 422 #define SDL_strlcat strlcat
423 #else 423 #else
424 extern DECLSPEC size_t SDLCALL SDL_strlcat (char *dst, const char *src, 424 extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src,
425 size_t maxlen); 425 size_t maxlen);
426 #endif 426 #endif
427 427
428 #ifdef HAVE_STRDUP 428 #ifdef HAVE_STRDUP
429 #define SDL_strdup strdup 429 #define SDL_strdup strdup
430 #else 430 #else
431 extern DECLSPEC char *SDLCALL SDL_strdup (const char *string); 431 extern DECLSPEC char *SDLCALL SDL_strdup(const char *string);
432 #endif 432 #endif
433 433
434 #ifdef HAVE__STRREV 434 #ifdef HAVE__STRREV
435 #define SDL_strrev _strrev 435 #define SDL_strrev _strrev
436 #else 436 #else
437 extern DECLSPEC char *SDLCALL SDL_strrev (char *string); 437 extern DECLSPEC char *SDLCALL SDL_strrev(char *string);
438 #endif 438 #endif
439 439
440 #ifdef HAVE__STRUPR 440 #ifdef HAVE__STRUPR
441 #define SDL_strupr _strupr 441 #define SDL_strupr _strupr
442 #else 442 #else
443 extern DECLSPEC char *SDLCALL SDL_strupr (char *string); 443 extern DECLSPEC char *SDLCALL SDL_strupr(char *string);
444 #endif 444 #endif
445 445
446 #ifdef HAVE__STRLWR 446 #ifdef HAVE__STRLWR
447 #define SDL_strlwr _strlwr 447 #define SDL_strlwr _strlwr
448 #else 448 #else
449 extern DECLSPEC char *SDLCALL SDL_strlwr (char *string); 449 extern DECLSPEC char *SDLCALL SDL_strlwr(char *string);
450 #endif 450 #endif
451 451
452 #ifdef HAVE_STRCHR 452 #ifdef HAVE_STRCHR
453 #define SDL_strchr strchr 453 #define SDL_strchr strchr
454 #elif defined(HAVE_INDEX) 454 #elif defined(HAVE_INDEX)
455 #define SDL_strchr index 455 #define SDL_strchr index
456 #else 456 #else
457 extern DECLSPEC char *SDLCALL SDL_strchr (const char *string, int c); 457 extern DECLSPEC char *SDLCALL SDL_strchr(const char *string, int c);
458 #endif 458 #endif
459 459
460 #ifdef HAVE_STRRCHR 460 #ifdef HAVE_STRRCHR
461 #define SDL_strrchr strrchr 461 #define SDL_strrchr strrchr
462 #elif defined(HAVE_RINDEX) 462 #elif defined(HAVE_RINDEX)
463 #define SDL_strrchr rindex 463 #define SDL_strrchr rindex
464 #else 464 #else
465 extern DECLSPEC char *SDLCALL SDL_strrchr (const char *string, int c); 465 extern DECLSPEC char *SDLCALL SDL_strrchr(const char *string, int c);
466 #endif 466 #endif
467 467
468 #ifdef HAVE_STRSTR 468 #ifdef HAVE_STRSTR
469 #define SDL_strstr strstr 469 #define SDL_strstr strstr
470 #else 470 #else
471 extern DECLSPEC char *SDLCALL SDL_strstr (const char *haystack, 471 extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack,
472 const char *needle); 472 const char *needle);
473 #endif 473 #endif
474 474
475 #ifdef HAVE_ITOA 475 #ifdef HAVE_ITOA
476 #define SDL_itoa itoa 476 #define SDL_itoa itoa
477 #else 477 #else
479 #endif 479 #endif
480 480
481 #ifdef HAVE__LTOA 481 #ifdef HAVE__LTOA
482 #define SDL_ltoa _ltoa 482 #define SDL_ltoa _ltoa
483 #else 483 #else
484 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);
485 #endif 485 #endif
486 486
487 #ifdef HAVE__UITOA 487 #ifdef HAVE__UITOA
488 #define SDL_uitoa _uitoa 488 #define SDL_uitoa _uitoa
489 #else 489 #else
491 #endif 491 #endif
492 492
493 #ifdef HAVE__ULTOA 493 #ifdef HAVE__ULTOA
494 #define SDL_ultoa _ultoa 494 #define SDL_ultoa _ultoa
495 #else 495 #else
496 extern DECLSPEC char *SDLCALL SDL_ultoa (unsigned long value, char *string, 496 extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *string,
497 int radix); 497 int radix);
498 #endif 498 #endif
499 499
500 #ifdef HAVE_STRTOL 500 #ifdef HAVE_STRTOL
501 #define SDL_strtol strtol 501 #define SDL_strtol strtol
502 #else 502 #else
503 extern DECLSPEC long SDLCALL SDL_strtol (const char *string, char **endp, 503 extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp,
504 int base); 504 int base);
505 #endif 505 #endif
506 506
507 #ifdef HAVE_STRTOUL 507 #ifdef HAVE_STRTOUL
508 #define SDL_strtoul strtoul 508 #define SDL_strtoul strtoul
509 #else 509 #else
510 extern DECLSPEC unsigned long SDLCALL SDL_strtoul (const char *string, 510 extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string,
511 char **endp, int base); 511 char **endp, int base);
512 #endif 512 #endif
513 513
514 #ifdef SDL_HAS_64BIT_TYPE 514 #ifdef SDL_HAS_64BIT_TYPE
515 515
516 #ifdef HAVE__I64TOA 516 #ifdef HAVE__I64TOA
517 #define SDL_lltoa _i64toa 517 #define SDL_lltoa _i64toa
518 #else 518 #else
519 extern DECLSPEC char *SDLCALL SDL_lltoa (Sint64 value, char *string, 519 extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *string,
520 int radix); 520 int radix);
521 #endif 521 #endif
522 522
523 #ifdef HAVE__UI64TOA 523 #ifdef HAVE__UI64TOA
524 #define SDL_ulltoa _ui64toa 524 #define SDL_ulltoa _ui64toa
525 #else 525 #else
526 extern DECLSPEC char *SDLCALL SDL_ulltoa (Uint64 value, char *string, 526 extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *string,
527 int radix); 527 int radix);
528 #endif 528 #endif
529 529
530 #ifdef HAVE_STRTOLL 530 #ifdef HAVE_STRTOLL
531 #define SDL_strtoll strtoll 531 #define SDL_strtoll strtoll
532 #else 532 #else
533 extern DECLSPEC Sint64 SDLCALL SDL_strtoll (const char *string, char **endp, 533 extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp,
534 int base); 534 int base);
535 #endif 535 #endif
536 536
537 #ifdef HAVE_STRTOULL 537 #ifdef HAVE_STRTOULL
538 #define SDL_strtoull strtoull 538 #define SDL_strtoull strtoull
539 #else 539 #else
540 extern DECLSPEC Uint64 SDLCALL SDL_strtoull (const char *string, char **endp, 540 extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp,
541 int base); 541 int base);
542 #endif 542 #endif
543 543
544 #endif /* SDL_HAS_64BIT_TYPE */ 544 #endif /* SDL_HAS_64BIT_TYPE */
545 545
546 #ifdef HAVE_STRTOD 546 #ifdef HAVE_STRTOD
547 #define SDL_strtod strtod 547 #define SDL_strtod strtod
548 #else 548 #else
549 extern DECLSPEC double SDLCALL SDL_strtod (const char *string, char **endp); 549 extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp);
550 #endif 550 #endif
551 551
552 #ifdef HAVE_ATOI 552 #ifdef HAVE_ATOI
553 #define SDL_atoi atoi 553 #define SDL_atoi atoi
554 #else 554 #else
562 #endif 562 #endif
563 563
564 #ifdef HAVE_STRCMP 564 #ifdef HAVE_STRCMP
565 #define SDL_strcmp strcmp 565 #define SDL_strcmp strcmp
566 #else 566 #else
567 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);
568 #endif 568 #endif
569 569
570 #ifdef HAVE_STRNCMP 570 #ifdef HAVE_STRNCMP
571 #define SDL_strncmp strncmp 571 #define SDL_strncmp strncmp
572 #else 572 #else
573 extern DECLSPEC int SDLCALL SDL_strncmp (const char *str1, const char *str2, 573 extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2,
574 size_t maxlen); 574 size_t maxlen);
575 #endif 575 #endif
576 576
577 #ifdef HAVE_STRCASECMP 577 #ifdef HAVE_STRCASECMP
578 #define SDL_strcasecmp strcasecmp 578 #define SDL_strcasecmp strcasecmp
579 #elif defined(HAVE__STRICMP) 579 #elif defined(HAVE__STRICMP)
580 #define SDL_strcasecmp _stricmp 580 #define SDL_strcasecmp _stricmp
581 #else 581 #else
582 extern DECLSPEC int SDLCALL SDL_strcasecmp (const char *str1, 582 extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1,
583 const char *str2); 583 const char *str2);
584 #endif 584 #endif
585 585
586 #ifdef HAVE_STRNCASECMP 586 #ifdef HAVE_STRNCASECMP
587 #define SDL_strncasecmp strncasecmp 587 #define SDL_strncasecmp strncasecmp
588 #elif defined(HAVE__STRNICMP) 588 #elif defined(HAVE__STRNICMP)
589 #define SDL_strncasecmp _strnicmp 589 #define SDL_strncasecmp _strnicmp
590 #else 590 #else
591 extern DECLSPEC int SDLCALL SDL_strncasecmp (const char *str1, 591 extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1,
592 const char *str2, size_t maxlen); 592 const char *str2, size_t maxlen);
593 #endif 593 #endif
594 594
595 #ifdef HAVE_SSCANF 595 #ifdef HAVE_SSCANF
596 #define SDL_sscanf sscanf 596 #define SDL_sscanf sscanf
597 #else 597 #else
598 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 ...); 599 ...);
600 #endif 600 #endif
601 601
602 #ifdef HAVE_SNPRINTF 602 #ifdef HAVE_SNPRINTF
603 #define SDL_snprintf snprintf 603 #define SDL_snprintf snprintf
604 #else 604 #else
605 extern DECLSPEC int SDLCALL SDL_snprintf (char *text, size_t maxlen, 605 extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen,
606 const char *fmt, ...); 606 const char *fmt, ...);
607 #endif 607 #endif
608 608
609 #ifdef HAVE_VSNPRINTF 609 #ifdef HAVE_VSNPRINTF
610 #define SDL_vsnprintf vsnprintf 610 #define SDL_vsnprintf vsnprintf
611 #else 611 #else
612 extern DECLSPEC int SDLCALL SDL_vsnprintf (char *text, size_t maxlen, 612 extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen,
613 const char *fmt, va_list ap); 613 const char *fmt, va_list ap);
614 #endif 614 #endif
615 615
616 /* The SDL implementation of iconv() returns these error codes */ 616 /* The SDL implementation of iconv() returns these error codes */
617 #define SDL_ICONV_ERROR (size_t)-1 617 #define SDL_ICONV_ERROR (size_t)-1
618 #define SDL_ICONV_E2BIG (size_t)-2 618 #define SDL_ICONV_E2BIG (size_t)-2
621 621
622 #ifdef HAVE_ICONV 622 #ifdef HAVE_ICONV
623 #define SDL_iconv_t iconv_t 623 #define SDL_iconv_t iconv_t
624 #define SDL_iconv_open iconv_open 624 #define SDL_iconv_open iconv_open
625 #define SDL_iconv_close iconv_close 625 #define SDL_iconv_close iconv_close
626 extern DECLSPEC size_t SDLCALL SDL_iconv (SDL_iconv_t cd, char **inbuf, 626 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf,
627 size_t * inbytesleft, char **outbuf, 627 size_t * inbytesleft, char **outbuf,
628 size_t * outbytesleft); 628 size_t * outbytesleft);
629 #else 629 #else
630 typedef struct _SDL_iconv_t *SDL_iconv_t; 630 typedef struct _SDL_iconv_t *SDL_iconv_t;
631 extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open (const char *tocode, 631 extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
632 const char *fromcode); 632 const char *fromcode);
633 extern DECLSPEC int SDLCALL SDL_iconv_close (SDL_iconv_t cd); 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, 634 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf,
635 size_t * inbytesleft, char **outbuf, 635 size_t * inbytesleft, char **outbuf,
636 size_t * outbytesleft); 636 size_t * outbytesleft);
637 #endif 637 #endif
638 /* 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
639 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.
640 */ 640 */
641 extern DECLSPEC char *SDLCALL SDL_iconv_string (const char *tocode, 641 extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
642 const char *fromcode, 642 const char *fromcode,
643 char *inbuf, 643 char *inbuf,
644 size_t inbytesleft); 644 size_t inbytesleft);
645 #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)
646 #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)
647 #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)
648 #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)
649 649