Mercurial > sdl-ios-xcode
comparison include/SDL_stdinc.h @ 3407:d3baf5ac4e37
Partial fix for bug #859
Header file update from Ken for improved doxygen output
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 19 Oct 2009 13:31:58 +0000 |
parents | 9cd5b35c0184 |
children | fb9ea4b549c3 |
comparison
equal
deleted
inserted
replaced
3406:8ae607392409 | 3407:d3baf5ac4e37 |
---|---|
19 Sam Lantinga | 19 Sam Lantinga |
20 slouken@libsdl.org | 20 slouken@libsdl.org |
21 */ | 21 */ |
22 | 22 |
23 /** | 23 /** |
24 * \file SDL_stdinc.h | 24 * \file SDL_stdinc.h |
25 * | 25 * |
26 * This is a general header that includes C language support | 26 * This is a general header that includes C language support. |
27 */ | 27 */ |
28 | 28 |
29 #ifndef _SDL_stdinc_h | 29 #ifndef _SDL_stdinc_h |
30 #define _SDL_stdinc_h | 30 #define _SDL_stdinc_h |
31 | 31 |
77 #endif | 77 #endif |
78 #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) | 78 #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) |
79 # include <iconv.h> | 79 # include <iconv.h> |
80 #endif | 80 #endif |
81 | 81 |
82 /* The number of elements in an array */ | 82 /** |
83 * The number of elements in an array. | |
84 */ | |
83 #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) | 85 #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) |
84 #define SDL_TABLESIZE(table) SDL_arraysize(table) | 86 #define SDL_TABLESIZE(table) SDL_arraysize(table) |
85 | 87 |
86 /* Use proper C++ casts when compiled as C++ to be compatible with the option | 88 /** |
87 -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above. */ | 89 * \name Cast operators |
90 * | |
91 * Use proper C++ casts when compiled as C++ to be compatible with the option | |
92 * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above). | |
93 */ | |
94 /*@{*/ | |
88 #ifdef __cplusplus | 95 #ifdef __cplusplus |
89 #define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression) | 96 #define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression) |
90 #define SDL_static_cast(type, expression) static_cast<type>(expression) | 97 #define SDL_static_cast(type, expression) static_cast<type>(expression) |
91 #else | 98 #else |
92 #define SDL_reinterpret_cast(type, expression) ((type)(expression)) | 99 #define SDL_reinterpret_cast(type, expression) ((type)(expression)) |
93 #define SDL_static_cast(type, expression) ((type)(expression)) | 100 #define SDL_static_cast(type, expression) ((type)(expression)) |
94 #endif | 101 #endif |
95 | 102 /*@}*//*Cast operators*/ |
96 /* Basic data types */ | 103 |
104 /** | |
105 * \name Basic data types | |
106 */ | |
107 /*@{*/ | |
108 | |
97 typedef enum | 109 typedef enum |
98 { | 110 { |
99 SDL_FALSE = 0, | 111 SDL_FALSE = 0, |
100 SDL_TRUE = 1 | 112 SDL_TRUE = 1 |
101 } SDL_bool; | 113 } SDL_bool; |
102 | 114 |
103 /** | 115 /** |
104 * \typedef Sint8 | |
105 * \brief A signed 8-bit integer type. | 116 * \brief A signed 8-bit integer type. |
106 */ | 117 */ |
107 typedef int8_t Sint8; | 118 typedef int8_t Sint8; |
108 /** | 119 /** |
109 * \typedef Uint8 | |
110 * \brief An unsigned 8-bit integer type. | 120 * \brief An unsigned 8-bit integer type. |
111 */ | 121 */ |
112 typedef uint8_t Uint8; | 122 typedef uint8_t Uint8; |
113 /** | 123 /** |
114 * \typedef Sint16 | |
115 * \brief A signed 16-bit integer type. | 124 * \brief A signed 16-bit integer type. |
116 */ | 125 */ |
117 typedef int16_t Sint16; | 126 typedef int16_t Sint16; |
118 /** | 127 /** |
119 * \typedef Uint16 | |
120 * \brief An unsigned 16-bit integer type. | 128 * \brief An unsigned 16-bit integer type. |
121 */ | 129 */ |
122 typedef uint16_t Uint16; | 130 typedef uint16_t Uint16; |
123 /** | 131 /** |
124 * \typedef Sint32 | |
125 * \brief A signed 32-bit integer type. | 132 * \brief A signed 32-bit integer type. |
126 */ | 133 */ |
127 typedef int32_t Sint32; | 134 typedef int32_t Sint32; |
128 /** | 135 /** |
129 * \typedef Uint32 | |
130 * \brief An unsigned 32-bit integer type. | 136 * \brief An unsigned 32-bit integer type. |
131 */ | 137 */ |
132 typedef uint32_t Uint32; | 138 typedef uint32_t Uint32; |
133 | 139 |
134 #ifdef SDL_HAS_64BIT_TYPE | 140 #ifdef SDL_HAS_64BIT_TYPE |
135 /** | 141 /** |
136 * \typedef Sint64 | |
137 * \brief A signed 64-bit integer type. | 142 * \brief A signed 64-bit integer type. |
138 * \warning On platforms without any sort of 64-bit datatype, this is equivalent to Sint32! | 143 * \warning On platforms without any sort of 64-bit datatype, this is equivalent to Sint32! |
139 */ | 144 */ |
140 typedef int64_t Sint64; | 145 typedef int64_t Sint64; |
141 /** | 146 /** |
142 * \typedef Uint64 | |
143 * \brief An unsigned 64-bit integer type. | 147 * \brief An unsigned 64-bit integer type. |
144 * \warning On platforms without any sort of 64-bit datatype, this is equivalent to Uint32! | 148 * \warning On platforms without any sort of 64-bit datatype, this is equivalent to Uint32! |
145 */ | 149 */ |
146 typedef uint64_t Uint64; | 150 typedef uint64_t Uint64; |
147 #else | 151 #else |
148 /* This is really just a hack to prevent the compiler from complaining */ | 152 /* This is really just a hack to prevent the compiler from complaining */ |
149 typedef Sint32 Sint64; | 153 typedef Sint32 Sint64; |
150 typedef Uint32 Uint64; | 154 typedef Uint32 Uint64; |
151 #endif | 155 #endif |
152 | 156 |
153 /* Make sure the types really have the right sizes */ | 157 /*@}*//*Basic data types*/ |
158 | |
159 | |
154 #define SDL_COMPILE_TIME_ASSERT(name, x) \ | 160 #define SDL_COMPILE_TIME_ASSERT(name, x) \ |
155 typedef int SDL_dummy_ ## name[(x) * 2 - 1] | 161 typedef int SDL_dummy_ ## name[(x) * 2 - 1] |
162 /** \cond */ | |
156 #ifndef DOXYGEN_SHOULD_IGNORE_THIS | 163 #ifndef DOXYGEN_SHOULD_IGNORE_THIS |
157 SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); | 164 SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); |
158 SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); | 165 SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); |
159 SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); | 166 SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); |
160 SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); | 167 SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); |
165 include/SDL_stdinc.h:151: error: size of array 'SDL_dummy_sint64' is negative */ | 172 include/SDL_stdinc.h:151: error: size of array 'SDL_dummy_sint64' is negative */ |
166 SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); | 173 SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); |
167 SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); | 174 SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); |
168 #endif | 175 #endif |
169 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ | 176 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ |
177 /** \endcond */ | |
170 | 178 |
171 /* Check to make sure enums are the size of ints, for structure packing. | 179 /* Check to make sure enums are the size of ints, for structure packing. |
172 For both Watcom C/C++ and Borland C/C++ the compiler option that makes | 180 For both Watcom C/C++ and Borland C/C++ the compiler option that makes |
173 enums having the size of an int must be enabled. | 181 enums having the size of an int must be enabled. |
174 This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). | 182 This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). |
176 /* Enable enums always int in CodeWarrior (for MPW use "-enum int") */ | 184 /* Enable enums always int in CodeWarrior (for MPW use "-enum int") */ |
177 #ifdef __MWERKS__ | 185 #ifdef __MWERKS__ |
178 #pragma enumsalwaysint on | 186 #pragma enumsalwaysint on |
179 #endif | 187 #endif |
180 | 188 |
189 /** \cond */ | |
181 #ifndef DOXYGEN_SHOULD_IGNORE_THIS | 190 #ifndef DOXYGEN_SHOULD_IGNORE_THIS |
182 #ifndef __NINTENDODS__ /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */ | 191 #ifndef __NINTENDODS__ /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */ |
183 typedef enum | 192 typedef enum |
184 { | 193 { |
185 DUMMY_ENUM_VALUE | 194 DUMMY_ENUM_VALUE |
186 } SDL_DUMMY_ENUM; | 195 } SDL_DUMMY_ENUM; |
187 | 196 |
188 SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); | 197 SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); |
189 #endif | 198 #endif |
190 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ | 199 #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ |
200 /** \endcond */ | |
191 | 201 |
192 #include "begin_code.h" | 202 #include "begin_code.h" |
193 /* Set up for C function definitions, even when using C++ */ | 203 /* Set up for C function definitions, even when using C++ */ |
194 #ifdef __cplusplus | 204 #ifdef __cplusplus |
195 /* *INDENT-OFF* */ | 205 /* *INDENT-OFF* */ |
746 extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); | 756 extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); |
747 #endif | 757 #endif |
748 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, | 758 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, |
749 size_t * inbytesleft, char **outbuf, | 759 size_t * inbytesleft, char **outbuf, |
750 size_t * outbytesleft); | 760 size_t * outbytesleft); |
751 /* This function converts a string between encodings in one pass, returning a | 761 /** |
752 string that must be freed with SDL_free() or NULL on error. | 762 * This function converts a string between encodings in one pass, returning a |
753 */ | 763 * string that must be freed with SDL_free() or NULL on error. |
764 */ | |
754 extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode, | 765 extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode, |
755 const char *fromcode, | 766 const char *fromcode, |
756 const char *inbuf, | 767 const char *inbuf, |
757 size_t inbytesleft); | 768 size_t inbytesleft); |
758 #define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) | 769 #define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) |