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