annotate include/SDL_stdinc.h @ 5275:7aba0406c273

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