Changeset dbbbe75b in mainline
- Timestamp:
- 2018-01-15T21:54:21Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8348846
- Parents:
- c718bda
- Location:
- uspace/lib
- Files:
-
- 6 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/ctype.h
rc718bda rdbbbe75b 61 61 } 62 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 63 83 static inline int isspace(int c) 64 84 { … … 75 95 return 0; 76 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'); 77 109 } 78 110 -
uspace/lib/posix/include/posix/ctype.h
rc718bda rdbbbe75b 43 43 #include "libc/ctype.h" 44 44 45 /* Classification of Characters */ 46 extern int __POSIX_DEF__(isxdigit)(int c); 47 extern int __POSIX_DEF__(isblank)(int c); 48 extern int __POSIX_DEF__(iscntrl)(int c); 49 extern int __POSIX_DEF__(isgraph)(int c); 50 extern int __POSIX_DEF__(isprint)(int c); 51 extern int __POSIX_DEF__(ispunct)(int c); 45 /* Obsolete Functions and Macros */ 46 extern int isascii(int c); 47 extern int toascii(int c); 52 48 53 /* Obsolete Functions and Macros */54 extern int __POSIX_DEF__(isascii)(int c);55 extern int __POSIX_DEF__(toascii)(int c);56 #undef _tolower57 49 #define _tolower(c) ((c) - 'A' + 'a') 58 #undef _toupper59 50 #define _toupper(c) ((c) - 'a' + 'A') 60 61 62 51 63 52 #endif /* POSIX_CTYPE_H_ */ -
uspace/lib/posix/source/ctype.c
rc718bda rdbbbe75b 34 34 */ 35 35 36 #define LIBPOSIX_INTERNAL37 #define __POSIX_DEF__(x) posix_##x38 39 36 #include "posix/ctype.h" 40 41 /**42 * Checks whether character is a hexadecimal digit.43 *44 * @param c Character to inspect.45 * @return Non-zero if character match the definition, zero otherwise.46 */47 int posix_isxdigit(int c)48 {49 return isdigit(c) ||50 (c >= 'a' && c <= 'f') ||51 (c >= 'A' && c <= 'F');52 }53 54 /**55 * Checks whether character is a word separator.56 *57 * @param c Character to inspect.58 * @return Non-zero if character match the definition, zero otherwise.59 */60 int posix_isblank(int c)61 {62 return c == ' ' || c == '\t';63 }64 65 /**66 * Checks whether character is a control character.67 *68 * @param c Character to inspect.69 * @return Non-zero if character match the definition, zero otherwise.70 */71 int posix_iscntrl(int c)72 {73 return c < 0x20 || c == 0x7E;74 }75 76 /**77 * Checks whether character is any printing character except space.78 *79 * @param c Character to inspect.80 * @return Non-zero if character match the definition, zero otherwise.81 */82 int posix_isgraph(int c)83 {84 return posix_isprint(c) && c != ' ';85 }86 87 /**88 * Checks whether character is a printing character.89 *90 * @param c Character to inspect.91 * @return Non-zero if character match the definition, zero otherwise.92 */93 int posix_isprint(int c)94 {95 return posix_isascii(c) && !posix_iscntrl(c);96 }97 98 /**99 * Checks whether character is a punctuation.100 *101 * @param c Character to inspect.102 * @return Non-zero if character match the definition, zero otherwise.103 */104 int posix_ispunct(int c)105 {106 return !isspace(c) && !isalnum(c) && posix_isprint(c);107 }108 37 109 38 /** … … 113 42 * @return Non-zero if character match the definition, zero otherwise. 114 43 */ 115 int posix_isascii(int c)44 int isascii(int c) 116 45 { 117 46 return c >= 0 && c < 128; … … 124 53 * @return Coverted character. 125 54 */ 126 int posix_toascii(int c)55 int toascii(int c) 127 56 { 128 57 return c & 0x7F; -
uspace/lib/posix/source/fnmatch.c
rc718bda rdbbbe75b 183 183 { "alnum", isalnum }, 184 184 { "alpha", isalpha }, 185 { "blank", posix_isblank },186 { "cntrl", posix_iscntrl },185 { "blank", isblank }, 186 { "cntrl", iscntrl }, 187 187 { "digit", isdigit }, 188 { "graph", posix_isgraph },188 { "graph", isgraph }, 189 189 { "lower", islower }, 190 { "print", posix_isprint },191 { "punct", posix_ispunct },190 { "print", isprint }, 191 { "punct", ispunct }, 192 192 { "space", isspace }, 193 193 { "upper", isupper }, 194 { "xdigit", posix_isxdigit }194 { "xdigit", isxdigit } 195 195 }; 196 196 -
uspace/lib/posix/source/stdlib/strtold.c
rc718bda rdbbbe75b 347 347 bool after_decimal = false; 348 348 349 while ( posix_isxdigit(*str) || (!after_decimal && *str == DECIMAL_POINT)) {349 while (isxdigit(*str) || (!after_decimal && *str == DECIMAL_POINT)) { 350 350 if (*str == DECIMAL_POINT) { 351 351 after_decimal = true; … … 459 459 /* check for a hex number */ 460 460 if (nptr[i] == '0' && tolower(nptr[i + 1]) == 'x' && 461 ( posix_isxdigit(nptr[i + 2]) ||462 (nptr[i + 2] == RADIX && posix_isxdigit(nptr[i + 3])))) {461 (isxdigit(nptr[i + 2]) || 462 (nptr[i + 2] == RADIX && isxdigit(nptr[i + 3])))) { 463 463 i += 2; 464 464 -
uspace/lib/uri/uri.c
rc718bda rdbbbe75b 42 42 43 43 #include "uri.h" 44 #include " ctype.h"44 #include "internal/ctype.h" 45 45 46 46 static char *cut_str(const char *start, const char *end)
Note:
See TracChangeset
for help on using the changeset viewer.