summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/unicode.h
blob: 1204ea85b7e0e8b5a5d1bd5d228335ba3ae5a8c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <sys/types.h>
#include <stdint.h>

#define UTF_OK      0
#define UTF_ERR     -1

typedef uint8_t utf8_t;
typedef uint8_t utf16_t;
/* unicode code point*/
typedef uint32_t ucp_t;

int utf8_enc(ucp_t ch, utf8_t *str);
int utf8_dec(utf8_t *str, ucp_t *ch);
int utf8_len_ch(ucp_t ch);
int utf8_len_str(utf8_t *str);
int utf8_seek(utf8_t *str, int off, ucp_t *ch);
int utf8_verify(utf8_t *str, size_t str_size, size_t *str_len);

int utf16_enc(ucp_t ch, utf16_t *str);
int utf16_dec(utf16_t *str, ucp_t *ch);
int utf16_len_ch(ucp_t ch);
int utf16_len_str(utf16_t *str);
int utf16_seek(utf16_t *str, int off, ucp_t *ch);