From 61ba39a23786a7ae9694705af1d146c00a319144 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Sat, 5 Feb 2011 04:35:27 +0100 Subject: Getting rid of newlib, starting to implement a libc. Highly experimental, highly untested. --- libc/include/ctype.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 libc/include/ctype.h (limited to 'libc/include/ctype.h') 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 -- cgit v1.2.3