summaryrefslogtreecommitdiff
path: root/libc/include/ctype.h
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2011-02-05 04:35:27 +0100
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2011-02-05 04:35:27 +0100
commit61ba39a23786a7ae9694705af1d146c00a319144 (patch)
treef9ad51bee751f7e878ac3e7ad4d45f993605c37d /libc/include/ctype.h
parente2d292afdb43cd7d9391128563384e1edd53c52e (diff)
Getting rid of newlib, starting to implement a libc. Highly experimental, highly untested.
Diffstat (limited to 'libc/include/ctype.h')
-rw-r--r--libc/include/ctype.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/libc/include/ctype.h b/libc/include/ctype.h
new file mode 100644
index 0000000..22e3e81
--- /dev/null
+++ b/libc/include/ctype.h
@@ -0,0 +1,20 @@
+#ifndef __CTYPE_H__
+#define __CTYPE_H__
+
+static inline int isascii(int c) { return (c & 0x80) == 0; }
+static inline int isblank(int c) { return c == ' ' || c == '\t'; }
+static inline int isdigit(int c) { return c >= '0' && c <= '9'; }
+static inline int iscntrl(int c) { return c < 32; }
+static inline int islower(int c) { return c >= 'a' && c <= 'z'; }
+static inline int isspace(int c) { return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v'; }
+static inline int isupper(int c) { return c >= 'A' && c <= 'Z'; }
+static inline int isxdigit(int c) { return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); }
+
+static inline int isalpha(int c) { return isupper(c) || islower(c); }
+static inline int isalnum(int c) { return isalpha(c) || isdigit(c); }
+static inline int isgraph(int c) { return !iscntrl(c) && !isspace(c); }
+static inline int isprint(int c) { return !iscntrl(c); }
+static inline int ispunct(int c) { return !iscntrl(c) && !isspace(c) && !isalnum(c); }
+
+
+#endif