From 3bbd8ff839354a6f488c8481d5e6336a3f637cee Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Sun, 23 Oct 2022 13:24:48 +0100 Subject: Replace wchar and friends with Unicode handling. All text handling should now be explicitly UTF-8 or UTF-32, removing the ambiguity around wchar_t and related functions. --- src/unicode.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/unicode.h (limited to 'src/unicode.h') diff --git a/src/unicode.h b/src/unicode.h new file mode 100644 index 0000000..45631d9 --- /dev/null +++ b/src/unicode.h @@ -0,0 +1,27 @@ +#ifndef UNICODE_H +#define UNICODE_H + +#include +#include + +uint8_t utf32_to_utf8(uint32_t c, char *buf); +uint32_t utf8_to_utf32(const char *s); + +uint32_t utf32_isprint(uint32_t c); +uint32_t utf32_isspace(uint32_t c); +uint32_t utf32_isupper(uint32_t c); +uint32_t utf32_islower(uint32_t c); +uint32_t utf32_isalnum(uint32_t c); +uint32_t utf32_toupper(uint32_t c); +uint32_t utf32_tolower(uint32_t c); + +char *utf8_next_char(const char *s); +char *utf8_prev_char(const char *s); +char *utf8_strchr(const char *s, uint32_t c); +char *utf8_strcasechr(const char *s, uint32_t c); +size_t utf8_strlen(const char *s); +char *utf8_strcasestr(const char * restrict haystack, const char * restrict needle); +char *utf8_normalize(const char *s); +char *utf8_compose(const char *s); + +#endif /* UNICODE_H */ -- cgit v1.2.3