blob: 44052f417281099c9095d6ffd26991018b6d84b9 [file] [log] [blame]
Alexander Gutkin439f3d12014-02-28 11:33:45 +00001#ifndef _UTF_H_
2#define _UTF_H_ 1
3#if defined(__cplusplus)
4extern "C" {
5#endif
6
7typedef unsigned int Rune; /* 32 bits */
8
9enum
10{
11 UTFmax = 4, /* maximum bytes per rune */
12 Runesync = 0x80, /* cannot represent part of a UTF sequence (<) */
13 Runeself = 0x80, /* rune and UTF sequences are the same (<) */
14 Runeerror = 0xFFFD, /* decoding error in UTF */
15 Runemax = 0x10FFFF /* maximum rune value */
16};
17
18/* Edit .+1,/^$/ | cfn $PLAN9/src/lib9/utf/?*.c | grep -v static |grep -v __ */
19int chartorune(Rune *rune, char *str);
20int fullrune(char *str, int n);
21int isalpharune(Rune c);
22int islowerrune(Rune c);
23int isspacerune(Rune c);
24int istitlerune(Rune c);
25int isupperrune(Rune c);
26int runelen(long c);
27int runenlen(Rune *r, int nrune);
28Rune* runestrcat(Rune *s1, Rune *s2);
29Rune* runestrchr(Rune *s, Rune c);
30int runestrcmp(Rune *s1, Rune *s2);
31Rune* runestrcpy(Rune *s1, Rune *s2);
32Rune* runestrdup(Rune *s) ;
33Rune* runestrecpy(Rune *s1, Rune *es1, Rune *s2);
34long runestrlen(Rune *s);
35Rune* runestrncat(Rune *s1, Rune *s2, long n);
36int runestrncmp(Rune *s1, Rune *s2, long n);
37Rune* runestrncpy(Rune *s1, Rune *s2, long n);
38Rune* runestrrchr(Rune *s, Rune c);
39Rune* runestrstr(Rune *s1, Rune *s2);
40int runetochar(char *str, Rune *rune);
41Rune tolowerrune(Rune c);
42Rune totitlerune(Rune c);
43Rune toupperrune(Rune c);
44char* utfecpy(char *to, char *e, char *from);
45int utflen(char *s);
46int utfnlen(char *s, long m);
47char* utfrrune(char *s, long c);
48char* utfrune(char *s, long c);
49char* utfutf(char *s1, char *s2);
50
51#if defined(__cplusplus)
52}
53#endif
54#endif