utf.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef _UTF_H_
  2. #define _UTF_H_ 1
  3. #pragma lib "/$M/lib/ape/libutf.a"
  4. #pragma src "/sys/src/ape/lib/utf"
  5. #if defined(__cplusplus)
  6. extern "C" {
  7. #endif
  8. typedef unsigned int Rune; /* 32 bits */
  9. enum
  10. {
  11. UTFmax = 4, /* 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 = 0xFFFD, /* decoding error in UTF */
  15. Runemax = 0x10FFFF, /* 21-bit rune */
  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. extern Rune* runestrcat(Rune*, Rune*);
  32. extern Rune* runestrchr(Rune*, Rune);
  33. extern int runestrcmp(Rune*, Rune*);
  34. extern Rune* runestrcpy(Rune*, Rune*);
  35. extern Rune* runestrncpy(Rune*, Rune*, long);
  36. extern Rune* runestrecpy(Rune*, Rune*, Rune*);
  37. extern Rune* runestrdup(Rune*);
  38. extern Rune* runestrncat(Rune*, Rune*, long);
  39. extern int runestrncmp(Rune*, Rune*, long);
  40. extern Rune* runestrrchr(Rune*, Rune);
  41. extern long runestrlen(Rune*);
  42. extern Rune* runestrstr(Rune*, Rune*);
  43. extern Rune tolowerrune(Rune);
  44. extern Rune totitlerune(Rune);
  45. extern Rune toupperrune(Rune);
  46. extern int isalpharune(Rune);
  47. extern int islowerrune(Rune);
  48. extern int isspacerune(Rune);
  49. extern int istitlerune(Rune);
  50. extern int isupperrune(Rune);
  51. #if defined(__cplusplus)
  52. }
  53. #endif
  54. #endif