Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ctype.h
Go to the documentation of this file.
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
13extern "C" {
14#endif
15
16static inline int isupper(int a)
17{
18 return (int)(((unsigned)(a)-(unsigned)'A') < 26U);
19}
20
21static inline int isalpha(int c)
22{
23 return (int)((((unsigned)c|32u)-(unsigned)'a') < 26U);
24}
25
26static inline int isspace(int c)
27{
28 return (int)(c == (int)' ' || ((unsigned)c-(unsigned)'\t') < 5U);
29}
30
31static inline int isgraph(int c)
32{
33 return (int)((((unsigned)c) > ' ') &&
34 (((unsigned)c) <= (unsigned)'~'));
35}
36
37static inline int isprint(int c)
38{
39 return (int)((((unsigned)c) >= ' ') &&
40 (((unsigned)c) <= (unsigned)'~'));
41}
42
43static inline int isdigit(int a)
44{
45 return (int)(((unsigned)(a)-(unsigned)'0') < 10U);
46}
47
48static 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
56static inline int tolower(int chr)
57{
58 return (chr >= (int)'A' && chr <= (int)'Z') ? (chr + 32) : (chr);
59}
60
61static inline int toupper(int chr)
62{
63 return (int)((chr >= (int)'a' && chr <=
64 (int)'z') ? (chr - 32) : (chr));
65}
66
67static inline int isalnum(int chr)
68{
69 return (int)(isalpha(chr) || isdigit(chr));
70}
71
72static 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_ */
static int isxdigit(int a)
Definition ctype.h:48
static int isupper(int a)
Definition ctype.h:16
static int iscntrl(int c)
Definition ctype.h:72
static int isdigit(int a)
Definition ctype.h:43
static int isgraph(int c)
Definition ctype.h:31
static int isspace(int c)
Definition ctype.h:26
static int isprint(int c)
Definition ctype.h:37
static int isalpha(int c)
Definition ctype.h:21
static int tolower(int chr)
Definition ctype.h:56
static int toupper(int chr)
Definition ctype.h:61
static int isalnum(int chr)
Definition ctype.h:67
#define unsigned
Definition types.h:27
char c
Definition printk.c:169