rsc | aa73861 | 2004-03-01 19:36:29 +0000 | [diff] [blame] | 1 | #ifndef _UTFH_ |
| 2 | #define _UTFH_ 1 |
| 3 | #ifdef __cplusplus |
| 4 | extern "C" { |
| 5 | #endif |
| 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 (<) */ |
| 14 | Runeerror = 0x80, /* decoding error in UTF */ |
| 15 | }; |
| 16 | |
| 17 | /* |
| 18 | * rune routines |
| 19 | */ |
| 20 | extern int runetochar(char*, Rune*); |
| 21 | extern int chartorune(Rune*, char*); |
| 22 | extern int runelen(long); |
| 23 | extern int runenlen(Rune*, int); |
| 24 | extern int fullrune(char*, int); |
| 25 | extern int utflen(char*); |
| 26 | extern int utfnlen(char*, long); |
| 27 | extern char* utfrune(char*, long); |
| 28 | extern char* utfrrune(char*, long); |
| 29 | extern char* utfutf(char*, char*); |
| 30 | extern char* utfecpy(char*, char*, char*); |
| 31 | |
| 32 | extern Rune* runestrcat(Rune*, Rune*); |
| 33 | extern Rune* runestrchr(Rune*, Rune); |
| 34 | extern int runestrcmp(Rune*, Rune*); |
| 35 | extern Rune* runestrcpy(Rune*, Rune*); |
| 36 | extern Rune* runestrncpy(Rune*, Rune*, long); |
| 37 | extern Rune* runestrecpy(Rune*, Rune*, Rune*); |
| 38 | extern Rune* runestrdup(Rune*); |
| 39 | extern Rune* runestrncat(Rune*, Rune*, long); |
| 40 | extern int runestrncmp(Rune*, Rune*, long); |
| 41 | extern Rune* runestrrchr(Rune*, Rune); |
| 42 | extern long runestrlen(Rune*); |
| 43 | extern Rune* runestrstr(Rune*, Rune*); |
| 44 | |
| 45 | extern Rune tolowerrune(Rune); |
| 46 | extern Rune totitlerune(Rune); |
| 47 | extern Rune toupperrune(Rune); |
| 48 | extern int isalpharune(Rune); |
| 49 | extern int islowerrune(Rune); |
| 50 | extern int isspacerune(Rune); |
| 51 | extern int istitlerune(Rune); |
| 52 | extern int isupperrune(Rune); |
| 53 | |
| 54 | #ifdef cplusplus |
| 55 | } |
| 56 | #endif |
| 57 | #endif |