1 #ifndef js_utf_h
2 #define js_utf_h
3 
4 typedef unsigned short Rune;	/* 16 bits */
5 
6 #define chartorune	jsU_chartorune
7 #define runetochar	jsU_runetochar
8 #define runelen		jsU_runelen
9 #define utflen		jsU_utflen
10 
11 #define isalpharune	jsU_isalpharune
12 #define islowerrune	jsU_islowerrune
13 #define isspacerune	jsU_isspacerune
14 #define istitlerune	jsU_istitlerune
15 #define isupperrune	jsU_isupperrune
16 #define tolowerrune	jsU_tolowerrune
17 #define totitlerune	jsU_totitlerune
18 #define toupperrune	jsU_toupperrune
19 
20 enum
21 {
22 	UTFmax		= 3,		/* maximum bytes per rune */
23 	Runesync	= 0x80,		/* cannot represent part of a UTF sequence (<) */
24 	Runeself	= 0x80,		/* rune and UTF sequences are the same (<) */
25 	Runeerror	= 0xFFFD,	/* decoding error in UTF */
26 };
27 
28 int	chartorune(Rune *rune, const char *str);
29 int	runetochar(char *str, const Rune *rune);
30 int	runelen(int c);
31 int	utflen(const char *s);
32 
33 int		isalpharune(Rune c);
34 int		islowerrune(Rune c);
35 int		isspacerune(Rune c);
36 int		istitlerune(Rune c);
37 int		isupperrune(Rune c);
38 Rune		tolowerrune(Rune c);
39 Rune		totitlerune(Rune c);
40 Rune		toupperrune(Rune c);
41 
42 #endif
43