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