filetype: Set "groovy" for Jenkinsfile
[vis.git] / libutf.h
bloba2b81b71f24fdd0798445ea29cbc1968867e774d
1 #ifndef LIBUTF_H
2 #define LIBUTF_H
4 /* libutf8 © 2012-2015 Connor Lane Smith <cls@lubutu.com> */
5 #include <stddef.h>
6 #include <stdint.h>
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
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
26 #define UTFmax 4 /* maximum bytes per rune */
28 #define Runeself 0x80 /* rune and utf are equal (<) */
29 #define Runemax RUNE_C(0x10FFFF) /* maximum rune value */
31 int runelen(Rune r);
32 int runetochar(char *s, const Rune *p);
34 #endif