Files
photon/libc/ctype/ctype.c

47 lines
1020 B
C

#include <stdbool.h>
static unsigned int random_seed = 53455346;
int isupper(int c) { return (c >= 65 && c <= 90); }
int islower(int c) { return (c >= 97 && c <= 122); }
int toupper(int c) {
if (!islower(c)) {
return c;
}
return c - 32;
}
int tolower(int c) {
if (!isupper(c)) {
return c;
}
return c + 32;
}
int isdigit(int c) { return (c >= 48 && c <= 57); }
int isalpha(int c) { return (c >= 65 && c <= 90) || (c >= 97 && c <= 122); }
int isalnum(int c) { return isalpha(c) | isdigit(c); }
int iscntrl(int c) { return (c <= 31) || (c == 127); }
int isprint(int c) { return (c >= 32 && c <= 126) || (c >= 128 && c <= 254); }
int isgraph(int c) { return isprint(c) && c != 32; }
int ispunct(int c) { return isgraph(c) && !isalnum(c); }
int isspace(int c) {
return (c == ' ') || (c == '\t') || (c == '\n') || (c == '\v') ||
(c == '\f') || (c == '\r');
}
int isxdigit(int c) {
return isdigit(c) || (c >= 65 && c <= 70) || (c >= 97 && c <= 102);
}