From 189b9e23edfe60b7e82c4c7b6071a3f98799653a Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Tue, 26 Oct 2021 21:32:55 -0700 Subject: fix(unicode): renamed functions to be easier to understand their functions --- include/libunicode.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/libunicode.h b/include/libunicode.h index e017ac5..5e69fd1 100644 --- a/include/libunicode.h +++ b/include/libunicode.h @@ -2,9 +2,8 @@ typedef uint32 rune; -/* - * We have to use the preprocessor to ensure - * we have unsigned constants. Unfortunate... +/* + * we have to use the preprocessor to ensure we have unsigned constants. */ #define UTFmax 4 @@ -17,14 +16,16 @@ typedef uint32 rune; /* * UTF-8 functions. */ -int utf8·len(char *s); -int utf8·runelen(rune r); - -int utf8·fullrune(char *s, int n); -char *utf8·findrune(char *s, long i); -char *utf8·findrrune(char* s, long c); -int utf8·bytetorune(rune *r, char *s); -int utf8·runetobyte(char *s, rune *r); +int utf8·len(char *s); // returns number of runes +int utf8·runelen(rune r); // returns number of bytes for rune + +int utf8·decode(char *, rune *); // decode 1 rune from char stream, store into rune, return number of bytes +int utf8·encode(rune *, char *); // encode 1 rune from rune stream, store into char, return number of bytes + +char *utf8·find(char *s, rune); // find rune in char stream +char *utf8·findlast(char* s, rune); // find last rune in char stream + +int utf8·canfit(char *, int); // XXX: odd function... int utf8·isletter(rune r); int utf8·isdigit(rune r); -- cgit v1.2.1