75 lines
2.3 KiB
C
75 lines
2.3 KiB
C
|
|
#include <ctype.h>
|
|
|
|
#define NONE 0x00
|
|
#define ALPHA 0x01
|
|
#define DIGIT 0x02
|
|
#define LOWER 0x04
|
|
#define UPPER 0x08
|
|
#define SPECL 0x10
|
|
#define SPACE 0x20
|
|
#define PUNCT 0x40
|
|
#define GRAPH 0x80
|
|
|
|
// TODO.
|
|
static unsigned char tab[256] = {
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
|
|
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
|
|
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
|
|
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
|
|
NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE
|
|
};
|
|
|
|
int isalnum(int c) {
|
|
return tab[c & 0xFF] & (ALPHA | DIGIT);
|
|
}
|
|
|
|
int isalpha(int c) {
|
|
return tab[c & 0xFF] & ALPHA;
|
|
}
|
|
|
|
int islower(int c) {
|
|
return tab[c & 0xFF] & LOWER;
|
|
}
|
|
|
|
int isupper(int c) {
|
|
return tab[c & 0xFF] & UPPER;
|
|
}
|
|
|
|
int isdigit(int c) {
|
|
return tab[c & 0xFF] & DIGIT;
|
|
}
|
|
|
|
int isspecl(int c) {
|
|
return tab[c & 0xFF] & SPECL;
|
|
}
|
|
|
|
int isspace(int c) {
|
|
return tab[c & 0xFF] & SPACE;
|
|
}
|
|
|
|
int ispunct(int c) {
|
|
return tab[c & 0xFF] & PUNCT;
|
|
}
|
|
|
|
int isgraph(int c) {
|
|
return tab[c & 0xFF] & GRAPH;
|
|
}
|
|
|
|
|
|
|