Mercurial > sdl-ios-xcode
comparison src/stdlib/SDL_string.c @ 1341:d02b552e5304
Configure dynamically generates SDL_config.h
I'm still wrestling with autoheader, but this should work for now...
Fixed lots of build problems with C library support disabled
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 07 Feb 2006 12:11:33 +0000 |
parents | 604d73db6802 |
children | d5c4f8f6855e |
comparison
equal
deleted
inserted
replaced
1340:58b114ef50e7 | 1341:d02b552e5304 |
---|---|
23 | 23 |
24 /* This file contains portable string manipulation functions for SDL */ | 24 /* This file contains portable string manipulation functions for SDL */ |
25 | 25 |
26 #include "SDL_types.h" | 26 #include "SDL_types.h" |
27 #include "SDL_ctype.h" | 27 #include "SDL_ctype.h" |
28 #include "SDL_stdlib.h" | |
28 #include "SDL_string.h" | 29 #include "SDL_string.h" |
29 | 30 |
30 | 31 |
31 #define isupperhex(X) (((X) >= 'A') && ((X) <= 'F')) | 32 #define isupperhex(X) (((X) >= 'A') && ((X) <= 'F')) |
32 #define islowerhex(X) (((X) >= 'a') && ((X) <= 'f')) | 33 #define islowerhex(X) (((X) >= 'a') && ((X) <= 'f')) |
173 return (text - textstart); | 174 return (text - textstart); |
174 } | 175 } |
175 #endif | 176 #endif |
176 #endif /* SDL_HAS_64BIT_TYPE */ | 177 #endif /* SDL_HAS_64BIT_TYPE */ |
177 | 178 |
178 #ifndef HAVE_SSCANF | 179 #if !defined(HAVE_SSCANF) || !defined(HAVE_STRTOD) |
179 static size_t SDL_ScanFloat(const char *text, double *valuep) | 180 static size_t SDL_ScanFloat(const char *text, double *valuep) |
180 { | 181 { |
181 const char *textstart = text; | 182 const char *textstart = text; |
182 unsigned long lvalue = 0; | 183 unsigned long lvalue = 0; |
183 double value = 0.0; | 184 double value = 0.0; |
320 | 321 |
321 return dst; | 322 return dst; |
322 } | 323 } |
323 #endif | 324 #endif |
324 | 325 |
326 #ifndef HAVE_STRDUP | |
327 char *SDL_strdup(const char *string) | |
328 { | |
329 size_t len = SDL_strlen(string); | |
330 char *newstr = SDL_malloc(len+1); | |
331 if ( newstr ) { | |
332 SDL_strcpy(newstr, string); | |
333 } | |
334 return newstr; | |
335 } | |
336 #endif | |
337 | |
325 #ifndef HAVE__STRREV | 338 #ifndef HAVE__STRREV |
326 char *SDL_strrev(char *string) | 339 char *SDL_strrev(char *string) |
327 { | 340 { |
328 size_t len = SDL_strlen(string); | 341 size_t len = SDL_strlen(string); |
329 char *a = &string[0]; | 342 char *a = &string[0]; |
546 return value; | 559 return value; |
547 } | 560 } |
548 #endif | 561 #endif |
549 | 562 |
550 #endif /* SDL_HAS_64BIT_TYPE */ | 563 #endif /* SDL_HAS_64BIT_TYPE */ |
564 | |
565 #ifndef HAVE_STRTOD | |
566 double SDL_strtod(const char *string, char **endp) | |
567 { | |
568 size_t len; | |
569 double value; | |
570 | |
571 len = SDL_ScanFloat(string, &value); | |
572 if ( endp ) { | |
573 *endp = (char *)string + len; | |
574 } | |
575 return value; | |
576 } | |
577 #endif | |
551 | 578 |
552 #ifndef HAVE_STRCMP | 579 #ifndef HAVE_STRCMP |
553 int SDL_strcmp(const char *str1, const char *str2) | 580 int SDL_strcmp(const char *str1, const char *str2) |
554 { | 581 { |
555 while (*str1 && *str2) { | 582 while (*str1 && *str2) { |