SimpleKernel 1.17.0
Loading...
Searching...
No Matches
sk_ctype.c
Go to the documentation of this file.
1
5#include "sk_ctype.h"
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11int isalnum(int c) { return (isalpha(c) || isdigit(c)); }
12
13int isalpha(int c) { return (islower(c) || isupper(c)); }
14
15int isblank(int c) { return (c == ' ' || c == '\t'); }
16
17int iscntrl(int c) { return ((c >= 0 && c <= 31) || c == 127); }
18
19int isdigit(int c) { return (c >= '0' && c <= '9'); }
20
21int isgraph(int c) { return (c >= 33 && c <= 126); }
22
23int islower(int c) { return (c >= 'a' && c <= 'z'); }
24
25int isprint(int c) { return (c >= 32 && c <= 126); }
26
27int ispunct(int c) { return (isgraph(c) && !isalnum(c)); }
28
29int isspace(int c) {
30 return (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' ||
31 c == '\v');
32}
33
34int isupper(int c) { return (c >= 'A' && c <= 'Z'); }
35
36int isxdigit(int c) {
37 return (isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
38}
39
40int tolower(int c) {
41 if (isupper(c)) {
42 return c + ('a' - 'A');
43 }
44 return c;
45}
46
47int toupper(int c) {
48 if (islower(c)) {
49 return c - ('a' - 'A');
50 }
51 return c;
52}
53
54#ifdef __cplusplus
55}
56#endif
#define tolower
#define isxdigit
#define isblank
#define isgraph
#define isprint
#define iscntrl
#define isdigit
#define isupper
#define isalnum
#define isspace
#define toupper
#define isalpha
#define islower
#define ispunct