PageRenderTime 25ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/win32/include/SDL_stdinc.h

https://github.com/GizmoR13/pioneer
C Header | 620 lines | 495 code | 71 blank | 54 comment | 42 complexity | 925283eea4fba019bf560e3c63e54260 MD5 | raw file
  1. /*
  2. SDL - Simple DirectMedia Layer
  3. Copyright (C) 1997-2009 Sam Lantinga
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  15. Sam Lantinga
  16. slouken@libsdl.org
  17. */
  18. /** @file SDL_stdinc.h
  19. * This is a general header that includes C language support
  20. */
  21. #ifndef _SDL_stdinc_h
  22. #define _SDL_stdinc_h
  23. #include "SDL_config.h"
  24. #ifdef HAVE_SYS_TYPES_H
  25. #include <sys/types.h>
  26. #endif
  27. #ifdef HAVE_STDIO_H
  28. #include <stdio.h>
  29. #endif
  30. #if defined(STDC_HEADERS)
  31. # include <stdlib.h>
  32. # include <stddef.h>
  33. # include <stdarg.h>
  34. #else
  35. # if defined(HAVE_STDLIB_H)
  36. # include <stdlib.h>
  37. # elif defined(HAVE_MALLOC_H)
  38. # include <malloc.h>
  39. # endif
  40. # if defined(HAVE_STDDEF_H)
  41. # include <stddef.h>
  42. # endif
  43. # if defined(HAVE_STDARG_H)
  44. # include <stdarg.h>
  45. # endif
  46. #endif
  47. #ifdef HAVE_STRING_H
  48. # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
  49. # include <memory.h>
  50. # endif
  51. # include <string.h>
  52. #endif
  53. #ifdef HAVE_STRINGS_H
  54. # include <strings.h>
  55. #endif
  56. #if defined(HAVE_INTTYPES_H)
  57. # include <inttypes.h>
  58. #elif defined(HAVE_STDINT_H)
  59. # include <stdint.h>
  60. #endif
  61. #ifdef HAVE_CTYPE_H
  62. # include <ctype.h>
  63. #endif
  64. #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
  65. # include <iconv.h>
  66. #endif
  67. /** The number of elements in an array */
  68. #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
  69. #define SDL_TABLESIZE(table) SDL_arraysize(table)
  70. /* Use proper C++ casts when compiled as C++ to be compatible with the option
  71. -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above. */
  72. #ifdef __cplusplus
  73. #define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
  74. #define SDL_static_cast(type, expression) static_cast<type>(expression)
  75. #else
  76. #define SDL_reinterpret_cast(type, expression) ((type)(expression))
  77. #define SDL_static_cast(type, expression) ((type)(expression))
  78. #endif
  79. /** @name Basic data types */
  80. /*@{*/
  81. typedef enum {
  82. SDL_FALSE = 0,
  83. SDL_TRUE = 1
  84. } SDL_bool;
  85. typedef int8_t Sint8;
  86. typedef uint8_t Uint8;
  87. typedef int16_t Sint16;
  88. typedef uint16_t Uint16;
  89. typedef int32_t Sint32;
  90. typedef uint32_t Uint32;
  91. #ifdef SDL_HAS_64BIT_TYPE
  92. typedef int64_t Sint64;
  93. #ifndef SYMBIAN32_GCCE
  94. typedef uint64_t Uint64;
  95. #endif
  96. #else
  97. /* This is really just a hack to prevent the compiler from complaining */
  98. typedef struct {
  99. Uint32 hi;
  100. Uint32 lo;
  101. } Uint64, Sint64;
  102. #endif
  103. /*@}*/
  104. /** @name Make sure the types really have the right sizes */
  105. /*@{*/
  106. #define SDL_COMPILE_TIME_ASSERT(name, x) \
  107. typedef int SDL_dummy_ ## name[(x) * 2 - 1]
  108. SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
  109. SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
  110. SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
  111. SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
  112. SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
  113. SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
  114. SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
  115. SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
  116. /*@}*/
  117. /** @name Enum Size Check
  118. * Check to make sure enums are the size of ints, for structure packing.
  119. * For both Watcom C/C++ and Borland C/C++ the compiler option that makes
  120. * enums having the size of an int must be enabled.
  121. * This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
  122. */
  123. /* Enable enums always int in CodeWarrior (for MPW use "-enum int") */
  124. #ifdef __MWERKS__
  125. #pragma enumsalwaysint on
  126. #endif
  127. typedef enum {
  128. DUMMY_ENUM_VALUE
  129. } SDL_DUMMY_ENUM;
  130. #ifndef __NDS__
  131. SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
  132. #endif
  133. /*@}*/
  134. #include "begin_code.h"
  135. /* Set up for C function definitions, even when using C++ */
  136. #ifdef __cplusplus
  137. extern "C" {
  138. #endif
  139. #ifdef HAVE_MALLOC
  140. #define SDL_malloc malloc
  141. #else
  142. extern DECLSPEC void * SDLCALL SDL_malloc(size_t size);
  143. #endif
  144. #ifdef HAVE_CALLOC
  145. #define SDL_calloc calloc
  146. #else
  147. extern DECLSPEC void * SDLCALL SDL_calloc(size_t nmemb, size_t size);
  148. #endif
  149. #ifdef HAVE_REALLOC
  150. #define SDL_realloc realloc
  151. #else
  152. extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size);
  153. #endif
  154. #ifdef HAVE_FREE
  155. #define SDL_free free
  156. #else
  157. extern DECLSPEC void SDLCALL SDL_free(void *mem);
  158. #endif
  159. #if defined(HAVE_ALLOCA) && !defined(alloca)
  160. # if defined(HAVE_ALLOCA_H)
  161. # include <alloca.h>
  162. # elif defined(__GNUC__)
  163. # define alloca __builtin_alloca
  164. # elif defined(_MSC_VER)
  165. # include <malloc.h>
  166. # define alloca _alloca
  167. # elif defined(__WATCOMC__)
  168. # include <malloc.h>
  169. # elif defined(__BORLANDC__)
  170. # include <malloc.h>
  171. # elif defined(__DMC__)
  172. # include <stdlib.h>
  173. # elif defined(__AIX__)
  174. #pragma alloca
  175. # elif defined(__MRC__)
  176. void *alloca (unsigned);
  177. # else
  178. char *alloca ();
  179. # endif
  180. #endif
  181. #ifdef HAVE_ALLOCA
  182. #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count))
  183. #define SDL_stack_free(data)
  184. #else
  185. #define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count))
  186. #define SDL_stack_free(data) SDL_free(data)
  187. #endif
  188. #ifdef HAVE_GETENV
  189. #define SDL_getenv getenv
  190. #else
  191. extern DECLSPEC char * SDLCALL SDL_getenv(const char *name);
  192. #endif
  193. #ifdef HAVE_PUTENV
  194. #define SDL_putenv putenv
  195. #else
  196. extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
  197. #endif
  198. #ifdef HAVE_QSORT
  199. #define SDL_qsort qsort
  200. #else
  201. extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
  202. int (*compare)(const void *, const void *));
  203. #endif
  204. #ifdef HAVE_ABS
  205. #define SDL_abs abs
  206. #else
  207. #define SDL_abs(X) ((X) < 0 ? -(X) : (X))
  208. #endif
  209. #define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
  210. #define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
  211. #ifdef HAVE_CTYPE_H
  212. #define SDL_isdigit(X) isdigit(X)
  213. #define SDL_isspace(X) isspace(X)
  214. #define SDL_toupper(X) toupper(X)
  215. #define SDL_tolower(X) tolower(X)
  216. #else
  217. #define SDL_isdigit(X) (((X) >= '0') && ((X) <= '9'))
  218. #define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n'))
  219. #define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X))
  220. #define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X))
  221. #endif
  222. #ifdef HAVE_MEMSET
  223. #define SDL_memset memset
  224. #else
  225. extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len);
  226. #endif
  227. #if defined(__GNUC__) && defined(i386)
  228. #define SDL_memset4(dst, val, len) \
  229. do { \
  230. int u0, u1, u2; \
  231. __asm__ __volatile__ ( \
  232. "cld\n\t" \
  233. "rep ; stosl\n\t" \
  234. : "=&D" (u0), "=&a" (u1), "=&c" (u2) \
  235. : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len)) \
  236. : "memory" ); \
  237. } while(0)
  238. #endif
  239. #ifndef SDL_memset4
  240. #define SDL_memset4(dst, val, len) \
  241. do { \
  242. unsigned _count = (len); \
  243. unsigned _n = (_count + 3) / 4; \
  244. Uint32 *_p = SDL_static_cast(Uint32 *, dst); \
  245. Uint32 _val = (val); \
  246. if (len == 0) break; \
  247. switch (_count % 4) { \
  248. case 0: do { *_p++ = _val; \
  249. case 3: *_p++ = _val; \
  250. case 2: *_p++ = _val; \
  251. case 1: *_p++ = _val; \
  252. } while ( --_n ); \
  253. } \
  254. } while(0)
  255. #endif
  256. /* We can count on memcpy existing on Mac OS X and being well-tuned. */
  257. #if defined(__MACH__) && defined(__APPLE__)
  258. #define SDL_memcpy(dst, src, len) memcpy(dst, src, len)
  259. #elif defined(__GNUC__) && defined(i386)
  260. #define SDL_memcpy(dst, src, len) \
  261. do { \
  262. int u0, u1, u2; \
  263. __asm__ __volatile__ ( \
  264. "cld\n\t" \
  265. "rep ; movsl\n\t" \
  266. "testb $2,%b4\n\t" \
  267. "je 1f\n\t" \
  268. "movsw\n" \
  269. "1:\ttestb $1,%b4\n\t" \
  270. "je 2f\n\t" \
  271. "movsb\n" \
  272. "2:" \
  273. : "=&c" (u0), "=&D" (u1), "=&S" (u2) \
  274. : "0" (SDL_static_cast(unsigned, len)/4), "q" (len), "1" (dst),"2" (src) \
  275. : "memory" ); \
  276. } while(0)
  277. #endif
  278. #ifndef SDL_memcpy
  279. #ifdef HAVE_MEMCPY
  280. #define SDL_memcpy memcpy
  281. #elif defined(HAVE_BCOPY)
  282. #define SDL_memcpy(d, s, n) bcopy((s), (d), (n))
  283. #else
  284. extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len);
  285. #endif
  286. #endif
  287. /* We can count on memcpy existing on Mac OS X and being well-tuned. */
  288. #if defined(__MACH__) && defined(__APPLE__)
  289. #define SDL_memcpy4(dst, src, len) memcpy(dst, src, (len)*4)
  290. #elif defined(__GNUC__) && defined(i386)
  291. #define SDL_memcpy4(dst, src, len) \
  292. do { \
  293. int ecx, edi, esi; \
  294. __asm__ __volatile__ ( \
  295. "cld\n\t" \
  296. "rep ; movsl" \
  297. : "=&c" (ecx), "=&D" (edi), "=&S" (esi) \
  298. : "0" (SDL_static_cast(unsigned, len)), "1" (dst), "2" (src) \
  299. : "memory" ); \
  300. } while(0)
  301. #endif
  302. #ifndef SDL_memcpy4
  303. #define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2)
  304. #endif
  305. #if defined(__GNUC__) && defined(i386)
  306. #define SDL_revcpy(dst, src, len) \
  307. do { \
  308. int u0, u1, u2; \
  309. char *dstp = SDL_static_cast(char *, dst); \
  310. char *srcp = SDL_static_cast(char *, src); \
  311. int n = (len); \
  312. if ( n >= 4 ) { \
  313. __asm__ __volatile__ ( \
  314. "std\n\t" \
  315. "rep ; movsl\n\t" \
  316. "cld\n\t" \
  317. : "=&c" (u0), "=&D" (u1), "=&S" (u2) \
  318. : "0" (n >> 2), \
  319. "1" (dstp+(n-4)), "2" (srcp+(n-4)) \
  320. : "memory" ); \
  321. } \
  322. switch (n & 3) { \
  323. case 3: dstp[2] = srcp[2]; \
  324. case 2: dstp[1] = srcp[1]; \
  325. case 1: dstp[0] = srcp[0]; \
  326. break; \
  327. default: \
  328. break; \
  329. } \
  330. } while(0)
  331. #endif
  332. #ifndef SDL_revcpy
  333. extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len);
  334. #endif
  335. #ifdef HAVE_MEMMOVE
  336. #define SDL_memmove memmove
  337. #elif defined(HAVE_BCOPY)
  338. #define SDL_memmove(d, s, n) bcopy((s), (d), (n))
  339. #else
  340. #define SDL_memmove(dst, src, len) \
  341. do { \
  342. if ( dst < src ) { \
  343. SDL_memcpy(dst, src, len); \
  344. } else { \
  345. SDL_revcpy(dst, src, len); \
  346. } \
  347. } while(0)
  348. #endif
  349. #ifdef HAVE_MEMCMP
  350. #define SDL_memcmp memcmp
  351. #else
  352. extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
  353. #endif
  354. #ifdef HAVE_STRLEN
  355. #define SDL_strlen strlen
  356. #else
  357. extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
  358. #endif
  359. #ifdef HAVE_STRLCPY
  360. #define SDL_strlcpy strlcpy
  361. #else
  362. extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen);
  363. #endif
  364. #ifdef HAVE_STRLCAT
  365. #define SDL_strlcat strlcat
  366. #else
  367. extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen);
  368. #endif
  369. #ifdef HAVE_STRDUP
  370. #define SDL_strdup strdup
  371. #else
  372. extern DECLSPEC char * SDLCALL SDL_strdup(const char *string);
  373. #endif
  374. #ifdef HAVE__STRREV
  375. #define SDL_strrev _strrev
  376. #else
  377. extern DECLSPEC char * SDLCALL SDL_strrev(char *string);
  378. #endif
  379. #ifdef HAVE__STRUPR
  380. #define SDL_strupr _strupr
  381. #else
  382. extern DECLSPEC char * SDLCALL SDL_strupr(char *string);
  383. #endif
  384. #ifdef HAVE__STRLWR
  385. #define SDL_strlwr _strlwr
  386. #else
  387. extern DECLSPEC char * SDLCALL SDL_strlwr(char *string);
  388. #endif
  389. #ifdef HAVE_STRCHR
  390. #define SDL_strchr strchr
  391. #elif defined(HAVE_INDEX)
  392. #define SDL_strchr index
  393. #else
  394. extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c);
  395. #endif
  396. #ifdef HAVE_STRRCHR
  397. #define SDL_strrchr strrchr
  398. #elif defined(HAVE_RINDEX)
  399. #define SDL_strrchr rindex
  400. #else
  401. extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c);
  402. #endif
  403. #ifdef HAVE_STRSTR
  404. #define SDL_strstr strstr
  405. #else
  406. extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle);
  407. #endif
  408. #ifdef HAVE_ITOA
  409. #define SDL_itoa itoa
  410. #else
  411. #define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix)
  412. #endif
  413. #ifdef HAVE__LTOA
  414. #define SDL_ltoa _ltoa
  415. #else
  416. extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix);
  417. #endif
  418. #ifdef HAVE__UITOA
  419. #define SDL_uitoa _uitoa
  420. #else
  421. #define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix)
  422. #endif
  423. #ifdef HAVE__ULTOA
  424. #define SDL_ultoa _ultoa
  425. #else
  426. extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix);
  427. #endif
  428. #ifdef HAVE_STRTOL
  429. #define SDL_strtol strtol
  430. #else
  431. extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base);
  432. #endif
  433. #ifdef HAVE_STRTOUL
  434. #define SDL_strtoul strtoul
  435. #else
  436. extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base);
  437. #endif
  438. #ifdef SDL_HAS_64BIT_TYPE
  439. #ifdef HAVE__I64TOA
  440. #define SDL_lltoa _i64toa
  441. #else
  442. extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix);
  443. #endif
  444. #ifdef HAVE__UI64TOA
  445. #define SDL_ulltoa _ui64toa
  446. #else
  447. extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix);
  448. #endif
  449. #ifdef HAVE_STRTOLL
  450. #define SDL_strtoll strtoll
  451. #else
  452. extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base);
  453. #endif
  454. #ifdef HAVE_STRTOULL
  455. #define SDL_strtoull strtoull
  456. #else
  457. extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base);
  458. #endif
  459. #endif /* SDL_HAS_64BIT_TYPE */
  460. #ifdef HAVE_STRTOD
  461. #define SDL_strtod strtod
  462. #else
  463. extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp);
  464. #endif
  465. #ifdef HAVE_ATOI
  466. #define SDL_atoi atoi
  467. #else
  468. #define SDL_atoi(X) SDL_strtol(X, NULL, 0)
  469. #endif
  470. #ifdef HAVE_ATOF
  471. #define SDL_atof atof
  472. #else
  473. #define SDL_atof(X) SDL_strtod(X, NULL)
  474. #endif
  475. #ifdef HAVE_STRCMP
  476. #define SDL_strcmp strcmp
  477. #else
  478. extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
  479. #endif
  480. #ifdef HAVE_STRNCMP
  481. #define SDL_strncmp strncmp
  482. #else
  483. extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
  484. #endif
  485. #ifdef HAVE_STRCASECMP
  486. #define SDL_strcasecmp strcasecmp
  487. #elif defined(HAVE__STRICMP)
  488. #define SDL_strcasecmp _stricmp
  489. #else
  490. extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
  491. #endif
  492. #ifdef HAVE_STRNCASECMP
  493. #define SDL_strncasecmp strncasecmp
  494. #elif defined(HAVE__STRNICMP)
  495. #define SDL_strncasecmp _strnicmp
  496. #else
  497. extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen);
  498. #endif
  499. #ifdef HAVE_SSCANF
  500. #define SDL_sscanf sscanf
  501. #else
  502. extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...);
  503. #endif
  504. #ifdef HAVE_SNPRINTF
  505. #define SDL_snprintf snprintf
  506. #else
  507. extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...);
  508. #endif
  509. #ifdef HAVE_VSNPRINTF
  510. #define SDL_vsnprintf vsnprintf
  511. #else
  512. extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap);
  513. #endif
  514. /** @name SDL_ICONV Error Codes
  515. * The SDL implementation of iconv() returns these error codes
  516. */
  517. /*@{*/
  518. #define SDL_ICONV_ERROR (size_t)-1
  519. #define SDL_ICONV_E2BIG (size_t)-2
  520. #define SDL_ICONV_EILSEQ (size_t)-3
  521. #define SDL_ICONV_EINVAL (size_t)-4
  522. /*@}*/
  523. #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
  524. #define SDL_iconv_t iconv_t
  525. #define SDL_iconv_open iconv_open
  526. #define SDL_iconv_close iconv_close
  527. #else
  528. typedef struct _SDL_iconv_t *SDL_iconv_t;
  529. extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode);
  530. extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
  531. #endif
  532. extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
  533. /** This function converts a string between encodings in one pass, returning a
  534. * string that must be freed with SDL_free() or NULL on error.
  535. */
  536. extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft);
  537. #define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
  538. #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1)
  539. #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1)
  540. /* Ends C function definitions when using C++ */
  541. #ifdef __cplusplus
  542. }
  543. #endif
  544. #include "close_code.h"
  545. #endif /* _SDL_stdinc_h */