uc-sdk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ctype.h
Go to the documentation of this file.
1 #ifndef __CTYPE_H__
2 #define __CTYPE_H__
3 
4 static inline int isascii(int c) { return (c & 0x80) == 0; }
5 static inline int isblank(int c) { return c == ' ' || c == '\t'; }
6 static inline int isdigit(int c) { return c >= '0' && c <= '9'; }
7 static inline int iscntrl(int c) { return c < 32; }
8 static inline int islower(int c) { return c >= 'a' && c <= 'z'; }
9 static inline int isspace(int c) { return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v'; }
10 static inline int isupper(int c) { return c >= 'A' && c <= 'Z'; }
11 static inline int isxdigit(int c) { return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); }
12 
13 static inline int isalpha(int c) { return isupper(c) || islower(c); }
14 static inline int isalnum(int c) { return isalpha(c) || isdigit(c); }
15 static inline int isgraph(int c) { return !iscntrl(c) && !isspace(c); }
16 static inline int isprint(int c) { return !iscntrl(c); }
17 static inline int ispunct(int c) { return !iscntrl(c) && !isspace(c) && !isalnum(c); }
18 
19 static inline int toupper(int c) { return islower(c) ? c & ~0x20 : c; }
20 static inline int tolower(int c) { return isupper(c) ? c | 0x20 : c; }
21 
22 #endif