Skip to content

Commit 6ed5249

Browse files
Merge pull request #119 from suve/add-sdlstdinc-character-functions
Add sdlstdinc character functions This patch adds character manipulation functions to sdlstdinc.inc. Comments are based on suve's research into SDL code.
2 parents e0a3e70 + 3a66fb5 commit 6ed5249

File tree

1 file changed

+151
-0
lines changed

1 file changed

+151
-0
lines changed

units/sdlstdinc.inc

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,156 @@ procedure SDL_free(mem: Pointer); cdecl;
145145
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_free' {$ENDIF} {$ENDIF};
146146

147147

148+
149+
{*** --- Character functions --- ***
150+
151+
SDL2-for-Pascal: All comments are added by us and not found in the include file.}
152+
153+
154+
(**
155+
* Check if the provided ASCII character is an alphabetic character (a letter).
156+
*
157+
* \returns 1 if the check passes, 0 otherwise.
158+
*
159+
* \since This function is available since SDL 2.0.16.
160+
*)
161+
function SDL_isalpha(x: cint):cint; cdecl;
162+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isalpha' {$ENDIF} {$ENDIF};
163+
164+
(**
165+
* Check if the provided ASCII character is an alphanumeric character.
166+
*
167+
* \returns 1 if the check passes, 0 otherwise.
168+
*
169+
* \since This function is available since SDL 2.0.16.
170+
*)
171+
function SDL_isalnum(x: cint):cint; cdecl;
172+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isalnum' {$ENDIF} {$ENDIF};
173+
174+
(**
175+
* Check if the provided ASCII character is a blank character (a space or a tab).
176+
*
177+
* \returns 1 if the check passes, 0 otherwise.
178+
*
179+
* \since This function is available since SDL 2.0.16.
180+
*)
181+
function SDL_isblank(x: cint):cint; cdecl;
182+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isblank' {$ENDIF} {$ENDIF};
183+
184+
(**
185+
* Check if the provided ASCII character is a control character.
186+
*
187+
* \returns 1 if the check passes, 0 otherwise.
188+
*
189+
* \since This function is available since SDL 2.0.16.
190+
*)
191+
function SDL_iscntrl(x: cint):cint; cdecl;
192+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_iscntrl' {$ENDIF} {$ENDIF};
193+
194+
(**
195+
* Check if the provided ASCII character is a decimal digit.
196+
*
197+
* \returns 1 if the check passes, 0 otherwise.
198+
*
199+
* \since This function is available since SDL 2.0.4.
200+
*)
201+
function SDL_isdigit(x: cint):cint; cdecl;
202+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isdigit' {$ENDIF} {$ENDIF};
203+
204+
(**
205+
* Check if the provided ASCII character is a hexadecimal digit.
206+
*
207+
* \returns 1 if the check passes, 0 otherwise.
208+
*
209+
* \since This function is available since SDL 2.0.16.
210+
*)
211+
function SDL_isxdigit(x: cint):cint; cdecl;
212+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isxdigit' {$ENDIF} {$ENDIF};
213+
214+
(**
215+
* Check if the provided ASCII character is any printable character
216+
* which is not a space or an alphanumeric character.
217+
*
218+
* \returns 1 if the check passes, 0 otherwise.
219+
*
220+
* \since This function is available since SDL 2.0.16.
221+
*)
222+
function SDL_ispunct(x: cint):cint; cdecl;
223+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ispunct' {$ENDIF} {$ENDIF};
224+
225+
(**
226+
* Check if the provided ASCII character is a whitespace character.
227+
* This set includes the following characters: space,
228+
* form feed (FF), newline/line feed (LF), carriage return (CR),
229+
* horizontal tab (HT), vertical tab (VT).
230+
*
231+
* \returns 1 if the check passes, 0 otherwise.
232+
*
233+
* \since This function is available since SDL 2.0.4.
234+
*)
235+
function SDL_isspace(x: cint):cint; cdecl;
236+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isspace' {$ENDIF} {$ENDIF};
237+
238+
(**
239+
* Check if the provided ASCII character is an uppercase letter.
240+
*
241+
* \returns 1 if the check passes, 0 otherwise.
242+
*
243+
* \since This function is available since SDL 2.0.12.
244+
*)
245+
function SDL_isupper(x: cint):cint; cdecl;
246+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isupper' {$ENDIF} {$ENDIF};
247+
248+
(**
249+
* Check if the provided ASCII character is a lowercase letter.
250+
*
251+
* \returns 1 if the check passes, 0 otherwise.
252+
*
253+
* \since This function is available since SDL 2.0.12.
254+
*)
255+
function SDL_islower(x: cint):cint; cdecl;
256+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_islower' {$ENDIF} {$ENDIF};
257+
258+
(**
259+
* Check if the provided ASCII character is a printable character (including space).
260+
*
261+
* \returns 1 if the check passes, 0 otherwise.
262+
*
263+
* \since This function is available since SDL 2.0.16.
264+
*)
265+
function SDL_isprint(x: cint):cint; cdecl;
266+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isprint' {$ENDIF} {$ENDIF};
267+
268+
(**
269+
* Check if the provided ASCII character is a printable character (excluding space).
270+
*
271+
* \returns 1 if the check passes, 0 otherwise.
272+
*
273+
* \since This function is available since SDL 2.0.16.
274+
*)
275+
function SDL_isgraph(x: cint):cint; cdecl;
276+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_isgraph' {$ENDIF} {$ENDIF};
277+
278+
(**
279+
* If the given ASCII character is a lowercase letter, converts it to uppercase.
280+
* Otherwise returns the original value.
281+
*
282+
* \since This function is available since SDL 2.0.4.
283+
*)
284+
function SDL_toupper(x: cint):cint; cdecl;
285+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_toupper' {$ENDIF} {$ENDIF};
286+
287+
(**
288+
* If the given ASCII character is an uppercase letter, converts it to lowercase.
289+
* Otherwise returns the original value.
290+
*
291+
* \since This function is available since SDL 2.0.4.
292+
*)
293+
function SDL_tolower(x: cint):cint; cdecl;
294+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_tolower' {$ENDIF} {$ENDIF};
295+
296+
297+
148298
(*** --- Math functions --- ***)
149299

150300

@@ -509,6 +659,7 @@ function SDL_truncf(x: cfloat): cfloat; cdecl;
509659
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_truncf' {$ENDIF} {$ENDIF};
510660

511661

662+
512663
(*** --- iconv functions --- ***)
513664

514665

0 commit comments

Comments
 (0)