Blob


1 #ifndef _UTF_H_
2 #define _UTF_H_ 1
3 #if defined(__cplusplus)
4 extern "C" {
5 #endif
7 typedef unsigned short Rune; /* 16 bits */
9 enum
10 {
11 UTFmax = 3, /* 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 };
17 /* Edit .+1,/^$/ | cfn $PLAN9/src/lib9/utf/?*.c | grep -v static |grep -v __ */
18 int chartorune(Rune *rune, char *str);
19 int fullrune(char *str, int n);
20 int isalpharune(Rune c);
21 int islowerrune(Rune c);
22 int isspacerune(Rune c);
23 int istitlerune(Rune c);
24 int isupperrune(Rune c);
25 int runelen(long c);
26 int runenlen(Rune *r, int nrune);
27 Rune* runestrcat(Rune *s1, Rune *s2);
28 Rune* runestrchr(Rune *s, Rune c);
29 int runestrcmp(Rune *s1, Rune *s2);
30 Rune* runestrcpy(Rune *s1, Rune *s2);
31 Rune* runestrdup(Rune *s) ;
32 Rune* runestrecpy(Rune *s1, Rune *es1, Rune *s2);
33 long runestrlen(Rune *s);
34 Rune* runestrncat(Rune *s1, Rune *s2, long n);
35 int runestrncmp(Rune *s1, Rune *s2, long n);
36 Rune* runestrncpy(Rune *s1, Rune *s2, long n);
37 Rune* runestrrchr(Rune *s, Rune c);
38 Rune* runestrstr(Rune *s1, Rune *s2);
39 int runetochar(char *str, Rune *rune);
40 Rune tolowerrune(Rune c);
41 Rune totitlerune(Rune c);
42 Rune toupperrune(Rune c);
43 char* utfecpy(char *to, char *e, char *from);
44 int utflen(char *s);
45 int utfnlen(char *s, long m);
46 char* utfrrune(char *s, long c);
47 char* utfrune(char *s, long c);
48 char* utfutf(char *s1, char *s2);
50 #if defined(__cplusplus)
51 }
52 #endif
53 #endif