Mercurial > sdl-ios-xcode
annotate include/SDL_stdinc.h @ 4761:bb2e32f5a556
Removed spurious carriage returns
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 22 Aug 2010 12:34:31 -0700 |
parents | e2f4e31b41fc |
children | 518d1679d2d0 |
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 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
3 Copyright (C) 1997-2010 Sam Lantinga |
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); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
177 #ifndef __NINTENDODS__ /* TODO: figure out why the following happens: |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
178 include/SDL_stdinc.h:150: error: size of array 'SDL_dummy_uint64' is negative |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
179 include/SDL_stdinc.h:151: error: size of array 'SDL_dummy_sint64' is negative */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
180 SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
181 SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
182 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
183 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
184 /** \endcond */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
185 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
186 /* 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
|
187 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
|
188 enums having the size of an int must be enabled. |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
189 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
|
190 */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
191 /* 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
|
192 #ifdef __MWERKS__ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
193 #pragma enumsalwaysint on |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
194 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
195 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
196 /** \cond */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
197 #ifndef DOXYGEN_SHOULD_IGNORE_THIS |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
198 #ifndef __NINTENDODS__ /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
199 typedef enum |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
200 { |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
201 DUMMY_ENUM_VALUE |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
202 } SDL_DUMMY_ENUM; |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
203 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
204 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
|
205 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
206 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
207 /** \endcond */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
208 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
209 #include "begin_code.h" |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
210 /* Set up for C function definitions, even when using C++ */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
211 #ifdef __cplusplus |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
212 /* *INDENT-OFF* */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
213 extern "C" { |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
214 /* *INDENT-ON* */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
215 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
216 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
217 #ifdef HAVE_MALLOC |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
218 #define SDL_malloc malloc |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
219 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
220 extern DECLSPEC void *SDLCALL SDL_malloc(size_t size); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
221 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
222 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
223 #ifdef HAVE_CALLOC |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
224 #define SDL_calloc calloc |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
225 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
226 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
|
227 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
228 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
229 #ifdef HAVE_REALLOC |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
230 #define SDL_realloc realloc |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
231 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
232 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
|
233 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
234 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
235 #ifdef HAVE_FREE |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
236 #define SDL_free free |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
237 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
238 extern DECLSPEC void SDLCALL SDL_free(void *mem); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
239 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
240 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
241 #if defined(HAVE_ALLOCA) && !defined(alloca) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
242 # if defined(HAVE_ALLOCA_H) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
243 # include <alloca.h> |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
244 # elif defined(__GNUC__) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
245 # define alloca __builtin_alloca |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
246 # elif defined(_MSC_VER) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
247 # include <malloc.h> |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
248 # define alloca _alloca |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
249 # elif defined(__WATCOMC__) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
250 # include <malloc.h> |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
251 # elif defined(__BORLANDC__) |
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(__DMC__) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
254 # include <stdlib.h> |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
255 # elif defined(__AIX__) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
256 #pragma alloca |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
257 # elif defined(__MRC__) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
258 void *alloca(unsigned); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
259 # else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
260 char *alloca(); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
261 # endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
262 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
263 #ifdef HAVE_ALLOCA |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
264 #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
|
265 #define SDL_stack_free(data) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
266 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
267 #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
|
268 #define SDL_stack_free(data) SDL_free(data) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
269 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
270 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
271 #ifdef HAVE_GETENV |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
272 #define SDL_getenv getenv |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
273 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
274 extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
275 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
276 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
277 /* SDL_putenv() has moved to SDL_compat. */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
278 #ifdef HAVE_SETENV |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
279 #define SDL_setenv setenv |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
280 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
281 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
|
282 int overwrite); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
283 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
284 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
285 #ifdef HAVE_QSORT |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
286 #define SDL_qsort qsort |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
287 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
288 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
|
289 int (*compare) (const void *, |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
290 const void *)); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
291 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
292 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
293 #ifdef HAVE_ABS |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
294 #define SDL_abs abs |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
295 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
296 #define SDL_abs(X) ((X) < 0 ? -(X) : (X)) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
297 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
298 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
299 #define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
300 #define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
301 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
302 #ifdef HAVE_CTYPE_H |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
303 #define SDL_isdigit(X) isdigit(X) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
304 #define SDL_isspace(X) isspace(X) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
305 #define SDL_toupper(X) toupper(X) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
306 #define SDL_tolower(X) tolower(X) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
307 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
308 #define SDL_isdigit(X) (((X) >= '0') && ((X) <= '9')) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
309 #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
|
310 #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
|
311 #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
|
312 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
313 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
314 #ifdef HAVE_MEMSET |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
315 #define SDL_memset memset |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
316 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
317 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
|
318 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
319 #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
320 #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
321 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
322 #if defined(__GNUC__) && defined(i386) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
323 #define SDL_memset4(dst, val, len) \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
324 do { \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
325 int u0, u1, u2; \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
326 __asm__ __volatile__ ( \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
327 "cld\n\t" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
328 "rep ; stosl\n\t" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
329 : "=&D" (u0), "=&a" (u1), "=&c" (u2) \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
330 : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, len)) \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
331 : "memory" ); \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
332 } while(0) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
333 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
334 #ifndef SDL_memset4 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
335 #define SDL_memset4(dst, val, len) \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
336 do { \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
337 unsigned _count = (len); \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
338 unsigned _n = (_count + 3) / 4; \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
339 Uint32 *_p = SDL_static_cast(Uint32 *, dst); \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
340 Uint32 _val = (val); \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
341 if (len == 0) break; \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
342 switch (_count % 4) { \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
343 case 0: do { *_p++ = _val; \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
344 case 3: *_p++ = _val; \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
345 case 2: *_p++ = _val; \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
346 case 1: *_p++ = _val; \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
347 } while ( --_n ); \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
348 } \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
349 } while(0) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
350 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
351 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
352 /* 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
|
353 #if defined(__MACH__) && defined(__APPLE__) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
354 #define SDL_memcpy(dst, src, len) memcpy(dst, src, len) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
355 #elif defined(__GNUC__) && defined(i386) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
356 #define SDL_memcpy(dst, src, len) \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
357 do { \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
358 int u0, u1, u2; \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
359 __asm__ __volatile__ ( \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
360 "cld\n\t" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
361 "rep ; movsl\n\t" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
362 "testb $2,%b4\n\t" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
363 "je 1f\n\t" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
364 "movsw\n" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
365 "1:\ttestb $1,%b4\n\t" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
366 "je 2f\n\t" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
367 "movsb\n" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
368 "2:" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
369 : "=&c" (u0), "=&D" (u1), "=&S" (u2) \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
370 : "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
|
371 : "memory" ); \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
372 } while(0) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
373 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
374 #ifndef SDL_memcpy |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
375 #ifdef HAVE_MEMCPY |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
376 #define SDL_memcpy memcpy |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
377 #elif defined(HAVE_BCOPY) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
378 #define SDL_memcpy(d, s, n) bcopy((s), (d), (n)) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
379 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
380 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
|
381 size_t len); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
382 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
383 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
384 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
385 /* 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
|
386 #if defined(__MACH__) && defined(__APPLE__) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
387 #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
|
388 #elif defined(__GNUC__) && defined(i386) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
389 #define SDL_memcpy4(dst, src, len) \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
390 do { \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
391 int ecx, edi, esi; \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
392 __asm__ __volatile__ ( \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
393 "cld\n\t" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
394 "rep ; movsl" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
395 : "=&c" (ecx), "=&D" (edi), "=&S" (esi) \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
396 : "0" (SDL_static_cast(unsigned, len)), "1" (dst), "2" (src) \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
397 : "memory" ); \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
398 } while(0) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
399 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
400 #ifndef SDL_memcpy4 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
401 #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
|
402 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
403 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
404 #if defined(__GNUC__) && defined(i386) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
405 #define SDL_revcpy(dst, src, len) \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
406 do { \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
407 int u0, u1, u2; \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
408 char *dstp = SDL_static_cast(char *, dst); \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
409 char *srcp = SDL_static_cast(char *, src); \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
410 int n = (len); \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
411 if ( n >= 4 ) { \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
412 __asm__ __volatile__ ( \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
413 "std\n\t" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
414 "rep ; movsl\n\t" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
415 "cld\n\t" \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
416 : "=&c" (u0), "=&D" (u1), "=&S" (u2) \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
417 : "0" (n >> 2), \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
418 "1" (dstp+(n-4)), "2" (srcp+(n-4)) \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
419 : "memory" ); \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
420 } \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
421 switch (n & 3) { \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
422 case 3: dstp[2] = srcp[2]; \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
423 case 2: dstp[1] = srcp[1]; \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
424 case 1: dstp[0] = srcp[0]; \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
425 break; \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
426 default: \ |
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 } \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
429 } while(0) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
430 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
431 #ifndef SDL_revcpy |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
432 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
|
433 size_t len); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
434 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
435 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
436 #ifdef HAVE_MEMMOVE |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
437 #define SDL_memmove memmove |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
438 #elif defined(HAVE_BCOPY) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
439 #define SDL_memmove(d, s, n) bcopy((s), (d), (n)) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
440 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
441 #define SDL_memmove(dst, src, len) \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
442 do { \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
443 if ( dst < src ) { \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
444 SDL_memcpy(dst, src, len); \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
445 } else { \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
446 SDL_revcpy(dst, src, len); \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
447 } \ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
448 } while(0) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
449 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
450 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
451 #ifdef HAVE_MEMCMP |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
452 #define SDL_memcmp memcmp |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
453 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
454 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
|
455 size_t len); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
456 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
457 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
458 #ifdef HAVE_STRLEN |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
459 #define SDL_strlen strlen |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
460 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
461 extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
462 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
463 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
464 #ifdef HAVE_WCSLEN |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
465 #define SDL_wcslen wcslen |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
466 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
467 #if !defined(wchar_t) && defined(__NINTENDODS__) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
468 #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
|
469 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
470 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
|
471 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
472 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
473 #ifdef HAVE_WCSLCPY |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
474 #define SDL_wcslcpy wcslcpy |
4758 | 475 #else |
476 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
|
477 #endif |
4758 | 478 |
479 #ifdef HAVE_WCSLCAT | |
480 #define SDL_wcslcat wcslcat | |
481 #else | |
482 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
|
483 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
484 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
485 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
486 #ifdef HAVE_STRLCPY |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
487 #define SDL_strlcpy strlcpy |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
488 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
489 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
|
490 size_t maxlen); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
491 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
492 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
493 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
|
494 size_t dst_bytes); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
495 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
496 #ifdef HAVE_STRLCAT |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
497 #define SDL_strlcat strlcat |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
498 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
499 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
|
500 size_t maxlen); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
501 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
502 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
503 #ifdef HAVE_STRDUP |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
504 #define SDL_strdup strdup |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
505 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
506 extern DECLSPEC char *SDLCALL SDL_strdup(const char *string); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
507 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
508 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
509 #ifdef HAVE__STRREV |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
510 #define SDL_strrev _strrev |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
511 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
512 extern DECLSPEC char *SDLCALL SDL_strrev(char *string); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
513 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
514 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
515 #ifdef HAVE__STRUPR |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
516 #define SDL_strupr _strupr |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
517 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
518 extern DECLSPEC char *SDLCALL SDL_strupr(char *string); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
519 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
520 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
521 #ifdef HAVE__STRLWR |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
522 #define SDL_strlwr _strlwr |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
523 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
524 extern DECLSPEC char *SDLCALL SDL_strlwr(char *string); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
525 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
526 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
527 #ifdef HAVE_STRCHR |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
528 #define SDL_strchr strchr |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
529 #elif defined(HAVE_INDEX) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
530 #define SDL_strchr index |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
531 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
532 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
|
533 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
534 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
535 #ifdef HAVE_STRRCHR |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
536 #define SDL_strrchr strrchr |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
537 #elif defined(HAVE_RINDEX) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
538 #define SDL_strrchr rindex |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
539 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
540 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
|
541 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
542 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
543 #ifdef HAVE_STRSTR |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
544 #define SDL_strstr strstr |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
545 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
546 extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
547 const char *needle); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
548 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
549 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
550 #ifdef HAVE_ITOA |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
551 #define SDL_itoa itoa |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
552 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
553 #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
|
554 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
555 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
556 #ifdef HAVE__LTOA |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
557 #define SDL_ltoa _ltoa |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
558 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
559 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
|
560 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
561 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
562 #ifdef HAVE__UITOA |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
563 #define SDL_uitoa _uitoa |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
564 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
565 #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
|
566 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
567 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
568 #ifdef HAVE__ULTOA |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
569 #define SDL_ultoa _ultoa |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
570 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
571 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
|
572 int radix); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
573 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
574 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
575 #ifdef HAVE_STRTOL |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
576 #define SDL_strtol strtol |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
577 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
578 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
|
579 int base); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
580 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
581 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
582 #ifdef HAVE_STRTOUL |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
583 #define SDL_strtoul strtoul |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
584 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
585 extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
586 char **endp, int base); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
587 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
588 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
589 #ifdef SDL_HAS_64BIT_TYPE |
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 HAVE__I64TOA |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
592 #define SDL_lltoa _i64toa |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
593 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
594 extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *string, |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
595 int radix); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
596 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
597 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
598 #ifdef HAVE__UI64TOA |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
599 #define SDL_ulltoa _ui64toa |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
600 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
601 extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *string, |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
602 int radix); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
603 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
604 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
605 #ifdef HAVE_STRTOLL |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
606 #define SDL_strtoll strtoll |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
607 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
608 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
|
609 int base); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
610 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
611 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
612 #ifdef HAVE_STRTOULL |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
613 #define SDL_strtoull strtoull |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
614 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
615 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
|
616 int base); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
617 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
618 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
619 #endif /* SDL_HAS_64BIT_TYPE */ |
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 #ifdef HAVE_STRTOD |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
622 #define SDL_strtod strtod |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
623 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
624 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
|
625 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
626 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
627 #ifdef HAVE_ATOI |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
628 #define SDL_atoi atoi |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
629 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
630 #define SDL_atoi(X) SDL_strtol(X, NULL, 0) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
631 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
632 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
633 #ifdef HAVE_ATOF |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
634 #define SDL_atof atof |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
635 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
636 #define SDL_atof(X) SDL_strtod(X, NULL) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
637 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
638 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
639 #ifdef HAVE_STRCMP |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
640 #define SDL_strcmp strcmp |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
641 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
642 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
|
643 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
644 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
645 #ifdef HAVE_STRNCMP |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
646 #define SDL_strncmp strncmp |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
647 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
648 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
|
649 size_t maxlen); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
650 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
651 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
652 #ifdef HAVE_STRCASECMP |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
653 #define SDL_strcasecmp strcasecmp |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
654 #elif defined(HAVE__STRICMP) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
655 #define SDL_strcasecmp _stricmp |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
656 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
657 extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
658 const char *str2); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
659 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
660 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
661 #ifdef HAVE_STRNCASECMP |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
662 #define SDL_strncasecmp strncasecmp |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
663 #elif defined(HAVE__STRNICMP) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
664 #define SDL_strncasecmp _strnicmp |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
665 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
666 extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
667 const char *str2, size_t maxlen); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
668 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
669 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
670 #ifdef HAVE_SSCANF |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
671 #define SDL_sscanf sscanf |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
672 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
673 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
|
674 ...); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
675 #endif |
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 #ifdef HAVE_SNPRINTF |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
678 #define SDL_snprintf snprintf |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
679 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
680 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
|
681 const char *fmt, ...); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
682 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
683 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
684 #ifdef HAVE_VSNPRINTF |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
685 #define SDL_vsnprintf vsnprintf |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
686 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
687 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
|
688 const char *fmt, va_list ap); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
689 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
690 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
691 #ifndef HAVE_M_PI |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
692 #define M_PI 3.14159265358979323846264338327950288 /* pi */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
693 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
694 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
695 #ifdef HAVE_CEIL |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
696 #define SDL_ceil ceil |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
697 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
698 #define SDL_ceil(x) ((double)(int)((x)+0.5)) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
699 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
700 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
701 #ifdef HAVE_COPYSIGN |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
702 #define SDL_copysign copysign |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
703 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
704 extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
705 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
706 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
707 #ifdef HAVE_COS |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
708 #define SDL_cos cos |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
709 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
710 extern DECLSPEC double SDLCALL SDL_cos(double x); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
711 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
712 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
713 #ifdef HAVE_COSF |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
714 #define SDL_cosf cosf |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
715 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
716 #define SDL_cosf(x) (float)SDL_cos((double)x) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
717 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
718 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
719 #ifdef HAVE_FABS |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
720 #define SDL_fabs fabs |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
721 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
722 extern DECLSPEC double SDLCALL SDL_fabs(double x); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
723 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
724 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
725 #ifdef HAVE_FLOOR |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
726 #define SDL_floor floor |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
727 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
728 extern DECLSPEC double SDLCALL SDL_floor(double x); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
729 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
730 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
731 #ifdef HAVE_LOG |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
732 #define SDL_log log |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
733 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
734 extern DECLSPEC double SDLCALL SDL_log(double x); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
735 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
736 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
737 #ifdef HAVE_POW |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
738 #define SDL_pow pow |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
739 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
740 extern DECLSPEC double SDLCALL SDL_pow(double x, double y); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
741 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
742 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
743 #ifdef HAVE_SCALBN |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
744 #define SDL_scalbn scalbn |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
745 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
746 extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
747 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
748 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
749 #ifdef HAVE_SIN |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
750 #define SDL_sin sin |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
751 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
752 extern DECLSPEC double SDLCALL SDL_sin(double x); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
753 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
754 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
755 #ifdef HAVE_SINF |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
756 #define SDL_sinf sinf |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
757 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
758 #define SDL_sinf(x) (float)SDL_sin((double)x) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
759 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
760 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
761 #ifdef HAVE_SQRT |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
762 #define SDL_sqrt sqrt |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
763 #else |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
764 extern DECLSPEC double SDLCALL SDL_sqrt(double x); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
765 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
766 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
767 /* The SDL implementation of iconv() returns these error codes */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
768 #define SDL_ICONV_ERROR (size_t)-1 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
769 #define SDL_ICONV_E2BIG (size_t)-2 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
770 #define SDL_ICONV_EILSEQ (size_t)-3 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
771 #define SDL_ICONV_EINVAL (size_t)-4 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
772 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
773 #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
774 #define SDL_iconv_t iconv_t |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
775 #define SDL_iconv_open iconv_open |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
776 #define SDL_iconv_close iconv_close |
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 typedef struct _SDL_iconv_t *SDL_iconv_t; |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
779 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
|
780 const char *fromcode); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
781 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
|
782 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
783 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
|
784 size_t * inbytesleft, char **outbuf, |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
785 size_t * outbytesleft); |
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 * 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
|
788 * 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
|
789 */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
790 extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode, |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
791 const char *fromcode, |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
792 const char *inbuf, |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
793 size_t inbytesleft); |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
794 #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
|
795 #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
|
796 #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
|
797 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
798 /* Ends C function definitions when using C++ */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
799 #ifdef __cplusplus |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
800 /* *INDENT-OFF* */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
801 } |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
802 /* *INDENT-ON* */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
803 #endif |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
804 #include "close_code.h" |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
805 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
806 #endif /* _SDL_stdinc_h */ |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
807 |
bb2e32f5a556
Removed spurious carriage returns
Sam Lantinga <slouken@libsdl.org>
parents:
4758
diff
changeset
|
808 /* vi: set ts=4 sw=4 expandtab: */ |