Graphviz 12.0.1~dev.20240715.2254
Loading...
Searching...
No Matches
gv_ctype.h
Go to the documentation of this file.
1
20
21#pragma once
22
23#include <stdbool.h>
24
25static inline bool gv_islower(int c) { return c >= 'a' && c <= 'z'; }
26
27static inline bool gv_isupper(int c) { return c >= 'A' && c <= 'Z'; }
28
29static inline bool gv_isalpha(int c) { return gv_islower(c) || gv_isupper(c); }
30
31static inline bool gv_isblank(int c) { return c == ' ' || c == '\t'; };
32
33static inline bool gv_iscntrl(int c) {
34 if (c >= 0 && c <= 31)
35 return true;
36 if (c == 127)
37 return true;
38 return false;
39}
40
41static inline bool gv_isdigit(int c) { return c >= '0' && c <= '9'; }
42
43static inline bool gv_isalnum(int c) { return gv_isalpha(c) || gv_isdigit(c); }
44
45static inline bool gv_isgraph(int c) { return c > 32 && c < 127; }
46
47static inline bool gv_isprint(int c) { return c > 31 && c < 127; }
48
49static inline bool gv_ispunct(int c) {
50 if (gv_isalnum(c))
51 return false;
52 return c > 32 && c < 127;
53}
54
55static inline bool gv_isspace(int c) {
56 if (c == '\t')
57 return true;
58 if (c == '\n')
59 return true;
60 if (c == '\v')
61 return true;
62 if (c == '\f')
63 return true;
64 if (c == '\r')
65 return true;
66 if (c == ' ')
67 return true;
68 return false;
69}
70
71static inline bool gv_isxdigit(int c) {
72 if (gv_isdigit(c))
73 return true;
74 if (c >= 'A' && c <= 'F')
75 return true;
76 if (c >= 'a' && c <= 'f')
77 return true;
78 return false;
79}
80
81static inline char gv_tolower(int c) {
82 if (gv_isupper(c))
83 return (char)c - 'A' + 'a';
84 return (char)c;
85}
86
87static inline void gv_tolower_str(char *s) {
88 for (; *s != '\0'; ++s) {
89 *s = gv_tolower(*s);
90 }
91}
92
93static inline char gv_toupper(int c) {
94 if (gv_islower(c))
95 return (char)c - 'a' + 'A';
96 return (char)c;
97}
98
99static inline void gv_toupper_str(char *s) {
100 for (; *s != '\0'; ++s) {
101 *s = gv_toupper(*s);
102 }
103}
static char gv_toupper(int c)
Definition gv_ctype.h:93
static bool gv_isgraph(int c)
Definition gv_ctype.h:45
static char gv_tolower(int c)
Definition gv_ctype.h:81
static void gv_tolower_str(char *s)
Definition gv_ctype.h:87
static bool gv_islower(int c)
Definition gv_ctype.h:25
static bool gv_isxdigit(int c)
Definition gv_ctype.h:71
static bool gv_isupper(int c)
Definition gv_ctype.h:27
static bool gv_isalnum(int c)
Definition gv_ctype.h:43
static void gv_toupper_str(char *s)
Definition gv_ctype.h:99
static bool gv_iscntrl(int c)
Definition gv_ctype.h:33
static bool gv_isblank(int c)
Definition gv_ctype.h:31
static bool gv_isdigit(int c)
Definition gv_ctype.h:41
static bool gv_isalpha(int c)
Definition gv_ctype.h:29
static bool gv_isprint(int c)
Definition gv_ctype.h:47
static bool gv_isspace(int c)
Definition gv_ctype.h:55
static bool gv_ispunct(int c)
Definition gv_ctype.h:49
Definition grammar.c:93