1
0

utf.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 short Rune; /* 16 bits */
  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. * rune routines
  18. */
  19. extern int runetochar(char*, Rune*);
  20. extern int chartorune(Rune*, char*);
  21. extern int runelen(long);
  22. extern int runenlen(Rune*, int);
  23. extern int fullrune(char*, int);
  24. extern int utflen(char*);
  25. extern int utfnlen(char*, long);
  26. extern char* utfrune(char*, long);
  27. extern char* utfrrune(char*, long);
  28. extern char* utfutf(char*, char*);
  29. extern char* utfecpy(char*, char*, char*);
  30. extern Rune* runestrcat(Rune*, Rune*);
  31. extern Rune* runestrchr(Rune*, Rune);
  32. extern int runestrcmp(Rune*, Rune*);
  33. extern Rune* runestrcpy(Rune*, Rune*);
  34. extern Rune* runestrncpy(Rune*, Rune*, long);
  35. extern Rune* runestrecpy(Rune*, Rune*, Rune*);
  36. extern Rune* runestrdup(Rune*);
  37. extern Rune* runestrncat(Rune*, Rune*, long);
  38. extern int runestrncmp(Rune*, Rune*, long);
  39. extern Rune* runestrrchr(Rune*, Rune);
  40. extern long runestrlen(Rune*);
  41. extern Rune* runestrstr(Rune*, Rune*);
  42. extern Rune tolowerrune(Rune);
  43. extern Rune totitlerune(Rune);
  44. extern Rune toupperrune(Rune);
  45. extern int isalpharune(Rune);
  46. extern int islowerrune(Rune);
  47. extern int isspacerune(Rune);
  48. extern int istitlerune(Rune);
  49. extern int isupperrune(Rune);
  50. #if defined(__cplusplus)
  51. }
  52. #endif
  53. #endif