From aa384ad02b6e93ceb38c88ea2f3a8079bf0a0b64 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 2 Mar 2020 15:21:07 -0800 Subject: [PATCH] Fixed bug 5001 - Feature request: SDL_isupper & SDL_islower --- include/SDL_stdinc.h | 2 ++ src/dynapi/SDL_dynapi_overrides.h | 2 ++ src/dynapi/SDL_dynapi_procs.h | 2 ++ src/stdlib/SDL_stdlib.c | 4 ++++ 4 files changed, 10 insertions(+) diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index 59d7edb5d3587..d96e18bc2fc3b 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -408,6 +408,8 @@ extern DECLSPEC int SDLCALL SDL_abs(int x); extern DECLSPEC int SDLCALL SDL_isdigit(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_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 a1d8e2eb1ad50..a5b4d6a4298ad 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -747,3 +747,5 @@ #define SDL_OnApplicationDidBecomeActive SDL_OnApplicationDidBecomeActive_REAL #define SDL_OnApplicationDidChangeStatusBarOrientation SDL_OnApplicationDidChangeStatusBarOrientation_REAL #define SDL_GetAndroidSDKVersion SDL_GetAndroidSDKVersion_REAL +#define SDL_isupper SDL_isupper_REAL +#define SDL_islower SDL_islower_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 0c9c3359fa8ae..404a5e706f968 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -807,3 +807,5 @@ SDL_DYNAPI_PROC(void,SDL_OnApplicationDidChangeStatusBarOrientation,(void),(),) #ifdef __ANDROID__ SDL_DYNAPI_PROC(int,SDL_GetAndroidSDKVersion,(void),(),return) #endif +SDL_DYNAPI_PROC(int,SDL_isupper,(int a),(a),return) +SDL_DYNAPI_PROC(int,SDL_islower,(int a),(a),return) diff --git a/src/stdlib/SDL_stdlib.c b/src/stdlib/SDL_stdlib.c index bef47c751f0cd..c2774cb2c0055 100644 --- a/src/stdlib/SDL_stdlib.c +++ b/src/stdlib/SDL_stdlib.c @@ -438,11 +438,15 @@ int SDL_abs(int x) #if defined(HAVE_CTYPE_H) int SDL_isdigit(int x) { return isdigit(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_toupper(int x) { return toupper(x); } int SDL_tolower(int x) { return tolower(x); } #else int SDL_isdigit(int x) { return ((x) >= '0') && ((x) <= '9'); } 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_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