Zephyr API Documentation 4.3.99
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 (('A' <= a) && (a <= 'Z'));
19}
20
21static inline int isalpha(int c)
22{
23 /* force to lowercase */
24 c |= 32;
25
26 return (('a' <= c) && (c <= 'z'));
27}
28
29static inline int isblank(int c)
30{
31 return ((c == ' ') || (c == '\t'));
32}
33
34static inline int isspace(int c)
35{
36 return ((c == ' ') || (('\t' <= c) && (c <= '\r')));
37}
38
39static inline int isgraph(int c)
40{
41 return ((' ' < c) && (c <= '~'));
42}
43
44static inline int isprint(int c)
45{
46 return ((' ' <= c) && (c <= '~'));
47}
48
49static inline int isdigit(int a)
50{
51 return (('0' <= a) && (a <= '9'));
52}
53
54static inline int islower(int c)
55{
56 return (('a' <= c) && (c <= 'z'));
57}
58
59static inline int isxdigit(int a)
60{
61 if (isdigit(a) != 0) {
62 return 1;
63 }
64
65 /* force to lowercase */
66 a |= 32;
67
68 return (('a' <= a) && (a <= 'f'));
69}
70
71static inline int tolower(int chr)
72{
73 return (chr >= 'A' && chr <= 'Z') ? (chr + 32) : (chr);
74}
75
76static inline int toupper(int chr)
77{
78 return ((chr >= 'a' && chr <= 'z') ? (chr - 32) : (chr));
79}
80
81static inline int isalnum(int chr)
82{
83 return (isalpha(chr) || isdigit(chr));
84}
85
86static inline int ispunct(int c)
87{
88 return (isgraph(c) && !isalnum(c));
89}
90
91static inline int iscntrl(int c)
92{
93 return ((((unsigned int)c) <= 31U) || (((unsigned int)c) == 127U));
94}
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_CTYPE_H_ */
static int isxdigit(int a)
Definition ctype.h:59
static int isupper(int a)
Definition ctype.h:16
static int islower(int c)
Definition ctype.h:54
static int iscntrl(int c)
Definition ctype.h:91
static int isdigit(int a)
Definition ctype.h:49
static int isgraph(int c)
Definition ctype.h:39
static int isspace(int c)
Definition ctype.h:34
static int isblank(int c)
Definition ctype.h:29
static int isprint(int c)
Definition ctype.h:44
static int isalpha(int c)
Definition ctype.h:21
static int tolower(int chr)
Definition ctype.h:71
static int ispunct(int c)
Definition ctype.h:86
static int toupper(int chr)
Definition ctype.h:76
static int isalnum(int chr)
Definition ctype.h:81