00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00029 #ifndef _SDL_stdinc_h
00030 #define _SDL_stdinc_h
00031
00032 #include "SDL_config.h"
00033
00034
00035 #ifdef HAVE_SYS_TYPES_H
00036 #include <sys/types.h>
00037 #endif
00038 #ifdef HAVE_STDIO_H
00039 #include <stdio.h>
00040 #endif
00041 #if defined(STDC_HEADERS)
00042 # include <stdlib.h>
00043 # include <stddef.h>
00044 # include <stdarg.h>
00045 #else
00046 # if defined(HAVE_STDLIB_H)
00047 # include <stdlib.h>
00048 # elif defined(HAVE_MALLOC_H)
00049 # include <malloc.h>
00050 # endif
00051 # if defined(HAVE_STDDEF_H)
00052 # include <stddef.h>
00053 # endif
00054 # if defined(HAVE_STDARG_H)
00055 # include <stdarg.h>
00056 # endif
00057 #endif
00058 #ifdef HAVE_STRING_H
00059 # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
00060 # include <memory.h>
00061 # endif
00062 # include <string.h>
00063 #endif
00064 #ifdef HAVE_STRINGS_H
00065 # include <strings.h>
00066 #endif
00067 #if defined(HAVE_INTTYPES_H)
00068 # include <inttypes.h>
00069 #elif defined(HAVE_STDINT_H)
00070 # include <stdint.h>
00071 #endif
00072 #ifdef HAVE_CTYPE_H
00073 # include <ctype.h>
00074 #endif
00075 #ifdef HAVE_MATH_H
00076 # include <math.h>
00077 #endif
00078 #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
00079 # include <iconv.h>
00080 #endif
00081
00082
00083 #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
00084 #define SDL_TABLESIZE(table) SDL_arraysize(table)
00085
00086
00087
00088 #ifdef __cplusplus
00089 #define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
00090 #define SDL_static_cast(type, expression) static_cast<type>(expression)
00091 #else
00092 #define SDL_reinterpret_cast(type, expression) ((type)(expression))
00093 #define SDL_static_cast(type, expression) ((type)(expression))
00094 #endif
00095
00096
00097 typedef enum SDL_bool
00098 {
00099 SDL_FALSE = 0,
00100 SDL_TRUE = 1
00101 } SDL_bool;
00102
00107 typedef int8_t Sint8;
00112 typedef uint8_t Uint8;
00117 typedef int16_t Sint16;
00122 typedef uint16_t Uint16;
00127 typedef int32_t Sint32;
00132 typedef uint32_t Uint32;
00133
00134 #ifdef SDL_HAS_64BIT_TYPE
00135
00140 typedef int64_t Sint64;
00146 typedef uint64_t Uint64;
00147 #else
00148
00149 typedef Sint32 Sint64;
00150 typedef Uint32 Uint64;
00151 #endif
00152
00153
00154 #define SDL_COMPILE_TIME_ASSERT(name, x) \
00155 typedef int SDL_dummy_ ## name[(x) * 2 - 1]
00156 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00157 SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
00158 SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
00159 SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
00160 SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
00161 SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
00162 SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
00163 #ifndef __NINTENDODS__
00164
00165
00166 SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
00167 SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
00168 #endif
00169 #endif
00170
00171
00172
00173
00174
00175
00176
00177 #ifdef __MWERKS__
00178 #pragma enumsalwaysint on
00179 #endif
00180
00181 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00182 #ifndef __NINTENDODS__
00183 typedef enum
00184 {
00185 DUMMY_ENUM_VALUE
00186 } SDL_DUMMY_ENUM;
00187
00188 SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
00189 #endif
00190 #endif
00191
00192 #include "begin_code.h"
00193
00194 #ifdef __cplusplus
00195
00196 extern "C" {
00197
00198 #endif
00199
00200 #ifdef HAVE_MALLOC
00201 #define SDL_malloc malloc
00202 #else
00203 extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
00204 #endif
00205
00206 #ifdef HAVE_CALLOC
00207 #define SDL_calloc calloc
00208 #else
00209 extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
00210 #endif
00211
00212 #ifdef HAVE_REALLOC
00213 #define SDL_realloc realloc
00214 #else
00215 extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
00216 #endif
00217
00218 #ifdef HAVE_FREE
00219 #define SDL_free free
00220 #else
00221 extern DECLSPEC void SDLCALL SDL_free(void *mem);
00222 #endif
00223
00224 #if defined(HAVE_ALLOCA) && !defined(alloca)
00225 # if defined(HAVE_ALLOCA_H)
00226 # include <alloca.h>
00227 # elif defined(__GNUC__)
00228 # define alloca __builtin_alloca
00229 # elif defined(_MSC_VER)
00230 # include <malloc.h>
00231 # define alloca _alloca
00232 # elif defined(__WATCOMC__)
00233 # include <malloc.h>
00234 # elif defined(__BORLANDC__)
00235 # include <malloc.h>
00236 # elif defined(__DMC__)
00237 # include <stdlib.h>
00238 # elif defined(__AIX__)
00239 #pragma alloca
00240 # elif defined(__MRC__)
00241 void *alloca(unsigned);
00242 # else
00243 char *alloca();
00244 # endif
00245 #endif
00246 #ifdef HAVE_ALLOCA
00247 #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count))
00248 #define SDL_stack_free(data)
00249 #else
00250 #define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count))
00251 #define SDL_stack_free(data) SDL_free(data)
00252 #endif
00253
00254 #ifdef HAVE_GETENV
00255 #define SDL_getenv getenv
00256 #else
00257 extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
00258 #endif
00259
00260 #ifdef HAVE_PUTENV
00261 #define SDL_putenv putenv
00262 #else
00263 extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
00264 #endif
00265
00266 #ifdef HAVE_QSORT
00267 #define SDL_qsort qsort
00268 #else
00269 extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
00270 int (*compare) (const void *,
00271 const void *));
00272 #endif
00273
00274 #ifdef HAVE_ABS
00275 #define SDL_abs abs
00276 #else
00277 #define SDL_abs(X) ((X) < 0 ? -(X) : (X))
00278 #endif
00279
00280 #define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
00281 #define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
00282
00283 #ifdef HAVE_CTYPE_H
00284 #define SDL_isdigit(X) isdigit(X)
00285 #define SDL_isspace(X) isspace(X)
00286 #define SDL_toupper(X) toupper(X)
00287 #define SDL_tolower(X) tolower(X)
00288 #else
00289 #define SDL_isdigit(X) (((X) >= '0') && ((X) <= '9'))
00290 #define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n'))
00291 #define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X))
00292 #define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X))
00293 #endif
00294
00295 #ifdef HAVE_MEMSET
00296 #define SDL_memset memset
00297 #else
00298 extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len);
00299 #endif
00300 #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
00301 #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
00302
00303 #if defined(__GNUC__) && defined(i386)
00304 #define SDL_memset4(dst, val, len) \
00305 do { \
00306 int u0, u1, u2; \
00307 __asm__ __volatile__ ( \
00308 "cld\n\t" \
00309 "rep ; stosl\n\t" \
00310 : "=&D" (u0), "=&a" (u1), "=&c" (u2) \
00311 : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len)) \
00312 : "memory" ); \
00313 } while(0)
00314 #endif
00315 #ifndef SDL_memset4
00316 #define SDL_memset4(dst, val, len) \
00317 do { \
00318 unsigned _count = (len); \
00319 unsigned _n = (_count + 3) / 4; \
00320 Uint32 *_p = SDL_static_cast(Uint32 *, dst); \
00321 Uint32 _val = (val); \
00322 if (len == 0) break; \
00323 switch (_count % 4) { \
00324 case 0: do { *_p++ = _val; \
00325 case 3: *_p++ = _val; \
00326 case 2: *_p++ = _val; \
00327 case 1: *_p++ = _val; \
00328 } while ( --_n ); \
00329 } \
00330 } while(0)
00331 #endif
00332
00333
00334 #if defined(__MACH__) && defined(__APPLE__)
00335 #define SDL_memcpy(dst, src, len) memcpy(dst, src, len)
00336 #elif defined(__GNUC__) && defined(i386)
00337 #define SDL_memcpy(dst, src, len) \
00338 do { \
00339 int u0, u1, u2; \
00340 __asm__ __volatile__ ( \
00341 "cld\n\t" \
00342 "rep ; movsl\n\t" \
00343 "testb $2,%b4\n\t" \
00344 "je 1f\n\t" \
00345 "movsw\n" \
00346 "1:\ttestb $1,%b4\n\t" \
00347 "je 2f\n\t" \
00348 "movsb\n" \
00349 "2:" \
00350 : "=&c" (u0), "=&D" (u1), "=&S" (u2) \
00351 : "0" (SDL_static_cast(unsigned, len)/4), "q" (len), "1" (dst),"2" (src) \
00352 : "memory" ); \
00353 } while(0)
00354 #endif
00355 #ifndef SDL_memcpy
00356 #ifdef HAVE_MEMCPY
00357 #define SDL_memcpy memcpy
00358 #elif defined(HAVE_BCOPY)
00359 #define SDL_memcpy(d, s, n) bcopy((s), (d), (n))
00360 #else
00361 extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src,
00362 size_t len);
00363 #endif
00364 #endif
00365
00366
00367 #if defined(__MACH__) && defined(__APPLE__)
00368 #define SDL_memcpy4(dst, src, len) memcpy(dst, src, (len)*4)
00369 #elif defined(__GNUC__) && defined(i386)
00370 #define SDL_memcpy4(dst, src, len) \
00371 do { \
00372 int ecx, edi, esi; \
00373 __asm__ __volatile__ ( \
00374 "cld\n\t" \
00375 "rep ; movsl" \
00376 : "=&c" (ecx), "=&D" (edi), "=&S" (esi) \
00377 : "0" (SDL_static_cast(unsigned, len)), "1" (dst), "2" (src) \
00378 : "memory" ); \
00379 } while(0)
00380 #endif
00381 #ifndef SDL_memcpy4
00382 #define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2)
00383 #endif
00384
00385 #if defined(__GNUC__) && defined(i386)
00386 #define SDL_revcpy(dst, src, len) \
00387 do { \
00388 int u0, u1, u2; \
00389 char *dstp = SDL_static_cast(char *, dst); \
00390 char *srcp = SDL_static_cast(char *, src); \
00391 int n = (len); \
00392 if ( n >= 4 ) { \
00393 __asm__ __volatile__ ( \
00394 "std\n\t" \
00395 "rep ; movsl\n\t" \
00396 "cld\n\t" \
00397 : "=&c" (u0), "=&D" (u1), "=&S" (u2) \
00398 : "0" (n >> 2), \
00399 "1" (dstp+(n-4)), "2" (srcp+(n-4)) \
00400 : "memory" ); \
00401 } \
00402 switch (n & 3) { \
00403 case 3: dstp[2] = srcp[2]; \
00404 case 2: dstp[1] = srcp[1]; \
00405 case 1: dstp[0] = srcp[0]; \
00406 break; \
00407 default: \
00408 break; \
00409 } \
00410 } while(0)
00411 #endif
00412 #ifndef SDL_revcpy
00413 extern DECLSPEC void *SDLCALL SDL_revcpy(void *dst, const void *src,
00414 size_t len);
00415 #endif
00416
00417 #ifdef HAVE_MEMMOVE
00418 #define SDL_memmove memmove
00419 #elif defined(HAVE_BCOPY)
00420 #define SDL_memmove(d, s, n) bcopy((s), (d), (n))
00421 #else
00422 #define SDL_memmove(dst, src, len) \
00423 do { \
00424 if ( dst < src ) { \
00425 SDL_memcpy(dst, src, len); \
00426 } else { \
00427 SDL_revcpy(dst, src, len); \
00428 } \
00429 } while(0)
00430 #endif
00431
00432 #ifdef HAVE_MEMCMP
00433 #define SDL_memcmp memcmp
00434 #else
00435 extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2,
00436 size_t len);
00437 #endif
00438
00439 #ifdef HAVE_STRLEN
00440 #define SDL_strlen strlen
00441 #else
00442 extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
00443 #endif
00444
00445 #ifdef HAVE_WCSLEN
00446 #define SDL_wcslen wcslen
00447 #else
00448 #if !defined(wchar_t) && defined(__NINTENDODS__)
00449 #define wchar_t short
00450 #endif
00451 extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t * string);
00452 #endif
00453
00454 #ifdef HAVE_STRLCPY
00455 #define SDL_strlcpy strlcpy
00456 #else
00457 extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src,
00458 size_t maxlen);
00459 #endif
00460
00461 #ifdef HAVE_STRLCAT
00462 #define SDL_strlcat strlcat
00463 #else
00464 extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src,
00465 size_t maxlen);
00466 #endif
00467
00468 #ifdef HAVE_STRDUP
00469 #define SDL_strdup strdup
00470 #else
00471 extern DECLSPEC char *SDLCALL SDL_strdup(const char *string);
00472 #endif
00473
00474 #ifdef HAVE__STRREV
00475 #define SDL_strrev _strrev
00476 #else
00477 extern DECLSPEC char *SDLCALL SDL_strrev(char *string);
00478 #endif
00479
00480 #ifdef HAVE__STRUPR
00481 #define SDL_strupr _strupr
00482 #else
00483 extern DECLSPEC char *SDLCALL SDL_strupr(char *string);
00484 #endif
00485
00486 #ifdef HAVE__STRLWR
00487 #define SDL_strlwr _strlwr
00488 #else
00489 extern DECLSPEC char *SDLCALL SDL_strlwr(char *string);
00490 #endif
00491
00492 #ifdef HAVE_STRCHR
00493 #define SDL_strchr strchr
00494 #elif defined(HAVE_INDEX)
00495 #define SDL_strchr index
00496 #else
00497 extern DECLSPEC char *SDLCALL SDL_strchr(const char *string, int c);
00498 #endif
00499
00500 #ifdef HAVE_STRRCHR
00501 #define SDL_strrchr strrchr
00502 #elif defined(HAVE_RINDEX)
00503 #define SDL_strrchr rindex
00504 #else
00505 extern DECLSPEC char *SDLCALL SDL_strrchr(const char *string, int c);
00506 #endif
00507
00508 #ifdef HAVE_STRSTR
00509 #define SDL_strstr strstr
00510 #else
00511 extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack,
00512 const char *needle);
00513 #endif
00514
00515 #ifdef HAVE_ITOA
00516 #define SDL_itoa itoa
00517 #else
00518 #define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix)
00519 #endif
00520
00521 #ifdef HAVE__LTOA
00522 #define SDL_ltoa _ltoa
00523 #else
00524 extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *string, int radix);
00525 #endif
00526
00527 #ifdef HAVE__UITOA
00528 #define SDL_uitoa _uitoa
00529 #else
00530 #define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix)
00531 #endif
00532
00533 #ifdef HAVE__ULTOA
00534 #define SDL_ultoa _ultoa
00535 #else
00536 extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *string,
00537 int radix);
00538 #endif
00539
00540 #ifdef HAVE_STRTOL
00541 #define SDL_strtol strtol
00542 #else
00543 extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp,
00544 int base);
00545 #endif
00546
00547 #ifdef HAVE_STRTOUL
00548 #define SDL_strtoul strtoul
00549 #else
00550 extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string,
00551 char **endp, int base);
00552 #endif
00553
00554 #ifdef SDL_HAS_64BIT_TYPE
00555
00556 #ifdef HAVE__I64TOA
00557 #define SDL_lltoa _i64toa
00558 #else
00559 extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *string,
00560 int radix);
00561 #endif
00562
00563 #ifdef HAVE__UI64TOA
00564 #define SDL_ulltoa _ui64toa
00565 #else
00566 extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *string,
00567 int radix);
00568 #endif
00569
00570 #ifdef HAVE_STRTOLL
00571 #define SDL_strtoll strtoll
00572 #else
00573 extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp,
00574 int base);
00575 #endif
00576
00577 #ifdef HAVE_STRTOULL
00578 #define SDL_strtoull strtoull
00579 #else
00580 extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp,
00581 int base);
00582 #endif
00583
00584 #endif
00585
00586 #ifdef HAVE_STRTOD
00587 #define SDL_strtod strtod
00588 #else
00589 extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp);
00590 #endif
00591
00592 #ifdef HAVE_ATOI
00593 #define SDL_atoi atoi
00594 #else
00595 #define SDL_atoi(X) SDL_strtol(X, NULL, 0)
00596 #endif
00597
00598 #ifdef HAVE_ATOF
00599 #define SDL_atof atof
00600 #else
00601 #define SDL_atof(X) SDL_strtod(X, NULL)
00602 #endif
00603
00604 #ifdef HAVE_STRCMP
00605 #define SDL_strcmp strcmp
00606 #else
00607 extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
00608 #endif
00609
00610 #ifdef HAVE_STRNCMP
00611 #define SDL_strncmp strncmp
00612 #else
00613 extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2,
00614 size_t maxlen);
00615 #endif
00616
00617 #ifdef HAVE_STRCASECMP
00618 #define SDL_strcasecmp strcasecmp
00619 #elif defined(HAVE__STRICMP)
00620 #define SDL_strcasecmp _stricmp
00621 #else
00622 extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1,
00623 const char *str2);
00624 #endif
00625
00626 #ifdef HAVE_STRNCASECMP
00627 #define SDL_strncasecmp strncasecmp
00628 #elif defined(HAVE__STRNICMP)
00629 #define SDL_strncasecmp _strnicmp
00630 #else
00631 extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1,
00632 const char *str2, size_t maxlen);
00633 #endif
00634
00635 #ifdef HAVE_SSCANF
00636 #define SDL_sscanf sscanf
00637 #else
00638 extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt,
00639 ...);
00640 #endif
00641
00642 #ifdef HAVE_SNPRINTF
00643 #define SDL_snprintf snprintf
00644 #else
00645 extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen,
00646 const char *fmt, ...);
00647 #endif
00648
00649 #ifdef HAVE_VSNPRINTF
00650 #define SDL_vsnprintf vsnprintf
00651 #else
00652 extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen,
00653 const char *fmt, va_list ap);
00654 #endif
00655
00656 #ifndef HAVE_M_PI
00657 #define M_PI 3.14159265358979323846264338327950288
00658 #endif
00659
00660 #ifdef HAVE_CEIL
00661 #define SDL_ceil ceil
00662 #else
00663 #define SDL_ceil(x) ((double)(int)((x)+0.5))
00664 #endif
00665
00666 #ifdef HAVE_COPYSIGN
00667 #define SDL_copysign copysign
00668 #else
00669 extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
00670 #endif
00671
00672 #ifdef HAVE_COS
00673 #define SDL_cos cos
00674 #else
00675 extern DECLSPEC double SDLCALL SDL_cos(double x);
00676 #endif
00677
00678 #ifdef HAVE_COSF
00679 #define SDL_cosf cosf
00680 #else
00681 #define SDL_cosf(x) (float)SDL_cos((double)x)
00682 #endif
00683
00684 #ifdef HAVE_FABS
00685 #define SDL_fabs fabs
00686 #else
00687 extern DECLSPEC double SDLCALL SDL_fabs(double x);
00688 #endif
00689
00690 #ifdef HAVE_FLOOR
00691 #define SDL_floor floor
00692 #else
00693 extern DECLSPEC double SDLCALL SDL_floor(double x);
00694 #endif
00695
00696 #ifdef HAVE_LOG
00697 #define SDL_log log
00698 #else
00699 extern DECLSPEC double SDLCALL SDL_log(double x);
00700 #endif
00701
00702 #ifdef HAVE_POW
00703 #define SDL_pow pow
00704 #else
00705 extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
00706 #endif
00707
00708 #ifdef HAVE_SCALBN
00709 #define SDL_scalbn scalbn
00710 #else
00711 extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
00712 #endif
00713
00714 #ifdef HAVE_SIN
00715 #define SDL_sin sin
00716 #else
00717 extern DECLSPEC double SDLCALL SDL_sin(double x);
00718 #endif
00719
00720 #ifdef HAVE_SINF
00721 #define SDL_sinf sinf
00722 #else
00723 #define SDL_sinf(x) (float)SDL_sin((double)x)
00724 #endif
00725
00726 #ifdef HAVE_SQRT
00727 #define SDL_sqrt sqrt
00728 #else
00729 extern DECLSPEC double SDLCALL SDL_sqrt(double x);
00730 #endif
00731
00732
00733 #define SDL_ICONV_ERROR (size_t)-1
00734 #define SDL_ICONV_E2BIG (size_t)-2
00735 #define SDL_ICONV_EILSEQ (size_t)-3
00736 #define SDL_ICONV_EINVAL (size_t)-4
00737
00738 #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
00739 #define SDL_iconv_t iconv_t
00740 #define SDL_iconv_open iconv_open
00741 #define SDL_iconv_close iconv_close
00742 #else
00743 typedef struct _SDL_iconv_t *SDL_iconv_t;
00744 extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
00745 const char *fromcode);
00746 extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
00747 #endif
00748 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
00749 size_t * inbytesleft, char **outbuf,
00750 size_t * outbytesleft);
00751
00752
00753
00754 extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
00755 const char *fromcode,
00756 const char *inbuf,
00757 size_t inbytesleft);
00758 #define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
00759 #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1)
00760 #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1)
00761
00762
00763 #ifdef __cplusplus
00764
00765 }
00766
00767 #endif
00768 #include "close_code.h"
00769
00770 #endif
00771
00772