utf.h (936B)
1 /* See LICENSE file for copyright and license details. */ 2 #ifndef UTF_H 3 #define UTF_H 4 5 #include <stddef.h> 6 7 typedef int Rune; 8 9 enum { 10 UTFmax = 6, /* maximum bytes per rune */ 11 Runeself = 0x80, /* rune and utf are equal (<) */ 12 Runeerror = 0xFFFD, /* decoding error in utf */ 13 Runemax = 0x10FFFF /* maximum rune value */ 14 }; 15 16 int runetochar(char *, const Rune *); 17 int chartorune(Rune *, const char *); 18 int charntorune(Rune *, const char *, size_t); 19 int runelen(const Rune); 20 size_t runenlen(const Rune *, size_t); 21 int fullrune(const char *, size_t); 22 char *utfecpy(char *, char *, const char *); 23 size_t utflen(const char *); 24 size_t utfnlen(const char *, size_t); 25 char *utfrune(const char *, Rune); 26 char *utfrrune(const char *, Rune); 27 char *utfutf(const char *, const char *); 28 29 int isalpharune(Rune); 30 int islowerrune(Rune); 31 int isspacerune(Rune); 32 int istitlerune(Rune); 33 int isupperrune(Rune); 34 int isdigitrune(Rune); 35 36 #endif