libc: import 21-bit runes from Plan 9

R=rsc
https://codereview.appspot.com/9035046
This commit is contained in:
David du Colombier
2013-06-21 23:08:33 +02:00
parent 2f4516ba69
commit 3dbe2c359f
3 changed files with 101 additions and 90 deletions

View File

@ -3,6 +3,9 @@
#define listen pm_listen
#define sleep ksleep
#define wakeup kwakeup
#ifdef strtod
#undef strtod
#endif
#define strtod fmtstrtod
/* conflicts on some os's */
@ -27,7 +30,7 @@ typedef unsigned int p9_ulong;
typedef int p9_long;
typedef signed char p9_schar;
typedef unsigned short p9_ushort;
typedef unsigned short Rune;
typedef unsigned int Rune;
typedef unsigned int p9_u32int;
typedef p9_u32int mpdigit;
@ -50,10 +53,12 @@ typedef p9_u32int mpdigit;
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 = 0x80 /* decoding error in UTF */
Runeerror = 0xFFFD, /* decoding error in UTF */
Runemax = 0x10FFFF, /* 21-bit rune */
Runemask = 0x1FFFFF, /* bits used by runes (see grep) */
};
/*