#include <stdint.h>
Go to the source code of this file.
|
int | runetochar (char *s, const Rune *r) |
|
int | chartorune (Rune *r, const char *s) |
|
int | charntorune (Rune *r, const char *s, int n) |
|
int | isvalidcharntorune (const char *str, int n, Rune *r, int *consumed) |
|
int | runelen (Rune r) |
|
int | runenlen (const Rune *r, int n) |
|
int | fullrune (const char *s, int n) |
|
int | utflen (const char *s) |
|
int | utfnlen (const char *s, long n) |
|
const char * | utfrune (const char *s, Rune r) |
|
const char * | utfrrune (const char *s, Rune r) |
|
const char * | utfutf (const char *s1, const char *s2) |
|
char * | utfecpy (char *s1, char *es1, const char *s2) |
|
Rune * | runestrcat (Rune *s1, const Rune *s2) |
|
Rune * | runestrncat (Rune *s1, const Rune *s2, long n) |
|
const Rune * | runestrchr (const Rune *s, Rune c) |
|
int | runestrcmp (const Rune *s1, const Rune *s2) |
|
int | runestrncmp (const Rune *s1, const Rune *s2, long n) |
|
Rune * | runestrcpy (Rune *s1, const Rune *s2) |
|
Rune * | runestrncpy (Rune *s1, const Rune *s2, long n) |
|
Rune * | runestrecpy (Rune *s1, Rune *es1, const Rune *s2) |
|
Rune * | runestrdup (const Rune *s) |
|
const Rune * | runestrrchr (const Rune *s, Rune c) |
|
long | runestrlen (const Rune *s) |
|
const Rune * | runestrstr (const Rune *s1, const Rune *s2) |
|
Rune | toupperrune (Rune r) |
|
Rune | tolowerrune (Rune r) |
|
Rune | totitlerune (Rune r) |
|
int | isupperrune (Rune r) |
|
int | islowerrune (Rune r) |
|
int | istitlerune (Rune r) |
|
int | isalpharune (Rune r) |
|
int | isdigitrune (Rune r) |
|
int | isideographicrune (Rune r) |
|
int | isspacerune (Rune r) |
|
◆ Rune
Definition at line 19 of file utf.h.
◆ anonymous enum
Enumerator |
---|
UTFmax | |
Runesync | |
Runeself | |
Runeerror | |
Runemax | |
Definition at line 21 of file utf.h.
◆ charntorune()
int charntorune |
( |
Rune * |
r, |
|
|
const char * |
s, |
|
|
int |
n |
|
) |
| |
Definition at line 64 of file rune.c.
64 {
65 int c, c1, c2, c3;
66 long l;
67
68
69 if (length <= 0) {
70 goto badlen;
71 }
72
73
74
75
76
79 *rune = c;
80 return 1;
81 }
82
83
84 if (length <= 1) {
85 goto badlen;
86 }
87
88
89
90
91
94 goto bad;
97 goto bad;
100 goto bad;
101 *rune = l;
102 return 2;
103 }
104
105
106 if (length <= 2) {
107 goto badlen;
108 }
109
110
111
112
113
116 goto bad;
120 goto bad;
121 *rune = l;
122 return 3;
123 }
124
125 if (length <= 3)
126 goto badlen;
127
128
129
130
131
134 goto bad;
138 goto bad;
140 goto bad;
141 *rune = l;
142 return 4;
143 }
144
145
146
147
148
149
150
151bad:
153 return 1;
154badlen:
156 return 0;
157}
◆ chartorune()
int chartorune |
( |
Rune * |
r, |
|
|
const char * |
s |
|
) |
| |
Definition at line 163 of file rune.c.
163 {
164 int c, c1, c2, c3;
165 long l;
166
167
168
169
170
173 *rune = c;
174 return 1;
175 }
176
177
178
179
180
183 goto bad;
186 goto bad;
189 goto bad;
190 *rune = l;
191 return 2;
192 }
193
194
195
196
197
200 goto bad;
204 goto bad;
205 *rune = l;
206 return 3;
207 }
208
209
210
211
212
215 goto bad;
219 goto bad;
221 goto bad;
222 *rune = l;
223 return 4;
224 }
225
226
227
228
229
230
231
232
233
234bad:
236 return 1;
237}
◆ fullrune()
int fullrune |
( |
const char * |
s, |
|
|
int |
n |
|
) |
| |
Definition at line 326 of file rune.c.
326 {
327 if (n > 0) {
328 int c = *(
uchar *)str;
330 return 1;
331 if (n > 1) {
333 return 1;
334 if (n > 2) {
335 if (c < T4 || n > 3)
336 return 1;
337 }
338 }
339 }
340 return 0;
341}
◆ isalpharune()
int isalpharune |
( |
Rune |
r | ) |
|
◆ isdigitrune()
int isdigitrune |
( |
Rune |
r | ) |
|
◆ isideographicrune()
int isideographicrune |
( |
Rune |
r | ) |
|
◆ islowerrune()
int islowerrune |
( |
Rune |
r | ) |
|
◆ isspacerune()
int isspacerune |
( |
Rune |
r | ) |
|
◆ istitlerune()
int istitlerune |
( |
Rune |
r | ) |
|
◆ isupperrune()
int isupperrune |
( |
Rune |
r | ) |
|
◆ isvalidcharntorune()
int isvalidcharntorune |
( |
const char * |
str, |
|
|
int |
n, |
|
|
Rune * |
r, |
|
|
int * |
consumed |
|
) |
| |
Definition at line 239 of file rune.c.
239 {
241 return *rune !=
Runeerror || *consumed == 3;
242}
int charntorune(Rune *rune, const char *str, int length)
◆ runelen()
Definition at line 299 of file rune.c.
299 {
300 char str[10];
301
303}
int runetochar(char *str, const Rune *rune)
◆ runenlen()
int runenlen |
( |
const Rune * |
r, |
|
|
int |
n |
|
) |
| |
Definition at line 305 of file rune.c.
305 {
306 int nb;
308
309 nb = 0;
310 while (nrune--) {
311 c = *r++;
313 nb++;
315 nb += 2;
317 nb += 3;
319 nb += 4;
320 else
321 nb += 3;
322 }
323 return nb;
324}
◆ runestrcat()
◆ runestrchr()
◆ runestrcmp()
int runestrcmp |
( |
const Rune * |
s1, |
|
|
const Rune * |
s2 |
|
) |
| |
◆ runestrcpy()
◆ runestrdup()
◆ runestrecpy()
◆ runestrlen()
long runestrlen |
( |
const Rune * |
s | ) |
|
◆ runestrncat()
◆ runestrncmp()
int runestrncmp |
( |
const Rune * |
s1, |
|
|
const Rune * |
s2, |
|
|
long |
n |
|
) |
| |
◆ runestrncpy()
◆ runestrrchr()
◆ runestrstr()
const Rune * runestrstr |
( |
const Rune * |
s1, |
|
|
const Rune * |
s2 |
|
) |
| |
◆ runetochar()
int runetochar |
( |
char * |
s, |
|
|
const Rune * |
r |
|
) |
| |
Definition at line 244 of file rune.c.
244 {
245
246 unsigned long c;
247
248
249
250
251
252 c = *rune;
254 str[0] = c;
255 return 1;
256 }
257
258
259
260
261
263 str[0] =
T2 | (c >> 1 *
Bitx);
265 return 2;
266 }
267
268
269
270
271
272
273
276
277
278
279
280
282 str[0] =
T3 | (c >> 2 *
Bitx);
285 return 3;
286 }
287
288
289
290
291
292 str[0] =
T4 | (c >> 3 *
Bitx);
296 return 4;
297}
◆ tolowerrune()
◆ totitlerune()
◆ toupperrune()
◆ utfecpy()
char * utfecpy |
( |
char * |
s1, |
|
|
char * |
es1, |
|
|
const char * |
s2 |
|
) |
| |
◆ utflen()
int utflen |
( |
const char * |
s | ) |
|
◆ utfnlen()
int utfnlen |
( |
const char * |
s, |
|
|
long |
n |
|
) |
| |
◆ utfrrune()
const char * utfrrune |
( |
const char * |
s, |
|
|
Rune |
r |
|
) |
| |
◆ utfrune()
const char * utfrune |
( |
const char * |
s, |
|
|
Rune |
r |
|
) |
| |
◆ utfutf()
const char * utfutf |
( |
const char * |
s1, |
|
|
const char * |
s2 |
|
) |
| |