blob: b960bf5176ef7ad7b0de0e6d6e2c9351fd7542f2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
/*
Copyright 2021 Gabriel Jensen
This file is part of u8c.
u8c is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
u8c is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with u8c.
If not, see <https://www.gnu.org/licenses/>.
*/
# include <assert.h>
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
# include <u8c/isalpha.h>
bool u8c_isalpha(uint_least8_t * const _res,char32_t const _chr) {
assert(_res != NULL);
switch(_chr) {
default:
*_res = UINT8_C(0x0);
break;
case UINT32_C(0x61): /* LATIN SMALL LETTER A */
case UINT32_C(0x62): /* LATIN SMALL LETTER B */
case UINT32_C(0x63): /* LATIN SMALL LETTER C */
case UINT32_C(0x64): /* LATIN SMALL LETTER D */
case UINT32_C(0x65): /* LATIN SMALL LETTER E */
case UINT32_C(0x66): /* LATIN SMALL LETTER F */
case UINT32_C(0x67): /* LATIN SMALL LETTER G */
case UINT32_C(0x68): /* LATIN SMALL LETTER H */
case UINT32_C(0x69): /* LATIN SMALL LETTER I */
case UINT32_C(0x6A): /* LATIN SMALL LETTER J */
case UINT32_C(0x6B): /* LATIN SMALL LETTER K */
case UINT32_C(0x6C): /* LATIN SMALL LETTER L */
case UINT32_C(0x6D): /* LATIN SMALL LETTER M */
case UINT32_C(0x6E): /* LATIN SMALL LETTER N */
case UINT32_C(0x6F): /* LATIN SMALL LETTER O */
case UINT32_C(0x70): /* LATIN SMALL LETTER P */
case UINT32_C(0x71): /* LATIN SMALL LETTER Q */
case UINT32_C(0x72): /* LATIN SMALL LETTER R */
case UINT32_C(0x73): /* LATIN SMALL LETTER S */
case UINT32_C(0x74): /* LATIN SMALL LETTER T */
case UINT32_C(0x75): /* LATIN SMALL LETTER U */
case UINT32_C(0x76): /* LATIN SMALL LETTER V */
case UINT32_C(0x77): /* LATIN SMALL LETTER W */
case UINT32_C(0x78): /* LATIN SMALL LETTER X */
case UINT32_C(0x79): /* LATIN SMALL LETTER Y */
case UINT32_C(0x7A): /* LATIN SMALL LETTER Z */
case UINT32_C(0xDF): /* LATIN SMALL LETTER SHARP S */
case UINT32_C(0xE1): /* LATIN SMALL LETTER A WITH ACUTE */
case UINT32_C(0xE4): /* LATIN SMALL LETTER A WITH DIAERESIS */
case UINT32_C(0xE5): /* LATIN SMALL LETTER A WITH RING ABOVE */
case UINT32_C(0xE6): /* LATIN SMALL LETTER AE */
case UINT32_C(0xE7): /* LATIN SMALL LETTER C WITH CEDILLA */
case UINT32_C(0xE9): /* LATIN SMALL LETTER E WITH ACUTE */
case UINT32_C(0xED): /* LATIN SMALL LETTER I WITH ACUTE */
case UINT32_C(0xF0): /* LATIN SMALL LETTER ETH */
case UINT32_C(0xF3): /* LATIN SMALL LETTER O WITH ACUTE */
case UINT32_C(0xF6): /* LATIN SMALL LETTER O WITH DIAERESIS */
case UINT32_C(0xF8): /* LATIN SMALL LETTER O WITH STROKE */
case UINT32_C(0xFA): /* LATIN SMALL LETTER U WITH ACUTE */
case UINT32_C(0xFC): /* U WITH TWO DOTS */
case UINT32_C(0xFD): /* LATIN SMALL LETTER Y WITH ACUTE */
case UINT32_C(0xFE): /* LATIN SMALL LETTER THORN */
case UINT32_C(0x105): /* LATIN SMALL LETTER A WITH OGONEK */
case UINT32_C(0x107): /* LATIN SMALL LETTER C WITH ACUTE */
case UINT32_C(0x10D): /* LATIN SMALL LETTER C WITH CARON */
case UINT32_C(0x10F): /* LATIN SMALL LETTER D WITH CARON */
case UINT32_C(0x119): /* LATIN SMALL LETTER E WITH OGONEK */
case UINT32_C(0x11B): /* LATIN SMALL LETTER E WITH CARON */
case UINT32_C(0x11F): /* LATIN SMALL LETTER G WITH BREVE */
case UINT32_C(0x131): /* LATIN SMALL LETTER DOTLESS I */
case UINT32_C(0x133): /* LATIN SMALL LIGATURE LJ */
case UINT32_C(0x138): /* LATIN SMALL LETTER KRA */
case UINT32_C(0x142): /* LATIN SMALL LETTER L WITH STROKE */
case UINT32_C(0x144): /* LATIN SMALL LETTER N WITH ACUTE */
case UINT32_C(0x148): /* LATIN SMALL LETTER N WITH CARON */
case UINT32_C(0x14B): /* LATIN SMALL LETTER ENG */
case UINT32_C(0x153): /* LATIN SMALL LIGATURE OE */
case UINT32_C(0x159): /* LATIN SMALL LETTER R WITH CARON */
case UINT32_C(0x15B): /* LATIN SMALL LETTER S WITH ACUTE */
case UINT32_C(0x15F): /* LATIN SMALL LETTER S WITH CEDILLA */
case UINT32_C(0x161): /* LATIN SMALL LETTER S WITH CARON */
case UINT32_C(0x165): /* LATIN SMALL LETTER T WITH CARON */
case UINT32_C(0x16F): /* LATIN SMALL LETTER U WITH RING ABOVE */
case UINT32_C(0x17A): /* LATIN SMALL LETTER Z WITH ACUTE */
case UINT32_C(0x17C): /* LATIN SMALL LETTER Z WITH DOT ABOVE */
case UINT32_C(0x17E): /* LATIN SMALL LETTER Z WITH CARON */
case UINT32_C(0x1BF): /* LATIN LETTER WYNN */
case UINT32_C(0x1DD): /* LATIN SMALL LETTER TURNED E */
case UINT32_C(0x21D): /* LATIN SMALL LETTER YOGH */
case UINT32_C(0x251): /* LATIN SMALL LETTER ALPHA */
case UINT32_C(0x254): /* LATIN SMALL LETTER OPEN O */
case UINT32_C(0x259): /* LATIN SMALL LETTER SCHWA */
case UINT32_C(0x25B): /* LATIN SMALL LETTER OPEN E */
case UINT32_C(0x263): /* LATIN SMALL LETTER GAMMA */
case UINT32_C(0x269): /* LATIN SMALL LETTER IOTA */
case UINT32_C(0x283): /* LATIN SMALL LETTER ESH */
case UINT32_C(0x28A): /* LATIN SMALL LETTER UPSILON */
case UINT32_C(0x28B): /* LATIN SMALL LETTER V WITH HOOK */
case UINT32_C(0x292): /* LATIN SMALL LETTER EZH */
case UINT32_C(0x294): /* LATIN SMALL LETTER GLOTTAL STOP */
case UINT32_C(0x3B1): /* GREEK SMALL LETTER ALPHA */
case UINT32_C(0x3B2): /* GREEK SMALL LETTER BETA */
case UINT32_C(0x3B3): /* GREEK SMALL LETTER GAMMA */
case UINT32_C(0x3B4): /* GREEK SMALL LETTER DELTA */
case UINT32_C(0x3B5): /* GREEK SMALL LETTER EPSILON */
case UINT32_C(0x3B6): /* GREEK SMALL LETTER ZETA */
case UINT32_C(0x3B7): /* GREEK SMALL LETTER ETA */
case UINT32_C(0x3B8): /* GREEK SMALL LETTER THETA */
case UINT32_C(0x3B9): /* GREEK SMALL LETTER IOTA */
case UINT32_C(0x3BA): /* GREEK SMALL LETTER KAPPA */
case UINT32_C(0x3BB): /* GREEK SMALL LETTER LAMBDA */
case UINT32_C(0x3BC): /* GREEK SMALL LETTER MU */
case UINT32_C(0x3BD): /* GREEK SMALL LETTER NU */
case UINT32_C(0x3BE): /* GREEK SMALL LETTER XI */
case UINT32_C(0x3BF): /* GREEK SMALL LETTER OMICRON */
case UINT32_C(0x3C0): /* GREEK SMALL LETTER PI */
case UINT32_C(0x3C1): /* GREEK SMALL LETTER RHO */
case UINT32_C(0x3C2): /* GREEK SMALL LETTER FINAL SIGMA */
case UINT32_C(0x3C3): /* GREEK SMALL LETTER SIGMA */
case UINT32_C(0x3C4): /* GREEK SMALL LETTER TAU */
case UINT32_C(0x3C5): /* GREEK SMALL LETTER UPSILON */
case UINT32_C(0x3C6): /* GREEK SMALL LETTER PHI */
case UINT32_C(0x3C7): /* GREEK SMALL LETTER CHI */
case UINT32_C(0x3C8): /* GREEK SMALL LETTER PSI */
case UINT32_C(0x3C9): /* GREEK SMALL LETTER OMEGA */
case UINT32_C(0x1D79): /* LATIN SMALL LETTER INSULAR G */
case UINT32_C(0xA7B7): /* LATIN SMALL LETTER OMEGA */
case UINT32_C(0xFB00): /* LATIN SMALL LIGATURE FF */
*_res = UINT8_C(0x1);
break;
}
return false;
}
|