diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index 81e3a8c70..d0634b980 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -440,10 +440,18 @@ extern DECLSPEC int SDLCALL SDL_abs(int x); #define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) #define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) +extern DECLSPEC int SDLCALL SDL_isalpha(int x); +extern DECLSPEC int SDLCALL SDL_isalnum(int x); +extern DECLSPEC int SDLCALL SDL_isblank(int x); +extern DECLSPEC int SDLCALL SDL_iscntrl(int x); extern DECLSPEC int SDLCALL SDL_isdigit(int x); +extern DECLSPEC int SDLCALL SDL_isxdigit(int x); +extern DECLSPEC int SDLCALL SDL_ispunct(int x); extern DECLSPEC int SDLCALL SDL_isspace(int x); extern DECLSPEC int SDLCALL SDL_isupper(int x); extern DECLSPEC int SDLCALL SDL_islower(int x); +extern DECLSPEC int SDLCALL SDL_isprint(int x); +extern DECLSPEC int SDLCALL SDL_isgraph(int x); extern DECLSPEC int SDLCALL SDL_toupper(int x); extern DECLSPEC int SDLCALL SDL_tolower(int x); diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index bb592c07b..4d698c60b 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -799,3 +799,11 @@ #define SDL_SetWindowMouseGrab SDL_SetWindowMouseGrab_REAL #define SDL_GetWindowKeyboardGrab SDL_GetWindowKeyboardGrab_REAL #define SDL_GetWindowMouseGrab SDL_GetWindowMouseGrab_REAL +#define SDL_isalpha SDL_isalpha_REAL +#define SDL_isalnum SDL_isalnum_REAL +#define SDL_isblank SDL_isblank_REAL +#define SDL_iscntrl SDL_iscntrl_REAL +#define SDL_isxdigit SDL_isxdigit_REAL +#define SDL_ispunct SDL_ispunct_REAL +#define SDL_isprint SDL_isprint_REAL +#define SDL_isgraph SDL_isgraph_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index b461985ff..8e67893a2 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -862,3 +862,11 @@ SDL_DYNAPI_PROC(void,SDL_SetWindowKeyboardGrab,(SDL_Window *a, SDL_bool b),(a,b) SDL_DYNAPI_PROC(void,SDL_SetWindowMouseGrab,(SDL_Window *a, SDL_bool b),(a,b),) SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowKeyboardGrab,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowMouseGrab,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_isalpha,(int a),(a),return) +SDL_DYNAPI_PROC(int,SDL_isalnum,(int a),(a),return) +SDL_DYNAPI_PROC(int,SDL_isblank,(int a),(a),return) +SDL_DYNAPI_PROC(int,SDL_iscntrl,(int a),(a),return) +SDL_DYNAPI_PROC(int,SDL_isxdigit,(int a),(a),return) +SDL_DYNAPI_PROC(int,SDL_ispunct,(int a),(a),return) +SDL_DYNAPI_PROC(int,SDL_isprint,(int a),(a),return) +SDL_DYNAPI_PROC(int,SDL_isgraph,(int a),(a),return) diff --git a/src/stdlib/SDL_stdlib.c b/src/stdlib/SDL_stdlib.c index 533117cc3..93fdd50bd 100644 --- a/src/stdlib/SDL_stdlib.c +++ b/src/stdlib/SDL_stdlib.c @@ -504,21 +504,40 @@ int SDL_abs(int x) } #if defined(HAVE_CTYPE_H) +int SDL_isalpha(int x) { return isalpha(x); } +int SDL_isalnum(int x) { return isalnum(x); } int SDL_isdigit(int x) { return isdigit(x); } +int SDL_isxdigit(int x) { return isxdigit(x); } +int SDL_ispunct(int x) { return ispunct(x); } int SDL_isspace(int x) { return isspace(x); } int SDL_isupper(int x) { return isupper(x); } int SDL_islower(int x) { return islower(x); } +int SDL_isprint(int x) { return isprint(x); } +int SDL_isgraph(int x) { return isgraph(x); } +int SDL_iscntrl(int x) { return iscntrl(x); } int SDL_toupper(int x) { return toupper(x); } int SDL_tolower(int x) { return tolower(x); } #else +int SDL_isalpha(int x) { return (SDL_isupper(x)) || (SDL_islower(x)); } +int SDL_isalnum(int x) { return (SDL_isalpha(x)) || (SDL_isdigit(x)); } int SDL_isdigit(int x) { return ((x) >= '0') && ((x) <= '9'); } +int SDL_isxdigit(int x) { return (SDL_isalpha(x)) || (SDL_isdigit(x)); } +int SDL_ispunct(int x) { return (SDL_isprint(x)) && (!SDL_isalnum(x)); } int SDL_isspace(int x) { return ((x) == ' ') || ((x) == '\t') || ((x) == '\r') || ((x) == '\n') || ((x) == '\f') || ((x) == '\v'); } int SDL_isupper(int x) { return ((x) >= 'A') && ((x) <= 'Z'); } int SDL_islower(int x) { return ((x) >= 'a') && ((x) <= 'z'); } +int SDL_isprint(int x) { return ((x) >= ' ') && ((x) < '\x7f'); } +int SDL_isgraph(int x) { return (SDL_isprint(x)) && ((x) != ' '); } +int SDL_iscntrl(int x) { return (((x) >= '\0') && ((x) <= '\x1f')) || ((x) == '\x7f'); } int SDL_toupper(int x) { return ((x) >= 'a') && ((x) <= 'z') ? ('A'+((x)-'a')) : (x); } int SDL_tolower(int x) { return ((x) >= 'A') && ((x) <= 'Z') ? ('a'+((x)-'A')) : (x); } #endif +#if defined(HAVE_CTYPE_H) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +int SDL_isblank(int x) { return isblank(x); } +#else +int SDL_isblank(int x) { return ((x) == ' ') || ((x) == '\t'); } +#endif #ifndef HAVE_LIBC /* These are some C runtime intrinsics that need to be defined */