1#ifndef js_utf_h
2#define js_utf_h
3
4typedef 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
20enum
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
28int chartorune(Rune *rune, const char *str);
29int runetochar(char *str, const Rune *rune);
30int runelen(int c);
31int utflen(const char *s);
32
33int isalpharune(Rune c);
34int islowerrune(Rune c);
35int isspacerune(Rune c);
36int istitlerune(Rune c);
37int isupperrune(Rune c);
38Rune tolowerrune(Rune c);
39Rune totitlerune(Rune c);
40Rune toupperrune(Rune c);
41
42#endif
43