scdoc2mdoc

A fork of scdoc to output mdoc(7)
git clone git://git.sgregoratto.me/scdoc2mdoc
Log | Files | Refs | README | LICENSE

utf8.h (743B)


      1 #ifndef _UTF8_H
      2 #define _UTF8_H
      3 /*
      4  * Technically UTF-8 supports up to 6 byte codepoints,
      5  * but Unicode itself doesn't really bother with more than 4.
      6  */
      7 #define UTF8_MAX_SIZE 4
      8 #define UTF8_INVALID 0x80
      9 
     10 /* Get the next rune and advance the string pointer. */
     11 uint32_t utf8_decode(const char **);
     12 /* Encode a character as a rune and returns the length of that character. */
     13 size_t utf8_encode(char *, uint32_t);
     14 /* Return the size of the next rune in the string */
     15 int utf8_size(const char *);
     16 /* Return the size of a rune */
     17 size_t utf8_chsize(uint32_t);
     18 /* Read and return the next rune in the stream */
     19 uint32_t utf8_fgetch(FILE *);
     20 /* Write a rune to stdout and return the number of bytes written */
     21 size_t utf8_putch(uint32_t);
     22 #endif