Branch data Line data Source code
1 : : /* ctype.h */ 2 : : 3 : : /* 4 : : * Copyright (c) 2015 Intel Corporation. 5 : : * 6 : : * SPDX-License-Identifier: Apache-2.0 7 : : */ 8 : : 9 : : #ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_CTYPE_H_ 10 : : #define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_CTYPE_H_ 11 : : 12 : : #ifdef __cplusplus 13 : : extern "C" { 14 : : #endif 15 : : 16 : 119887 : static inline int isupper(int a) 17 : : { 18 : 119887 : return (int)(((unsigned)(a)-(unsigned)'A') < 26U); 19 : : } 20 : : 21 : 0 : static inline int isalpha(int c) 22 : : { 23 : 0 : return (int)((((unsigned)c|32u)-(unsigned)'a') < 26U); 24 : : } 25 : : 26 : 0 : static inline int isspace(int c) 27 : : { 28 [ # # # # ]: 0 : return (int)(c == (int)' ' || ((unsigned)c-(unsigned)'\t') < 5U); 29 : : } 30 : : 31 : : static inline int isgraph(int c) 32 : : { 33 : : return (int)((((unsigned)c) > ' ') && 34 : : (((unsigned)c) <= (unsigned)'~')); 35 : : } 36 : : 37 : 0 : static inline int isprint(int c) 38 : : { 39 [ # # ]: 0 : return (int)((((unsigned)c) >= ' ') && 40 [ # # ]: 0 : (((unsigned)c) <= (unsigned)'~')); 41 : : } 42 : : 43 : 253403 : static inline int isdigit(int a) 44 : : { 45 : 253403 : return (int)(((unsigned)(a)-(unsigned)'0') < 10U); 46 : : } 47 : : 48 : : static inline int isxdigit(int a) 49 : : { 50 : : unsigned int ua = (unsigned int)a; 51 : : 52 : : return (int)(((ua - (unsigned)'0') < 10U) || 53 : : ((ua | 32U) - (unsigned)'a' < 6U)); 54 : : } 55 : : 56 : 0 : static inline int tolower(int chr) 57 : : { 58 [ # # # # ]: 0 : return (chr >= (int)'A' && chr <= (int)'Z') ? (chr + 32) : (chr); 59 : : } 60 : : 61 : : static inline int toupper(int chr) 62 : : { 63 : : return (int)((chr >= (int)'a' && chr <= 64 : : (int)'z') ? (chr - 32) : (chr)); 65 : : } 66 : : 67 : : static inline int isalnum(int chr) 68 : : { 69 : : return (int)(isalpha(chr) || isdigit(chr)); 70 : : } 71 : : 72 : : static inline int iscntrl(int c) 73 : : { 74 : : return (int)((((unsigned int)c) <= 31U) || (((unsigned int)c) == 127U)); 75 : : } 76 : : 77 : : #ifdef __cplusplus 78 : : } 79 : : #endif 80 : : 81 : : #endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_CTYPE_H_ */