summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/include/ape/ctype.h2
-rw-r--r--sys/src/ape/lib/ap/gen/isalnum.c25
2 files changed, 16 insertions, 11 deletions
diff --git a/sys/include/ape/ctype.h b/sys/include/ape/ctype.h
index 1f36f4441..035c1821a 100644
--- a/sys/include/ape/ctype.h
+++ b/sys/include/ape/ctype.h
@@ -8,6 +8,7 @@ extern "C" {
extern int isalnum(int);
extern int isalpha(int);
+extern int isblank(int);
extern int iscntrl(int);
extern int isdigit(int);
extern int isgraph(int);
@@ -38,6 +39,7 @@ enum
extern unsigned char _ctype[];
#define isalnum(c) (_ctype[(unsigned char)(c)]&(_ISupper|_ISlower|_ISdigit))
#define isalpha(c) (_ctype[(unsigned char)(c)]&(_ISupper|_ISlower))
+#define isblank(c) (_ctype[(unsigned char)(c)]&_ISblank)
#define iscntrl(c) (_ctype[(unsigned char)(c)]&_IScntrl)
#define isdigit(c) (_ctype[(unsigned char)(c)]&_ISdigit)
#define isgraph(c) (_ctype[(unsigned char)(c)]&(_ISpunct|_ISupper|_ISlower|_ISdigit))
diff --git a/sys/src/ape/lib/ap/gen/isalnum.c b/sys/src/ape/lib/ap/gen/isalnum.c
index e1ab47cde..0cca9948b 100644
--- a/sys/src/ape/lib/ap/gen/isalnum.c
+++ b/sys/src/ape/lib/ap/gen/isalnum.c
@@ -2,6 +2,7 @@
#undef isalnum
#undef isalpha
+#undef isblank
#undef iscntrl
#undef isdigit
#undef isgraph
@@ -11,14 +12,16 @@
#undef isspace
#undef isupper
#undef isxdigit
-int isalnum(int c){ return (_ctype+1)[c]&(_ISupper|_ISlower|_ISdigit); }
-int isalpha(int c){ return (_ctype+1)[c]&(_ISupper|_ISlower); }
-int iscntrl(int c){ return (_ctype+1)[c]&_IScntrl; }
-int isdigit(int c){ return (_ctype+1)[c]&_ISdigit; }
-int isgraph(int c){ return (_ctype+1)[c]&(_ISpunct|_ISupper|_ISlower|_ISdigit); }
-int islower(int c){ return (_ctype+1)[c]&_ISlower; }
-int isprint(int c){ return (_ctype+1)[c]&(_ISpunct|_ISupper|_ISlower|_ISdigit|_ISblank); }
-int ispunct(int c){ return (_ctype+1)[c]&_ISpunct; }
-int isspace(int c){ return (_ctype+1)[c]&_ISspace; }
-int isupper(int c){ return (_ctype+1)[c]&_ISupper; }
-int isxdigit(int c){ return (_ctype+1)[c]&_ISxdigit; }
+
+int isalnum(int c) {return _ctype[(unsigned char)(c)]&(_ISupper|_ISlower|_ISdigit);}
+int isalpha(int c) {return _ctype[(unsigned char)(c)]&(_ISupper|_ISlower);}
+int isblank(int c) {return _ctype[(unsigned char)(c)]&_ISblank;}
+int iscntrl(int c) {return _ctype[(unsigned char)(c)]&_IScntrl;}
+int isdigit(int c) {return _ctype[(unsigned char)(c)]&_ISdigit;}
+int isgraph(int c) {return _ctype[(unsigned char)(c)]&(_ISpunct|_ISupper|_ISlower|_ISdigit);}
+int islower(int c) {return _ctype[(unsigned char)(c)]&_ISlower;}
+int isprint(int c) {return _ctype[(unsigned char)(c)]&(_ISpunct|_ISupper|_ISlower|_ISdigit|_ISblank);}
+int ispunct(int c) {return _ctype[(unsigned char)(c)]&_ISpunct;}
+int isspace(int c) {return _ctype[(unsigned char)(c)]&_ISspace;}
+int isupper(int c) {return _ctype[(unsigned char)(c)]&_ISupper;}
+int isxdigit(int c) {return _ctype[(unsigned char)(c)]&_ISxdigit;}