vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

libutf.h

(670B)


      1 #ifndef LIBUTF_H
      2 #define LIBUTF_H
      3 
      4 /* libutf8 © 2012-2015 Connor Lane Smith <cls@lubutu.com> */
      5 #include <stddef.h>
      6 #include <stdint.h>
      7 
      8 #if __STDC_VERSION__ >= 201112L
      9 #include <uchar.h>
     10 #ifdef __STDC_UTF_32__
     11 #define RUNE_C INT32_C
     12 typedef char32_t Rune;
     13 #endif
     14 #endif
     15 
     16 #ifndef RUNE_C
     17 #ifdef INT32_C
     18 #define RUNE_C INT32_C
     19 typedef uint_least32_t Rune;
     20 #else
     21 #define RUNE_C(x) x##L
     22 typedef unsigned long Rune;
     23 #endif
     24 #endif
     25 
     26 #define UTFmax 4 /* maximum bytes per rune */
     27 
     28 #define Runeself 0x80             /* rune and utf are equal (<) */
     29 #define Runemax  RUNE_C(0x10FFFF) /* maximum rune value */
     30 
     31 int runelen(Rune r);
     32 int runetochar(char *s, const Rune *p);
     33 
     34 #endif