convert to 4-byte UTF-8 and 32-bit Rune

http://codereview.appspot.com/116075
This commit is contained in:
Russ Cox 2009-09-11 17:03:06 -04:00
parent 4dbf255619
commit 0cadb4301d
14 changed files with 86 additions and 44 deletions

View file

@ -30,7 +30,7 @@ struct Fmt{
void *farg; /* to make flush a closure */
int nfmt; /* num chars formatted so far */
va_list args; /* args passed to dofmt */
int r; /* % format Rune */
Rune r; /* % format Rune */
int width;
int prec;
unsigned long flags;

View file

@ -4,14 +4,15 @@
extern "C" {
#endif
typedef unsigned short Rune; /* 16 bits */
typedef unsigned int Rune; /* 32 bits */
enum
{
UTFmax = 3, /* maximum bytes per rune */
UTFmax = 4, /* maximum bytes per rune */
Runesync = 0x80, /* cannot represent part of a UTF sequence (<) */
Runeself = 0x80, /* rune and UTF sequences are the same (<) */
Runeerror = 0xFFFD /* decoding error in UTF */
Runeerror = 0xFFFD, /* decoding error in UTF */
Runemax = 0x10FFFF /* maximum rune value */
};
/* Edit .+1,/^$/ | cfn $PLAN9/src/lib9/utf/?*.c | grep -v static |grep -v __ */