75 lines
1.5 KiB
C
75 lines
1.5 KiB
C
#ifndef _FAKELIBC_CTYPE_H
|
|
#define _FAKELIBC_CTYPE_H
|
|
/*
|
|
#define isspace fake_isspace
|
|
#define isdigit fake_isdigit
|
|
#define isxdigit fake_isxdigit
|
|
#define isalpha fake_isalpha
|
|
#define isalnum fake_isalnum
|
|
#define isprint fake_isprint
|
|
#define ispunct fake_ispunct
|
|
|
|
static int fake_isspace(int ch) {
|
|
return (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n');
|
|
}
|
|
|
|
static int fake_isdigit(int ch) {
|
|
return (ch >= '0') && (ch <= '9');
|
|
}
|
|
|
|
static int fake_isxdigit(int ch) {
|
|
return isdigit(ch) || ((ch >= 'a') && (ch <= 'f')) || ((ch >= 'A') && (ch <= 'F'));
|
|
}
|
|
|
|
static int fake_isalpha(int ch) {
|
|
return ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z'));
|
|
}
|
|
|
|
static int fake_isalnum(int ch) {
|
|
return isalpha(ch) || isdigit(ch);
|
|
}
|
|
|
|
static int fake_isprint(int ch) {
|
|
return isalnum(ch) || isspace(ch) || ispunct(ch);
|
|
}
|
|
|
|
static int fake_ispunct(int ch) {
|
|
switch (ch) {
|
|
case ',':
|
|
case '<':
|
|
case '.':
|
|
case '>':
|
|
case '/':
|
|
case '?':
|
|
case ';':
|
|
case ':':
|
|
case '\'':
|
|
case '\"':
|
|
case '[':
|
|
case ']':
|
|
case '{':
|
|
case '}':
|
|
case '`':
|
|
case '~':
|
|
case '@':
|
|
case '#':
|
|
case '$':
|
|
case '%':
|
|
case '^':
|
|
case '&':
|
|
case '*':
|
|
case '(':
|
|
case ')':
|
|
case '-':
|
|
case '_':
|
|
case '=':
|
|
case '+':
|
|
return 1;
|
|
default:
|
|
return 0;
|
|
}
|
|
}
|
|
*/
|
|
/* From ifndef at top of file: */
|
|
#endif
|