2007-07-01 15:08:30 +04:00
|
|
|
#ifndef _UTF_H_
|
|
|
|
#define _UTF_H_ 1
|
|
|
|
|
2010-07-19 20:50:19 +04:00
|
|
|
typedef unsigned int Rune; /* 32 bits */
|
2007-07-01 15:08:30 +04:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2010-07-19 20:50:19 +04:00
|
|
|
UTFmax = 4, /* maximum bytes per rune */
|
2007-07-01 15:08:30 +04:00
|
|
|
Runesync = 0x80, /* cannot represent part of a UTF sequence (<) */
|
|
|
|
Runeself = 0x80, /* rune and UTF sequences are the same (<) */
|
2010-07-19 20:50:19 +04:00
|
|
|
Runeerror = 0xFFFD, /* decoding error in UTF */
|
|
|
|
Runemax = 0x10FFFF /* maximum rune value */
|
2007-07-01 15:08:30 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Edit .+1,/^$/ | cfn $PLAN9/src/lib9/utf/?*.c | grep -v static |grep -v __ */
|
2007-07-17 00:52:35 +04:00
|
|
|
int chartorune(Rune *rune, const char *str);
|
|
|
|
int fullrune(const char *str, int n);
|
2008-01-18 23:05:45 +03:00
|
|
|
int isalpharune(Rune);
|
|
|
|
int islowerrune(Rune);
|
|
|
|
int isspacerune(Rune);
|
|
|
|
int istitlerune(Rune);
|
|
|
|
int isupperrune(Rune);
|
2010-07-19 20:50:19 +04:00
|
|
|
int runelen(long);
|
2008-01-18 23:05:45 +03:00
|
|
|
int runenlen(const Rune*, int);
|
|
|
|
Rune* runestrcat(Rune*, const Rune*);
|
|
|
|
Rune* runestrchr(const Rune*, Rune);
|
|
|
|
int runestrcmp(const Rune*, const Rune*);
|
|
|
|
Rune* runestrcpy(Rune*, const Rune*);
|
|
|
|
Rune* runestrdup(const Rune*) ;
|
|
|
|
Rune* runestrecpy(Rune*, Rune *e, const Rune*);
|
|
|
|
long runestrlen(const Rune*);
|
|
|
|
Rune* runestrncat(Rune*, const Rune*, long);
|
|
|
|
int runestrncmp(const Rune*, const Rune*, long);
|
|
|
|
Rune* runestrncpy(Rune*, const Rune*, long);
|
|
|
|
Rune* runestrrchr(const Rune*, Rune);
|
|
|
|
Rune* runestrstr(const Rune*, const Rune*);
|
|
|
|
int runetochar(char*, const Rune*);
|
|
|
|
Rune tolowerrune(Rune);
|
|
|
|
Rune totitlerune(Rune);
|
|
|
|
Rune toupperrune(Rune);
|
|
|
|
char* utfecpy(char*, char*, const char*);
|
|
|
|
int utflen(const char*);
|
|
|
|
int utfnlen(const char*, long);
|
|
|
|
char* utfrrune(const char*, long);
|
|
|
|
char* utfrune(const char*, long);
|
|
|
|
char* utfutf(const char*, const char*);
|
2007-07-01 15:08:30 +04:00
|
|
|
|
|
|
|
#endif
|