include/SDL_stdinc.h
author dewyatt
Sun, 18 Jul 2010 13:48:23 -0400
changeset 4755 436183eb30c8
parent 4754 2072fed2f583
parent 4492 bff93336121e
child 4758 e2f4e31b41fc
permissions -rw-r--r--
Merge with main repo (mainly for non-printable character fix)
dewyatt@4755
     1
/*
dewyatt@4755
     2
    SDL - Simple DirectMedia Layer
dewyatt@4755
     3
    Copyright (C) 1997-2010 Sam Lantinga
dewyatt@4755
     4
dewyatt@4755
     5
    This library is free software; you can redistribute it and/or
dewyatt@4755
     6
    modify it under the terms of the GNU Lesser General Public
dewyatt@4755
     7
    License as published by the Free Software Foundation; either
dewyatt@4755
     8
    version 2.1 of the License, or (at your option) any later version.
dewyatt@4755
     9
dewyatt@4755
    10
    This library is distributed in the hope that it will be useful,
dewyatt@4755
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
dewyatt@4755
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dewyatt@4755
    13
    Lesser General Public License for more details.
dewyatt@4755
    14
dewyatt@4755
    15
    You should have received a copy of the GNU Lesser General Public
dewyatt@4755
    16
    License along with this library; if not, write to the Free Software
dewyatt@4755
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
dewyatt@4755
    18
dewyatt@4755
    19
    Sam Lantinga
dewyatt@4755
    20
    slouken@libsdl.org
dewyatt@4755
    21
*/
dewyatt@4755
    22
dewyatt@4755
    23
/**
dewyatt@4755
    24
 *  \file SDL_stdinc.h
dewyatt@4755
    25
 *  
dewyatt@4755
    26
 *  This is a general header that includes C language support.
dewyatt@4755
    27
 */
dewyatt@4755
    28
dewyatt@4755
    29
#ifndef _SDL_stdinc_h
dewyatt@4755
    30
#define _SDL_stdinc_h
dewyatt@4755
    31
dewyatt@4755
    32
#include "SDL_config.h"
dewyatt@4755
    33
dewyatt@4755
    34
dewyatt@4755
    35
#ifdef HAVE_SYS_TYPES_H
dewyatt@4755
    36
#include <sys/types.h>
dewyatt@4755
    37
#endif
dewyatt@4755
    38
#ifdef HAVE_STDIO_H
dewyatt@4755
    39
#include <stdio.h>
dewyatt@4755
    40
#endif
dewyatt@4755
    41
#if defined(STDC_HEADERS)
dewyatt@4755
    42
# include <stdlib.h>
dewyatt@4755
    43
# include <stddef.h>
dewyatt@4755
    44
# include <stdarg.h>
dewyatt@4755
    45
#else
dewyatt@4755
    46
# if defined(HAVE_STDLIB_H)
dewyatt@4755
    47
#  include <stdlib.h>
dewyatt@4755
    48
# elif defined(HAVE_MALLOC_H)
dewyatt@4755
    49
#  include <malloc.h>
dewyatt@4755
    50
# endif
dewyatt@4755
    51
# if defined(HAVE_STDDEF_H)
dewyatt@4755
    52
#  include <stddef.h>
dewyatt@4755
    53
# endif
dewyatt@4755
    54
# if defined(HAVE_STDARG_H)
dewyatt@4755
    55
#  include <stdarg.h>
dewyatt@4755
    56
# endif
dewyatt@4755
    57
#endif
dewyatt@4755
    58
#ifdef HAVE_STRING_H
dewyatt@4755
    59
# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
dewyatt@4755
    60
#  include <memory.h>
dewyatt@4755
    61
# endif
dewyatt@4755
    62
# include <string.h>
dewyatt@4755
    63
#endif
dewyatt@4755
    64
#ifdef HAVE_STRINGS_H
dewyatt@4755
    65
# include <strings.h>
dewyatt@4755
    66
#endif
dewyatt@4755
    67
#if defined(HAVE_INTTYPES_H)
dewyatt@4755
    68
# include <inttypes.h>
dewyatt@4755
    69
#elif defined(HAVE_STDINT_H)
dewyatt@4755
    70
# include <stdint.h>
dewyatt@4755
    71
#endif
dewyatt@4755
    72
#ifdef HAVE_CTYPE_H
dewyatt@4755
    73
# include <ctype.h>
dewyatt@4755
    74
#endif
dewyatt@4755
    75
#ifdef HAVE_MATH_H
dewyatt@4755
    76
# include <math.h>
dewyatt@4755
    77
#endif
dewyatt@4755
    78
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
dewyatt@4755
    79
# include <iconv.h>
dewyatt@4755
    80
#endif
dewyatt@4755
    81
dewyatt@4755
    82
/**
dewyatt@4755
    83
 *  The number of elements in an array.
dewyatt@4755
    84
 */
dewyatt@4755
    85
#define SDL_arraysize(array)	(sizeof(array)/sizeof(array[0]))
dewyatt@4755
    86
#define SDL_TABLESIZE(table)	SDL_arraysize(table)
dewyatt@4755
    87
dewyatt@4755
    88
/**
dewyatt@4755
    89
 *  \name Cast operators
dewyatt@4755
    90
 *  
dewyatt@4755
    91
 *  Use proper C++ casts when compiled as C++ to be compatible with the option
dewyatt@4755
    92
 *  -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above).
dewyatt@4755
    93
 */
dewyatt@4755
    94
/*@{*/
dewyatt@4755
    95
#ifdef __cplusplus
dewyatt@4755
    96
#define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression)
dewyatt@4755
    97
#define SDL_static_cast(type, expression) static_cast<type>(expression)
dewyatt@4755
    98
#else
dewyatt@4755
    99
#define SDL_reinterpret_cast(type, expression) ((type)(expression))
dewyatt@4755
   100
#define SDL_static_cast(type, expression) ((type)(expression))
dewyatt@4755
   101
#endif
dewyatt@4755
   102
/*@}*//*Cast operators*/
dewyatt@4755
   103
dewyatt@4755
   104
/* Define a four character code as a Uint32 */
dewyatt@4755
   105
#define SDL_FOURCC(A, B, C, D) \
dewyatt@4755
   106
    ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \
dewyatt@4755
   107
     (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \
dewyatt@4755
   108
     (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \
dewyatt@4755
   109
     (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24))
dewyatt@4755
   110
dewyatt@4755
   111
/**
dewyatt@4755
   112
 *  \name Basic data types
dewyatt@4755
   113
 */
dewyatt@4755
   114
/*@{*/
dewyatt@4755
   115
dewyatt@4755
   116
typedef enum
dewyatt@4755
   117
{
dewyatt@4755
   118
    SDL_FALSE = 0,
dewyatt@4755
   119
    SDL_TRUE = 1
dewyatt@4755
   120
} SDL_bool;
dewyatt@4755
   121
dewyatt@4755
   122
/**
dewyatt@4755
   123
 * \brief A signed 8-bit integer type.
dewyatt@4755
   124
 */
dewyatt@4755
   125
typedef int8_t Sint8;
dewyatt@4755
   126
/**
dewyatt@4755
   127
 * \brief An unsigned 8-bit integer type.
dewyatt@4755
   128
 */
dewyatt@4755
   129
typedef uint8_t Uint8;
dewyatt@4755
   130
/**
dewyatt@4755
   131
 * \brief A signed 16-bit integer type.
dewyatt@4755
   132
 */
dewyatt@4755
   133
typedef int16_t Sint16;
dewyatt@4755
   134
/**
dewyatt@4755
   135
 * \brief An unsigned 16-bit integer type.
dewyatt@4755
   136
 */
dewyatt@4755
   137
typedef uint16_t Uint16;
dewyatt@4755
   138
/**
dewyatt@4755
   139
 * \brief A signed 32-bit integer type.
dewyatt@4755
   140
 */
dewyatt@4755
   141
typedef int32_t Sint32;
dewyatt@4755
   142
/**
dewyatt@4755
   143
 * \brief An unsigned 32-bit integer type.
dewyatt@4755
   144
 */
dewyatt@4755
   145
typedef uint32_t Uint32;
dewyatt@4755
   146
dewyatt@4755
   147
#ifdef SDL_HAS_64BIT_TYPE
dewyatt@4755
   148
/**
dewyatt@4755
   149
 * \brief A signed 64-bit integer type.
dewyatt@4755
   150
 * \warning On platforms without any sort of 64-bit datatype, this is equivalent to Sint32!
dewyatt@4755
   151
 */
dewyatt@4755
   152
typedef int64_t Sint64;
dewyatt@4755
   153
/**
dewyatt@4755
   154
 * \brief An unsigned 64-bit integer type.
dewyatt@4755
   155
 * \warning On platforms without any sort of 64-bit datatype, this is equivalent to Uint32!
dewyatt@4755
   156
 */
dewyatt@4755
   157
typedef uint64_t Uint64;
dewyatt@4755
   158
#else
dewyatt@4755
   159
/* This is really just a hack to prevent the compiler from complaining */
dewyatt@4755
   160
typedef Sint32 Sint64;
dewyatt@4755
   161
typedef Uint32 Uint64;
dewyatt@4755
   162
#endif
dewyatt@4755
   163
dewyatt@4755
   164
/*@}*//*Basic data types*/
dewyatt@4755
   165
dewyatt@4755
   166
dewyatt@4755
   167
#define SDL_COMPILE_TIME_ASSERT(name, x)               \
dewyatt@4755
   168
       typedef int SDL_dummy_ ## name[(x) * 2 - 1]
dewyatt@4755
   169
/** \cond */
dewyatt@4755
   170
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
dewyatt@4755
   171
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
dewyatt@4755
   172
SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
dewyatt@4755
   173
SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
dewyatt@4755
   174
SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
dewyatt@4755
   175
SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
dewyatt@4755
   176
SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
dewyatt@4755
   177
#ifndef __NINTENDODS__          /* TODO: figure out why the following happens:
dewyatt@4755
   178
                                   include/SDL_stdinc.h:150: error: size of array 'SDL_dummy_uint64' is negative
dewyatt@4755
   179
                                   include/SDL_stdinc.h:151: error: size of array 'SDL_dummy_sint64' is negative */
dewyatt@4755
   180
SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
dewyatt@4755
   181
SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
dewyatt@4755
   182
#endif
dewyatt@4755
   183
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
dewyatt@4755
   184
/** \endcond */
dewyatt@4755
   185
dewyatt@4755
   186
/* Check to make sure enums are the size of ints, for structure packing.
dewyatt@4755
   187
   For both Watcom C/C++ and Borland C/C++ the compiler option that makes
dewyatt@4755
   188
   enums having the size of an int must be enabled.
dewyatt@4755
   189
   This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
dewyatt@4755
   190
*/
dewyatt@4755
   191
/* Enable enums always int in CodeWarrior (for MPW use "-enum int") */
dewyatt@4755
   192
#ifdef __MWERKS__
dewyatt@4755
   193
#pragma enumsalwaysint on
dewyatt@4755
   194
#endif
dewyatt@4755
   195
dewyatt@4755
   196
/** \cond */
dewyatt@4755
   197
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
dewyatt@4755
   198
#ifndef __NINTENDODS__          /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
dewyatt@4755
   199
typedef enum
dewyatt@4755
   200
{
dewyatt@4755
   201
    DUMMY_ENUM_VALUE
dewyatt@4755
   202
} SDL_DUMMY_ENUM;
dewyatt@4755
   203
dewyatt@4755
   204
SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
dewyatt@4755
   205
#endif
dewyatt@4755
   206
#endif /* DOXYGEN_SHOULD_IGNORE_THIS */
dewyatt@4755
   207
/** \endcond */
dewyatt@4755
   208
dewyatt@4755
   209
#include "begin_code.h"
dewyatt@4755
   210
/* Set up for C function definitions, even when using C++ */
dewyatt@4755
   211
#ifdef __cplusplus
dewyatt@4755
   212
/* *INDENT-OFF* */
dewyatt@4755
   213
extern "C" {
dewyatt@4755
   214
/* *INDENT-ON* */
dewyatt@4755
   215
#endif
dewyatt@4755
   216
dewyatt@4755
   217
#ifdef HAVE_MALLOC
dewyatt@4755
   218
#define SDL_malloc	malloc
dewyatt@4755
   219
#else
dewyatt@4755
   220
extern DECLSPEC void *SDLCALL SDL_malloc(size_t size);
dewyatt@4755
   221
#endif
dewyatt@4755
   222
dewyatt@4755
   223
#ifdef HAVE_CALLOC
dewyatt@4755
   224
#define SDL_calloc	calloc
dewyatt@4755
   225
#else
dewyatt@4755
   226
extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size);
dewyatt@4755
   227
#endif
dewyatt@4755
   228
dewyatt@4755
   229
#ifdef HAVE_REALLOC
dewyatt@4755
   230
#define SDL_realloc	realloc
dewyatt@4755
   231
#else
dewyatt@4755
   232
extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size);
dewyatt@4755
   233
#endif
dewyatt@4755
   234
dewyatt@4755
   235
#ifdef HAVE_FREE
dewyatt@4755
   236
#define SDL_free	free
dewyatt@4755
   237
#else
dewyatt@4755
   238
extern DECLSPEC void SDLCALL SDL_free(void *mem);
dewyatt@4755
   239
#endif
dewyatt@4755
   240
dewyatt@4755
   241
#if defined(HAVE_ALLOCA) && !defined(alloca)
dewyatt@4755
   242
# if defined(HAVE_ALLOCA_H)
dewyatt@4755
   243
#  include <alloca.h>
dewyatt@4755
   244
# elif defined(__GNUC__)
dewyatt@4755
   245
#  define alloca __builtin_alloca
dewyatt@4755
   246
# elif defined(_MSC_VER)
dewyatt@4755
   247
#  include <malloc.h>
dewyatt@4755
   248
#  define alloca _alloca
dewyatt@4755
   249
# elif defined(__WATCOMC__)
dewyatt@4755
   250
#  include <malloc.h>
dewyatt@4755
   251
# elif defined(__BORLANDC__)
dewyatt@4755
   252
#  include <malloc.h>
dewyatt@4755
   253
# elif defined(__DMC__)
dewyatt@4755
   254
#  include <stdlib.h>
dewyatt@4755
   255
# elif defined(__AIX__)
dewyatt@4755
   256
#pragma alloca
dewyatt@4755
   257
# elif defined(__MRC__)
dewyatt@4755
   258
void *alloca(unsigned);
dewyatt@4755
   259
# else
dewyatt@4755
   260
char *alloca();
dewyatt@4755
   261
# endif
dewyatt@4755
   262
#endif
dewyatt@4755
   263
#ifdef HAVE_ALLOCA
dewyatt@4755
   264
#define SDL_stack_alloc(type, count)    (type*)alloca(sizeof(type)*(count))
dewyatt@4755
   265
#define SDL_stack_free(data)
dewyatt@4755
   266
#else
dewyatt@4755
   267
#define SDL_stack_alloc(type, count)    (type*)SDL_malloc(sizeof(type)*(count))
dewyatt@4755
   268
#define SDL_stack_free(data)            SDL_free(data)
dewyatt@4755
   269
#endif
dewyatt@4755
   270
dewyatt@4755
   271
#ifdef HAVE_GETENV
dewyatt@4755
   272
#define SDL_getenv	getenv
dewyatt@4755
   273
#else
dewyatt@4755
   274
extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
dewyatt@4755
   275
#endif
dewyatt@4755
   276
dewyatt@4755
   277
/* SDL_putenv() has moved to SDL_compat. */
dewyatt@4755
   278
#ifdef HAVE_SETENV
dewyatt@4755
   279
#define SDL_setenv	setenv
dewyatt@4755
   280
#else
dewyatt@4755
   281
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value,
dewyatt@4755
   282
                                       int overwrite);
dewyatt@4755
   283
#endif
dewyatt@4755
   284
dewyatt@4755
   285
#ifdef HAVE_QSORT
dewyatt@4755
   286
#define SDL_qsort	qsort
dewyatt@4755
   287
#else
dewyatt@4755
   288
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
dewyatt@4755
   289
                                       int (*compare) (const void *,
dewyatt@4755
   290
                                                       const void *));
dewyatt@4755
   291
#endif
dewyatt@4755
   292
dewyatt@4755
   293
#ifdef HAVE_ABS
dewyatt@4755
   294
#define SDL_abs		abs
dewyatt@4755
   295
#else
dewyatt@4755
   296
#define SDL_abs(X)	((X) < 0 ? -(X) : (X))
dewyatt@4755
   297
#endif
dewyatt@4755
   298
dewyatt@4755
   299
#define SDL_min(x, y)	(((x) < (y)) ? (x) : (y))
dewyatt@4755
   300
#define SDL_max(x, y)	(((x) > (y)) ? (x) : (y))
dewyatt@4755
   301
dewyatt@4755
   302
#ifdef HAVE_CTYPE_H
dewyatt@4755
   303
#define SDL_isdigit(X)  isdigit(X)
dewyatt@4755
   304
#define SDL_isspace(X)  isspace(X)
dewyatt@4755
   305
#define SDL_toupper(X)  toupper(X)
dewyatt@4755
   306
#define SDL_tolower(X)  tolower(X)
dewyatt@4755
   307
#else
dewyatt@4755
   308
#define SDL_isdigit(X)  (((X) >= '0') && ((X) <= '9'))
dewyatt@4755
   309
#define SDL_isspace(X)  (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n'))
dewyatt@4755
   310
#define SDL_toupper(X)  (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X))
dewyatt@4755
   311
#define SDL_tolower(X)  (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X))
dewyatt@4755
   312
#endif
dewyatt@4755
   313
dewyatt@4755
   314
#ifdef HAVE_MEMSET
dewyatt@4755
   315
#define SDL_memset      memset
dewyatt@4755
   316
#else
dewyatt@4755
   317
extern DECLSPEC void *SDLCALL SDL_memset(void *dst, int c, size_t len);
dewyatt@4755
   318
#endif
dewyatt@4755
   319
#define SDL_zero(x)	SDL_memset(&(x), 0, sizeof((x)))
dewyatt@4755
   320
#define SDL_zerop(x)	SDL_memset((x), 0, sizeof(*(x)))
dewyatt@4755
   321
dewyatt@4755
   322
#if defined(__GNUC__) && defined(i386)
dewyatt@4755
   323
#define SDL_memset4(dst, val, len)				\
dewyatt@4755
   324
do {								\
dewyatt@4755
   325
	int u0, u1, u2;						\
dewyatt@4755
   326
	__asm__ __volatile__ (					\
dewyatt@4755
   327
		"cld\n\t"					\
dewyatt@4755
   328
		"rep ; stosl\n\t"				\
dewyatt@4755
   329
		: "=&D" (u0), "=&a" (u1), "=&c" (u2)		\
dewyatt@4755
   330
		: "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len))	\
dewyatt@4755
   331
		: "memory" );					\
dewyatt@4755
   332
} while(0)
dewyatt@4755
   333
#endif
dewyatt@4755
   334
#ifndef SDL_memset4
dewyatt@4755
   335
#define SDL_memset4(dst, val, len)		\
dewyatt@4755
   336
do {						\
dewyatt@4755
   337
	unsigned _count = (len);		\
dewyatt@4755
   338
	unsigned _n = (_count + 3) / 4;		\
dewyatt@4755
   339
	Uint32 *_p = SDL_static_cast(Uint32 *, dst);		\
dewyatt@4755
   340
	Uint32 _val = (val);			\
dewyatt@4755
   341
	if (len == 0) break;			\
dewyatt@4755
   342
        switch (_count % 4) {			\
dewyatt@4755
   343
        case 0: do {    *_p++ = _val;		\
dewyatt@4755
   344
        case 3:         *_p++ = _val;		\
dewyatt@4755
   345
        case 2:         *_p++ = _val;		\
dewyatt@4755
   346
        case 1:         *_p++ = _val;		\
dewyatt@4755
   347
		} while ( --_n );		\
dewyatt@4755
   348
	}					\
dewyatt@4755
   349
} while(0)
dewyatt@4755
   350
#endif
dewyatt@4755
   351
dewyatt@4755
   352
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
dewyatt@4755
   353
#if defined(__MACH__) && defined(__APPLE__)
dewyatt@4755
   354
#define SDL_memcpy(dst, src, len) memcpy(dst, src, len)
dewyatt@4755
   355
#elif defined(__GNUC__) && defined(i386)
dewyatt@4755
   356
#define SDL_memcpy(dst, src, len)					  \
dewyatt@4755
   357
do {									  \
dewyatt@4755
   358
	int u0, u1, u2;						  	  \
dewyatt@4755
   359
	__asm__ __volatile__ (						  \
dewyatt@4755
   360
		"cld\n\t"						  \
dewyatt@4755
   361
		"rep ; movsl\n\t"					  \
dewyatt@4755
   362
		"testb $2,%b4\n\t"					  \
dewyatt@4755
   363
		"je 1f\n\t"						  \
dewyatt@4755
   364
		"movsw\n"						  \
dewyatt@4755
   365
		"1:\ttestb $1,%b4\n\t"					  \
dewyatt@4755
   366
		"je 2f\n\t"						  \
dewyatt@4755
   367
		"movsb\n"						  \
dewyatt@4755
   368
		"2:"							  \
dewyatt@4755
   369
		: "=&c" (u0), "=&D" (u1), "=&S" (u2)			  \
dewyatt@4755
   370
		: "0" (SDL_static_cast(unsigned, len)/4), "q" (len), "1" (dst),"2" (src) \
dewyatt@4755
   371
		: "memory" );						  \
dewyatt@4755
   372
} while(0)
dewyatt@4755
   373
#endif
dewyatt@4755
   374
#ifndef SDL_memcpy
dewyatt@4755
   375
#ifdef HAVE_MEMCPY
dewyatt@4755
   376
#define SDL_memcpy      memcpy
dewyatt@4755
   377
#elif defined(HAVE_BCOPY)
dewyatt@4755
   378
#define SDL_memcpy(d, s, n)	bcopy((s), (d), (n))
dewyatt@4755
   379
#else
dewyatt@4755
   380
extern DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src,
dewyatt@4755
   381
                                         size_t len);
dewyatt@4755
   382
#endif
dewyatt@4755
   383
#endif
dewyatt@4755
   384
dewyatt@4755
   385
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
dewyatt@4755
   386
#if defined(__MACH__) && defined(__APPLE__)
dewyatt@4755
   387
#define SDL_memcpy4(dst, src, len) memcpy(dst, src, (len)*4)
dewyatt@4755
   388
#elif defined(__GNUC__) && defined(i386)
dewyatt@4755
   389
#define SDL_memcpy4(dst, src, len)				\
dewyatt@4755
   390
do {								\
dewyatt@4755
   391
	int ecx, edi, esi;					\
dewyatt@4755
   392
	__asm__ __volatile__ (					\
dewyatt@4755
   393
		"cld\n\t"					\
dewyatt@4755
   394
		"rep ; movsl"					\
dewyatt@4755
   395
		: "=&c" (ecx), "=&D" (edi), "=&S" (esi)		\
dewyatt@4755
   396
		: "0" (SDL_static_cast(unsigned, len)), "1" (dst), "2" (src)	\
dewyatt@4755
   397
		: "memory" );					\
dewyatt@4755
   398
} while(0)
dewyatt@4755
   399
#endif
dewyatt@4755
   400
#ifndef SDL_memcpy4
dewyatt@4755
   401
#define SDL_memcpy4(dst, src, len)	SDL_memcpy(dst, src, (len) << 2)
dewyatt@4755
   402
#endif
dewyatt@4755
   403
dewyatt@4755
   404
#if defined(__GNUC__) && defined(i386)
dewyatt@4755
   405
#define SDL_revcpy(dst, src, len)			\
dewyatt@4755
   406
do {							\
dewyatt@4755
   407
	int u0, u1, u2;					\
dewyatt@4755
   408
	char *dstp = SDL_static_cast(char *, dst);			\
dewyatt@4755
   409
	char *srcp = SDL_static_cast(char *, src);			\
dewyatt@4755
   410
	int n = (len);					\
dewyatt@4755
   411
	if ( n >= 4 ) {					\
dewyatt@4755
   412
	__asm__ __volatile__ (				\
dewyatt@4755
   413
		"std\n\t"				\
dewyatt@4755
   414
		"rep ; movsl\n\t"			\
dewyatt@4755
   415
		"cld\n\t"				\
dewyatt@4755
   416
		: "=&c" (u0), "=&D" (u1), "=&S" (u2)	\
dewyatt@4755
   417
		: "0" (n >> 2),				\
dewyatt@4755
   418
		  "1" (dstp+(n-4)), "2" (srcp+(n-4))	\
dewyatt@4755
   419
		: "memory" );				\
dewyatt@4755
   420
	}						\
dewyatt@4755
   421
	switch (n & 3) {				\
dewyatt@4755
   422
		case 3: dstp[2] = srcp[2];		\
dewyatt@4755
   423
		case 2: dstp[1] = srcp[1];		\
dewyatt@4755
   424
		case 1: dstp[0] = srcp[0];		\
dewyatt@4755
   425
			break;				\
dewyatt@4755
   426
		default:				\
dewyatt@4755
   427
			break;				\
dewyatt@4755
   428
	}						\
dewyatt@4755
   429
} while(0)
dewyatt@4755
   430
#endif
dewyatt@4755
   431
#ifndef SDL_revcpy
dewyatt@4755
   432
extern DECLSPEC void *SDLCALL SDL_revcpy(void *dst, const void *src,
dewyatt@4755
   433
                                         size_t len);
dewyatt@4755
   434
#endif
dewyatt@4755
   435
dewyatt@4755
   436
#ifdef HAVE_MEMMOVE
dewyatt@4755
   437
#define SDL_memmove     memmove
dewyatt@4755
   438
#elif defined(HAVE_BCOPY)
dewyatt@4755
   439
#define SDL_memmove(d, s, n)	bcopy((s), (d), (n))
dewyatt@4755
   440
#else
dewyatt@4755
   441
#define SDL_memmove(dst, src, len)			\
dewyatt@4755
   442
do {							\
dewyatt@4755
   443
	if ( dst < src ) {				\
dewyatt@4755
   444
		SDL_memcpy(dst, src, len);		\
dewyatt@4755
   445
	} else {					\
dewyatt@4755
   446
		SDL_revcpy(dst, src, len);		\
dewyatt@4755
   447
	}						\
dewyatt@4755
   448
} while(0)
dewyatt@4755
   449
#endif
dewyatt@4755
   450
dewyatt@4755
   451
#ifdef HAVE_MEMCMP
dewyatt@4755
   452
#define SDL_memcmp      memcmp
dewyatt@4755
   453
#else
dewyatt@4755
   454
extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2,
dewyatt@4755
   455
                                       size_t len);
dewyatt@4755
   456
#endif
dewyatt@4755
   457
dewyatt@4755
   458
#ifdef HAVE_STRLEN
dewyatt@4755
   459
#define SDL_strlen      strlen
dewyatt@4755
   460
#else
dewyatt@4755
   461
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
dewyatt@4755
   462
#endif
dewyatt@4755
   463
dewyatt@4755
   464
#ifdef HAVE_WCSLEN
dewyatt@4755
   465
#define SDL_wcslen      wcslen
dewyatt@4755
   466
#else
dewyatt@4755
   467
#if !defined(wchar_t) && defined(__NINTENDODS__)
dewyatt@4755
   468
#define wchar_t short           /* TODO: figure out why libnds doesn't have this */
dewyatt@4755
   469
#endif
dewyatt@4755
   470
extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t * string);
dewyatt@4755
   471
#endif
dewyatt@4755
   472
dewyatt@4755
   473
#ifdef HAVE_STRLCPY
dewyatt@4755
   474
#define SDL_strlcpy     strlcpy
dewyatt@4755
   475
#else
dewyatt@4755
   476
extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src,
dewyatt@4755
   477
                                           size_t maxlen);
dewyatt@4755
   478
#endif
dewyatt@4755
   479
dewyatt@4754
   480
extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(char *dst, const char *src,
dewyatt@4754
   481
                                            size_t dst_bytes);
dewyatt@4755
   482
dewyatt@4755
   483
#ifdef HAVE_STRLCAT
dewyatt@4755
   484
#define SDL_strlcat    strlcat
dewyatt@4755
   485
#else
dewyatt@4755
   486
extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src,
dewyatt@4755
   487
                                           size_t maxlen);
dewyatt@4755
   488
#endif
dewyatt@4755
   489
dewyatt@4755
   490
#ifdef HAVE_STRDUP
dewyatt@4755
   491
#define SDL_strdup     strdup
dewyatt@4755
   492
#else
dewyatt@4755
   493
extern DECLSPEC char *SDLCALL SDL_strdup(const char *string);
dewyatt@4755
   494
#endif
dewyatt@4755
   495
dewyatt@4755
   496
#ifdef HAVE__STRREV
dewyatt@4755
   497
#define SDL_strrev      _strrev
dewyatt@4755
   498
#else
dewyatt@4755
   499
extern DECLSPEC char *SDLCALL SDL_strrev(char *string);
dewyatt@4755
   500
#endif
dewyatt@4755
   501
dewyatt@4755
   502
#ifdef HAVE__STRUPR
dewyatt@4755
   503
#define SDL_strupr      _strupr
dewyatt@4755
   504
#else
dewyatt@4755
   505
extern DECLSPEC char *SDLCALL SDL_strupr(char *string);
dewyatt@4755
   506
#endif
dewyatt@4755
   507
dewyatt@4755
   508
#ifdef HAVE__STRLWR
dewyatt@4755
   509
#define SDL_strlwr      _strlwr
dewyatt@4755
   510
#else
dewyatt@4755
   511
extern DECLSPEC char *SDLCALL SDL_strlwr(char *string);
dewyatt@4755
   512
#endif
dewyatt@4755
   513
dewyatt@4755
   514
#ifdef HAVE_STRCHR
dewyatt@4755
   515
#define SDL_strchr      strchr
dewyatt@4755
   516
#elif defined(HAVE_INDEX)
dewyatt@4755
   517
#define SDL_strchr      index
dewyatt@4755
   518
#else
dewyatt@4755
   519
extern DECLSPEC char *SDLCALL SDL_strchr(const char *string, int c);
dewyatt@4755
   520
#endif
dewyatt@4755
   521
dewyatt@4755
   522
#ifdef HAVE_STRRCHR
dewyatt@4755
   523
#define SDL_strrchr     strrchr
dewyatt@4755
   524
#elif defined(HAVE_RINDEX)
dewyatt@4755
   525
#define SDL_strrchr     rindex
dewyatt@4755
   526
#else
dewyatt@4755
   527
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *string, int c);
dewyatt@4755
   528
#endif
dewyatt@4755
   529
dewyatt@4755
   530
#ifdef HAVE_STRSTR
dewyatt@4755
   531
#define SDL_strstr      strstr
dewyatt@4755
   532
#else
dewyatt@4755
   533
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack,
dewyatt@4755
   534
                                         const char *needle);
dewyatt@4755
   535
#endif
dewyatt@4755
   536
dewyatt@4755
   537
#ifdef HAVE_ITOA
dewyatt@4755
   538
#define SDL_itoa        itoa
dewyatt@4755
   539
#else
dewyatt@4755
   540
#define SDL_itoa(value, string, radix)	SDL_ltoa((long)value, string, radix)
dewyatt@4755
   541
#endif
dewyatt@4755
   542
dewyatt@4755
   543
#ifdef HAVE__LTOA
dewyatt@4755
   544
#define SDL_ltoa        _ltoa
dewyatt@4755
   545
#else
dewyatt@4755
   546
extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *string, int radix);
dewyatt@4755
   547
#endif
dewyatt@4755
   548
dewyatt@4755
   549
#ifdef HAVE__UITOA
dewyatt@4755
   550
#define SDL_uitoa       _uitoa
dewyatt@4755
   551
#else
dewyatt@4755
   552
#define SDL_uitoa(value, string, radix)	SDL_ultoa((long)value, string, radix)
dewyatt@4755
   553
#endif
dewyatt@4755
   554
dewyatt@4755
   555
#ifdef HAVE__ULTOA
dewyatt@4755
   556
#define SDL_ultoa       _ultoa
dewyatt@4755
   557
#else
dewyatt@4755
   558
extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *string,
dewyatt@4755
   559
                                        int radix);
dewyatt@4755
   560
#endif
dewyatt@4755
   561
dewyatt@4755
   562
#ifdef HAVE_STRTOL
dewyatt@4755
   563
#define SDL_strtol      strtol
dewyatt@4755
   564
#else
dewyatt@4755
   565
extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp,
dewyatt@4755
   566
                                        int base);
dewyatt@4755
   567
#endif
dewyatt@4755
   568
dewyatt@4755
   569
#ifdef HAVE_STRTOUL
dewyatt@4755
   570
#define SDL_strtoul      strtoul
dewyatt@4755
   571
#else
dewyatt@4755
   572
extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string,
dewyatt@4755
   573
                                                  char **endp, int base);
dewyatt@4755
   574
#endif
dewyatt@4755
   575
dewyatt@4755
   576
#ifdef SDL_HAS_64BIT_TYPE
dewyatt@4755
   577
dewyatt@4755
   578
#ifdef HAVE__I64TOA
dewyatt@4755
   579
#define SDL_lltoa       _i64toa
dewyatt@4755
   580
#else
dewyatt@4755
   581
extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *string,
dewyatt@4755
   582
                                        int radix);
dewyatt@4755
   583
#endif
dewyatt@4755
   584
dewyatt@4755
   585
#ifdef HAVE__UI64TOA
dewyatt@4755
   586
#define SDL_ulltoa      _ui64toa
dewyatt@4755
   587
#else
dewyatt@4755
   588
extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *string,
dewyatt@4755
   589
                                         int radix);
dewyatt@4755
   590
#endif
dewyatt@4755
   591
dewyatt@4755
   592
#ifdef HAVE_STRTOLL
dewyatt@4755
   593
#define SDL_strtoll     strtoll
dewyatt@4755
   594
#else
dewyatt@4755
   595
extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp,
dewyatt@4755
   596
                                           int base);
dewyatt@4755
   597
#endif
dewyatt@4755
   598
dewyatt@4755
   599
#ifdef HAVE_STRTOULL
dewyatt@4755
   600
#define SDL_strtoull     strtoull
dewyatt@4755
   601
#else
dewyatt@4755
   602
extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp,
dewyatt@4755
   603
                                            int base);
dewyatt@4755
   604
#endif
dewyatt@4755
   605
dewyatt@4755
   606
#endif /* SDL_HAS_64BIT_TYPE */
dewyatt@4755
   607
dewyatt@4755
   608
#ifdef HAVE_STRTOD
dewyatt@4755
   609
#define SDL_strtod      strtod
dewyatt@4755
   610
#else
dewyatt@4755
   611
extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp);
dewyatt@4755
   612
#endif
dewyatt@4755
   613
dewyatt@4755
   614
#ifdef HAVE_ATOI
dewyatt@4755
   615
#define SDL_atoi        atoi
dewyatt@4755
   616
#else
dewyatt@4755
   617
#define SDL_atoi(X)     SDL_strtol(X, NULL, 0)
dewyatt@4755
   618
#endif
dewyatt@4755
   619
dewyatt@4755
   620
#ifdef HAVE_ATOF
dewyatt@4755
   621
#define SDL_atof        atof
dewyatt@4755
   622
#else
dewyatt@4755
   623
#define SDL_atof(X)     SDL_strtod(X, NULL)
dewyatt@4755
   624
#endif
dewyatt@4755
   625
dewyatt@4755
   626
#ifdef HAVE_STRCMP
dewyatt@4755
   627
#define SDL_strcmp      strcmp
dewyatt@4755
   628
#else
dewyatt@4755
   629
extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
dewyatt@4755
   630
#endif
dewyatt@4755
   631
dewyatt@4755
   632
#ifdef HAVE_STRNCMP
dewyatt@4755
   633
#define SDL_strncmp     strncmp
dewyatt@4755
   634
#else
dewyatt@4755
   635
extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2,
dewyatt@4755
   636
                                        size_t maxlen);
dewyatt@4755
   637
#endif
dewyatt@4755
   638
dewyatt@4755
   639
#ifdef HAVE_STRCASECMP
dewyatt@4755
   640
#define SDL_strcasecmp  strcasecmp
dewyatt@4755
   641
#elif defined(HAVE__STRICMP)
dewyatt@4755
   642
#define SDL_strcasecmp  _stricmp
dewyatt@4755
   643
#else
dewyatt@4755
   644
extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1,
dewyatt@4755
   645
                                           const char *str2);
dewyatt@4755
   646
#endif
dewyatt@4755
   647
dewyatt@4755
   648
#ifdef HAVE_STRNCASECMP
dewyatt@4755
   649
#define SDL_strncasecmp strncasecmp
dewyatt@4755
   650
#elif defined(HAVE__STRNICMP)
dewyatt@4755
   651
#define SDL_strncasecmp _strnicmp
dewyatt@4755
   652
#else
dewyatt@4755
   653
extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1,
dewyatt@4755
   654
                                            const char *str2, size_t maxlen);
dewyatt@4755
   655
#endif
dewyatt@4755
   656
dewyatt@4755
   657
#ifdef HAVE_SSCANF
dewyatt@4755
   658
#define SDL_sscanf      sscanf
dewyatt@4755
   659
#else
dewyatt@4755
   660
extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt,
dewyatt@4755
   661
                                       ...);
dewyatt@4755
   662
#endif
dewyatt@4755
   663
dewyatt@4755
   664
#ifdef HAVE_SNPRINTF
dewyatt@4755
   665
#define SDL_snprintf    snprintf
dewyatt@4755
   666
#else
dewyatt@4755
   667
extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen,
dewyatt@4755
   668
                                         const char *fmt, ...);
dewyatt@4755
   669
#endif
dewyatt@4755
   670
dewyatt@4755
   671
#ifdef HAVE_VSNPRINTF
dewyatt@4755
   672
#define SDL_vsnprintf   vsnprintf
dewyatt@4755
   673
#else
dewyatt@4755
   674
extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen,
dewyatt@4755
   675
                                          const char *fmt, va_list ap);
dewyatt@4755
   676
#endif
dewyatt@4755
   677
dewyatt@4755
   678
#ifndef HAVE_M_PI
dewyatt@4755
   679
#define M_PI    3.14159265358979323846264338327950288   /* pi */
dewyatt@4755
   680
#endif
dewyatt@4755
   681
dewyatt@4755
   682
#ifdef HAVE_CEIL
dewyatt@4755
   683
#define SDL_ceil        ceil
dewyatt@4755
   684
#else
dewyatt@4755
   685
#define SDL_ceil(x)     ((double)(int)((x)+0.5))
dewyatt@4755
   686
#endif
dewyatt@4755
   687
dewyatt@4755
   688
#ifdef HAVE_COPYSIGN
dewyatt@4755
   689
#define SDL_copysign    copysign
dewyatt@4755
   690
#else
dewyatt@4755
   691
extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
dewyatt@4755
   692
#endif
dewyatt@4755
   693
dewyatt@4755
   694
#ifdef HAVE_COS
dewyatt@4755
   695
#define SDL_cos         cos
dewyatt@4755
   696
#else
dewyatt@4755
   697
extern DECLSPEC double SDLCALL SDL_cos(double x);
dewyatt@4755
   698
#endif
dewyatt@4755
   699
dewyatt@4755
   700
#ifdef HAVE_COSF
dewyatt@4755
   701
#define SDL_cosf        cosf
dewyatt@4755
   702
#else
dewyatt@4755
   703
#define SDL_cosf(x) (float)SDL_cos((double)x)
dewyatt@4755
   704
#endif
dewyatt@4755
   705
dewyatt@4755
   706
#ifdef HAVE_FABS
dewyatt@4755
   707
#define SDL_fabs        fabs
dewyatt@4755
   708
#else
dewyatt@4755
   709
extern DECLSPEC double SDLCALL SDL_fabs(double x);
dewyatt@4755
   710
#endif
dewyatt@4755
   711
dewyatt@4755
   712
#ifdef HAVE_FLOOR
dewyatt@4755
   713
#define SDL_floor       floor
dewyatt@4755
   714
#else
dewyatt@4755
   715
extern DECLSPEC double SDLCALL SDL_floor(double x);
dewyatt@4755
   716
#endif
dewyatt@4755
   717
dewyatt@4755
   718
#ifdef HAVE_LOG
dewyatt@4755
   719
#define SDL_log         log
dewyatt@4755
   720
#else
dewyatt@4755
   721
extern DECLSPEC double SDLCALL SDL_log(double x);
dewyatt@4755
   722
#endif
dewyatt@4755
   723
dewyatt@4755
   724
#ifdef HAVE_POW
dewyatt@4755
   725
#define SDL_pow         pow
dewyatt@4755
   726
#else
dewyatt@4755
   727
extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
dewyatt@4755
   728
#endif
dewyatt@4755
   729
dewyatt@4755
   730
#ifdef HAVE_SCALBN
dewyatt@4755
   731
#define SDL_scalbn      scalbn
dewyatt@4755
   732
#else
dewyatt@4755
   733
extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
dewyatt@4755
   734
#endif
dewyatt@4755
   735
dewyatt@4755
   736
#ifdef HAVE_SIN
dewyatt@4755
   737
#define SDL_sin         sin
dewyatt@4755
   738
#else
dewyatt@4755
   739
extern DECLSPEC double SDLCALL SDL_sin(double x);
dewyatt@4755
   740
#endif
dewyatt@4755
   741
dewyatt@4755
   742
#ifdef HAVE_SINF
dewyatt@4755
   743
#define SDL_sinf        sinf
dewyatt@4755
   744
#else
dewyatt@4755
   745
#define SDL_sinf(x) (float)SDL_sin((double)x)
dewyatt@4755
   746
#endif
dewyatt@4755
   747
dewyatt@4755
   748
#ifdef HAVE_SQRT
dewyatt@4755
   749
#define SDL_sqrt        sqrt
dewyatt@4755
   750
#else
dewyatt@4755
   751
extern DECLSPEC double SDLCALL SDL_sqrt(double x);
dewyatt@4755
   752
#endif
dewyatt@4755
   753
dewyatt@4755
   754
/* The SDL implementation of iconv() returns these error codes */
dewyatt@4755
   755
#define SDL_ICONV_ERROR		(size_t)-1
dewyatt@4755
   756
#define SDL_ICONV_E2BIG		(size_t)-2
dewyatt@4755
   757
#define SDL_ICONV_EILSEQ	(size_t)-3
dewyatt@4755
   758
#define SDL_ICONV_EINVAL	(size_t)-4
dewyatt@4755
   759
dewyatt@4755
   760
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
dewyatt@4755
   761
#define SDL_iconv_t     iconv_t
dewyatt@4755
   762
#define SDL_iconv_open  iconv_open
dewyatt@4755
   763
#define SDL_iconv_close iconv_close
dewyatt@4755
   764
#else
dewyatt@4755
   765
typedef struct _SDL_iconv_t *SDL_iconv_t;
dewyatt@4755
   766
extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode,
dewyatt@4755
   767
                                                   const char *fromcode);
dewyatt@4755
   768
extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
dewyatt@4755
   769
#endif
dewyatt@4755
   770
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
dewyatt@4755
   771
                                         size_t * inbytesleft, char **outbuf,
dewyatt@4755
   772
                                         size_t * outbytesleft);
dewyatt@4755
   773
/**
dewyatt@4755
   774
 *  This function converts a string between encodings in one pass, returning a
dewyatt@4755
   775
 *  string that must be freed with SDL_free() or NULL on error.
dewyatt@4755
   776
 */
dewyatt@4755
   777
extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
dewyatt@4755
   778
                                               const char *fromcode,
dewyatt@4755
   779
                                               const char *inbuf,
dewyatt@4755
   780
                                               size_t inbytesleft);
dewyatt@4755
   781
#define SDL_iconv_utf8_locale(S)	SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
dewyatt@4755
   782
#define SDL_iconv_utf8_ucs2(S)		(Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1)
dewyatt@4755
   783
#define SDL_iconv_utf8_ucs4(S)		(Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1)
dewyatt@4755
   784
dewyatt@4755
   785
/* Ends C function definitions when using C++ */
dewyatt@4755
   786
#ifdef __cplusplus
dewyatt@4755
   787
/* *INDENT-OFF* */
dewyatt@4755
   788
}
dewyatt@4755
   789
/* *INDENT-ON* */
dewyatt@4755
   790
#endif
dewyatt@4755
   791
#include "close_code.h"
dewyatt@4755
   792
dewyatt@4755
   793
#endif /* _SDL_stdinc_h */
dewyatt@4755
   794
dewyatt@4755
   795
/* vi: set ts=4 sw=4 expandtab: */