summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/unicode.h
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2024-09-04 17:01:05 +0200
committerUros Majstorovic <majstor@majstor.org>2024-09-04 17:01:05 +0200
commit16481ee83d7bde7a28dc8b0d767e0e59d78eb678 (patch)
treeb57a851caaa964a6b5d2b798f0b74133b7ab5538 /fw/fe310/eos/unicode.h
parent6da98500b8310c19d8b0745ce1b5adfc677ab6b1 (diff)
unicode support improvements / bugfixes
Diffstat (limited to 'fw/fe310/eos/unicode.h')
-rw-r--r--fw/fe310/eos/unicode.h26
1 files changed, 15 insertions, 11 deletions
diff --git a/fw/fe310/eos/unicode.h b/fw/fe310/eos/unicode.h
index 12fa99c..1204ea8 100644
--- a/fw/fe310/eos/unicode.h
+++ b/fw/fe310/eos/unicode.h
@@ -1,19 +1,23 @@
+#include <sys/types.h>
#include <stdint.h>
#define UTF_OK 0
#define UTF_ERR -1
typedef uint8_t utf8_t;
-typedef uint16_t utf16_t;
-typedef uint32_t utf32_t;
+typedef uint8_t utf16_t;
+/* unicode code point*/
+typedef uint32_t ucp_t;
-int utf8_enc(utf32_t ch, utf8_t *str);
-int utf8_dec(utf8_t *str, utf32_t *ch);
-int utf8_len(utf8_t *str);
-int utf8_seek(utf8_t *str, int off, utf32_t *ch);
-int utf8_verify(utf8_t *str, int str_size, int *str_len);
+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(utf32_t ch, uint8_t *str);
-int utf16_dec(uint8_t *str, utf32_t *ch);
-int utf16_len(uint8_t *str);
-int utf16_seek(uint8_t *str, int off, utf32_t *ch);
+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);