57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
#ifndef UNI_H
|
|
#define UNI_H
|
|
|
|
/* ========================== *
|
|
* utf8
|
|
* ========================== */
|
|
|
|
struct uni_decode_utf8_result {
|
|
u32 advance8;
|
|
u32 codepoint;
|
|
};
|
|
|
|
struct uni_encode_utf8_result {
|
|
u32 count8;
|
|
u8 chars8[4];
|
|
};
|
|
|
|
struct uni_decode_utf8_result uni_decode_utf8(struct string str);
|
|
struct uni_encode_utf8_result uni_encode_utf8(u32 codepoint);
|
|
|
|
/* ========================== *
|
|
* utf16
|
|
* ========================== */
|
|
|
|
struct uni_decode_utf16_result {
|
|
u32 advance16;
|
|
u32 codepoint;
|
|
};
|
|
|
|
struct uni_encode_utf16_result {
|
|
u32 count16;
|
|
u16 chars16[2];
|
|
};
|
|
|
|
struct uni_decode_utf16_result uni_decode_utf16(struct string16 str);
|
|
struct uni_encode_utf16_result uni_encode_utf16(u32 codepoint);
|
|
b32 uni_is_utf16_high_surrogate(u16 c);
|
|
b32 uni_is_utf16_low_surrogate(u16 c);
|
|
|
|
/* ========================== *
|
|
* utf32
|
|
* ========================== */
|
|
|
|
struct uni_decode_utf32_result {
|
|
u32 advance32;
|
|
u32 codepoint;
|
|
};
|
|
|
|
struct uni_encode_utf32_result {
|
|
u32 chars32;
|
|
};
|
|
|
|
struct uni_decode_utf32_result uni_decode_utf32(struct string32 str);
|
|
struct uni_encode_utf32_result uni_encode_utf32(u32 codepoint);
|
|
|
|
#endif
|