rsc | f701258 | 2003-11-25 01:40:27 +0000 | [diff] [blame] | 1 | #ifndef _UTF_H_ |
| 2 | #define _UTF_H_ 1 |
| 3 | #if defined(__cplusplus) |
| 4 | extern "C" { |
| 5 | #endif |
rsc | b2cfc4e | 2003-09-30 17:47:41 +0000 | [diff] [blame] | 6 | |
| 7 | typedef unsigned short Rune; /* 16 bits */ |
| 8 | |
| 9 | enum |
| 10 | { |
| 11 | UTFmax = 3, /* maximum bytes per rune */ |
| 12 | Runesync = 0x80, /* cannot represent part of a UTF sequence (<) */ |
| 13 | Runeself = 0x80, /* rune and UTF sequences are the same (<) */ |
rsc | cbeb0b2 | 2006-04-01 19:24:03 +0000 | [diff] [blame] | 14 | Runeerror = 0xFFFD /* decoding error in UTF */ |
rsc | b2cfc4e | 2003-09-30 17:47:41 +0000 | [diff] [blame] | 15 | }; |
| 16 | |
rsc | 8bbb2f6 | 2004-12-25 22:00:00 +0000 | [diff] [blame] | 17 | /* Edit .+1,/^$/ | cfn $PLAN9/src/lib9/utf/?*.c | grep -v static |grep -v __ */ |
| 18 | int chartorune(Rune *rune, char *str); |
| 19 | int fullrune(char *str, int n); |
| 20 | int isalpharune(Rune c); |
| 21 | int islowerrune(Rune c); |
| 22 | int isspacerune(Rune c); |
| 23 | int istitlerune(Rune c); |
| 24 | int isupperrune(Rune c); |
| 25 | int runelen(long c); |
| 26 | int runenlen(Rune *r, int nrune); |
| 27 | Rune* runestrcat(Rune *s1, Rune *s2); |
| 28 | Rune* runestrchr(Rune *s, Rune c); |
| 29 | int runestrcmp(Rune *s1, Rune *s2); |
| 30 | Rune* runestrcpy(Rune *s1, Rune *s2); |
| 31 | Rune* runestrdup(Rune *s) ; |
| 32 | Rune* runestrecpy(Rune *s1, Rune *es1, Rune *s2); |
| 33 | long runestrlen(Rune *s); |
| 34 | Rune* runestrncat(Rune *s1, Rune *s2, long n); |
| 35 | int runestrncmp(Rune *s1, Rune *s2, long n); |
| 36 | Rune* runestrncpy(Rune *s1, Rune *s2, long n); |
| 37 | Rune* runestrrchr(Rune *s, Rune c); |
| 38 | Rune* runestrstr(Rune *s1, Rune *s2); |
| 39 | int runetochar(char *str, Rune *rune); |
| 40 | Rune tolowerrune(Rune c); |
| 41 | Rune totitlerune(Rune c); |
| 42 | Rune toupperrune(Rune c); |
| 43 | char* utfecpy(char *to, char *e, char *from); |
| 44 | int utflen(char *s); |
| 45 | int utfnlen(char *s, long m); |
| 46 | char* utfrrune(char *s, long c); |
| 47 | char* utfrune(char *s, long c); |
| 48 | char* utfutf(char *s1, char *s2); |
rsc | b2cfc4e | 2003-09-30 17:47:41 +0000 | [diff] [blame] | 49 | |
rsc | f701258 | 2003-11-25 01:40:27 +0000 | [diff] [blame] | 50 | #if defined(__cplusplus) |
| 51 | } |
| 52 | #endif |
rsc | b2cfc4e | 2003-09-30 17:47:41 +0000 | [diff] [blame] | 53 | #endif |