~martanne/vis

ref: bcde0a768c843049e3c2a4ca32be0ad91e533148 vis/libutf.h -rw-r--r-- 670 bytes
bcde0a76Marc André Tanner ci: verify coverity scan script before using it 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef LIBUTF_H
#define LIBUTF_H

/* libutf8 © 2012-2015 Connor Lane Smith <cls@lubutu.com> */
#include <stddef.h>
#include <stdint.h>

#if __STDC_VERSION__ >= 201112L
#include <uchar.h>
#ifdef __STDC_UTF_32__
#define RUNE_C INT32_C
typedef char32_t Rune;
#endif
#endif

#ifndef RUNE_C
#ifdef INT32_C
#define RUNE_C INT32_C
typedef uint_least32_t Rune;
#else
#define RUNE_C(x) x##L
typedef unsigned long Rune;
#endif
#endif

#define UTFmax 4 /* maximum bytes per rune */

#define Runeself 0x80             /* rune and utf are equal (<) */
#define Runemax  RUNE_C(0x10FFFF) /* maximum rune value */

int runelen(Rune r);
int runetochar(char *s, const Rune *p);

#endif