Changeset 67ca359 in mainline
- Timestamp:
- 2019-02-02T17:05:56Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a5c78a18
- Parents:
- 92244ed
- Location:
- uspace/lib/c
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
r92244ed r67ca359 53 53 generic/context.c \ 54 54 generic/corecfg.c \ 55 generic/ctype.c \ 55 56 generic/devman.c \ 56 57 generic/device/hw_res.c \ -
uspace/lib/c/include/ctype.h
r92244ed r67ca359 27 27 */ 28 28 29 /** @addtogroup libc30 * @{31 */32 /** @file33 */34 35 29 #ifndef LIBC_CTYPE_H_ 36 30 #define LIBC_CTYPE_H_ 37 31 38 static inline int islower(int c) 39 { 40 return ((c >= 'a') && (c <= 'z')); 41 } 42 43 static inline int isupper(int c) 44 { 45 return ((c >= 'A') && (c <= 'Z')); 46 } 47 48 static inline int isalpha(int c) 49 { 50 return (islower(c) || isupper(c)); 51 } 52 53 static inline int isdigit(int c) 54 { 55 return ((c >= '0') && (c <= '9')); 56 } 57 58 static inline int isalnum(int c) 59 { 60 return (isalpha(c) || isdigit(c)); 61 } 62 63 static inline int isblank(int c) 64 { 65 return c == ' ' || c == '\t'; 66 } 67 68 static inline int iscntrl(int c) 69 { 70 return (c >= 0 && c < 0x20) || c == 0x7E; 71 } 72 73 static inline int isprint(int c) 74 { 75 return c >= 0 && c < 0x80 && !iscntrl(c); 76 } 77 78 static inline int isgraph(int c) 79 { 80 return isprint(c) && c != ' '; 81 } 82 83 static inline int isspace(int c) 84 { 85 switch (c) { 86 case ' ': 87 case '\n': 88 case '\t': 89 case '\f': 90 case '\r': 91 case '\v': 92 return 1; 93 break; 94 default: 95 return 0; 96 } 97 } 98 99 static inline int ispunct(int c) 100 { 101 return !isspace(c) && !isalnum(c) && isprint(c); 102 } 103 104 static inline int isxdigit(int c) 105 { 106 return isdigit(c) || 107 (c >= 'a' && c <= 'f') || 108 (c >= 'A' && c <= 'F'); 109 } 110 111 static inline int tolower(int c) 112 { 113 if (isupper(c)) 114 return (c + ('a' - 'A')); 115 else 116 return c; 117 } 118 119 static inline int toupper(int c) 120 { 121 if (islower(c)) 122 return (c + ('A' - 'a')); 123 else 124 return c; 125 } 32 int islower(int); 33 int isupper(int); 34 int isalpha(int); 35 int isdigit(int); 36 int isalnum(int); 37 int isblank(int); 38 int iscntrl(int); 39 int isprint(int); 40 int isgraph(int); 41 int isspace(int); 42 int ispunct(int); 43 int isxdigit(int); 44 int tolower(int); 45 int toupper(int); 126 46 127 47 #endif 128 129 /** @}130 */
Note:
See TracChangeset
for help on using the changeset viewer.