blob: 00e5bc0cc41316537259d2216275b1b67cbf4440 (
plain)
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
|
#pragma once
typedef uint32 rune;
#define UTFmax 4
#define RuneErr 0xFFFDu
/*
* UTF-8 functions.
*/
int utf8·len(char *s); // returns number of runes
int utf8·runelen(rune r); // returns number of bytes for rune
int utf8·decode(char *, rune *); // decode 1 rune from char stream, store into rune, return number of bytes
int utf8·encode(rune *, char *); // encode 1 rune from rune stream, store into char, return number of bytes
int utf8·decodeprev(char *s, rune *r); // decode 1 rune from char stream, reading backwards, store into rune, return number of bytes
char *utf8·find(char *s, rune); // find rune in char stream
char *utf8·findlast(char* s, rune); // find last rune in char stream
int utf8·canfit(char *, int); // XXX: odd function...
int utf8·isletter(rune r);
int utf8·isdigit(rune r);
int utf8·isspace(rune r);
int utf8·istitle(rune r);
int utf8·ispunct(rune r);
rune utf8·toupper(rune r);
rune utf8·tolower(rune r);
rune utf8·totitle(rune r);
|