From b7d20c5a253add176bdf0f604f69cfe5d0571c7e Mon Sep 17 00:00:00 2001 From: suve Date: Mon, 13 Mar 2023 14:44:51 +0100 Subject: [PATCH 1/3] Add SDL_is* character functions --- units/sdlstdinc.inc | 132 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/units/sdlstdinc.inc b/units/sdlstdinc.inc index e8f718cf..755f81e7 100644 --- a/units/sdlstdinc.inc +++ b/units/sdlstdinc.inc @@ -138,6 +138,138 @@ function SDL_realloc(mem: Pointer; size: csize_t): Pointer; cdecl; procedure SDL_free(mem: Pointer); cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_free' {$ENDIF} {$ENDIF}; + +(*** --- Character functions --- ***) + + +(** + * Check if the provided ASCII character is an alphabetic character (a letter). + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +function SDL_isalpha(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isalpha' {$ENDIF} {$ENDIF}; + +(** + * Check if the provided ASCII character is an alphanumeric character. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +function SDL_isalnum(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isalnum' {$ENDIF} {$ENDIF}; + +(** + * Check if the provided ASCII character is a blank character (a space or a tab). + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +function SDL_isblank(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isblank' {$ENDIF} {$ENDIF}; + +(** + * Check if the provided ASCII character is a control character. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +function SDL_iscntrl(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iscntrl' {$ENDIF} {$ENDIF}; + +(** + * Check if the provided ASCII character is a decimal digit. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.4. + *) +function SDL_isdigit(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isdigit' {$ENDIF} {$ENDIF}; + +(** + * Check if the provided ASCII character is a hexadecimal digit. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +function SDL_isxdigit(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isxdigit' {$ENDIF} {$ENDIF}; + +(** + * Check if the provided ASCII character is any printable character + * which is not a space or an alphanumeric character. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +function SDL_ispunct(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ispunct' {$ENDIF} {$ENDIF}; + +(** + * Check if the provided ASCII character is a whitespace character. + * This set includes the following characters: space, + * form feed (FF), newline/line feed (LF), carriage return (CR), + * horizontal tab (HT), vertical tab (VT). + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.4. + *) +function SDL_isspace(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isspace' {$ENDIF} {$ENDIF}; + +(** + * Check if the provided ASCII character is an uppercase letter. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.12. + *) +function SDL_isupper(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isupper' {$ENDIF} {$ENDIF}; + +(** + * Check if the provided ASCII character is a lowercase letter. + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.12. + *) +function SDL_islower(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_islower' {$ENDIF} {$ENDIF}; + +(** + * Check if the provided ASCII character is a printable character (including space). + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +function SDL_isprint(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isprint' {$ENDIF} {$ENDIF}; + +(** + * Check if the provided ASCII character is a printable character (excluding space). + * + * \returns 1 if the check passes, 0 otherwise. + * + * \since This function is available since SDL 2.0.16. + *) +function SDL_isgraph(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isgraph' {$ENDIF} {$ENDIF}; + + +(*** --- iconv functions --- ***) + + (** * This function converts a string between encodings in one pass, returning a * string that must be freed with SDL_free(), or NIL on error. From 0fe9ab8ac7b7b8104667728dbcbfc077c24dfd04 Mon Sep 17 00:00:00 2001 From: suve Date: Mon, 13 Mar 2023 14:49:59 +0100 Subject: [PATCH 2/3] Add SDL_toupper and SDL_tolower --- units/sdlstdinc.inc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/units/sdlstdinc.inc b/units/sdlstdinc.inc index 755f81e7..27ccde92 100644 --- a/units/sdlstdinc.inc +++ b/units/sdlstdinc.inc @@ -266,6 +266,24 @@ function SDL_isprint(x: cint):cint; cdecl; function SDL_isgraph(x: cint):cint; cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isgraph' {$ENDIF} {$ENDIF}; +(** + * If the given ASCII character is a lowercase letter, converts it to uppercase. + * Otherwise returns the original value. + * + * \since This function is available since SDL 2.0.4. + *) +function SDL_toupper(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_toupper' {$ENDIF} {$ENDIF}; + +(** + * If the given ASCII character is an uppercase letter, converts it to lowercase. + * Otherwise returns the original value. + * + * \since This function is available since SDL 2.0.4. + *) +function SDL_tolower(x: cint):cint; cdecl; + external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_tolower' {$ENDIF} {$ENDIF}; + (*** --- iconv functions --- ***) From 3a66fb57e2626c2131ea11d0273013d44ba3b9aa Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 5 Jun 2023 00:30:35 +0200 Subject: [PATCH 3/3] Add comment about char. func. comments --- units/sdlstdinc.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/units/sdlstdinc.inc b/units/sdlstdinc.inc index b885c3de..7b9778d3 100644 --- a/units/sdlstdinc.inc +++ b/units/sdlstdinc.inc @@ -146,7 +146,9 @@ procedure SDL_free(mem: Pointer); cdecl; -(*** --- Character functions --- ***) +{*** --- Character functions --- *** + +SDL2-for-Pascal: All comments are added by us and not found in the include file.} (**