a lot of stuff tbh

This commit is contained in:
alessandrobason 2022-08-19 17:09:27 +01:00
parent d80773bb00
commit 8ddd9186b8
42 changed files with 6463 additions and 1593 deletions

19
src/utf8.h Normal file
View file

@ -0,0 +1,19 @@
#pragma once
#include "collatypes.h"
typedef uint32 rune;
enum {
UTF8_MAX_SIZE = 4,
UTF8_INVALID = 0x80
};
// grabs the next UTF-8 codepoint and advances string ptr
rune utf8Decode(const char **str);
// encodes a codepoint as UTF-8 and returns the length
usize utf8Encode(char *str, rune ch);
// returns the size of the next UTF-8 codepoint
int utf8Size(const char *str);
// returns the size of a UTF-8 codepoint
usize utf8CpSize(rune ch);