From a9bfe650038afea8b751175cac16f6027345e45f Mon Sep 17 00:00:00 2001 From: Nicholas Date: Sat, 20 Nov 2021 10:53:19 -0800 Subject: Chore: reorganize libutf and libfmt into base I found the split to be arbitrary. Better to include the functionality in the standard library. I also split the headers to allow for more granular inclusion (but the library is still monolithic). The only ugliness is the circular dependency introduced with libutf's generated functions. We put explicit prereqs with the necessary object files instead. --- include/libutf.h | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 include/libutf.h (limited to 'include/libutf.h') diff --git a/include/libutf.h b/include/libutf.h deleted file mode 100644 index 846296c..0000000 --- a/include/libutf.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#define UTFmax 4 -#define RuneErr 0xFFFDu -#define RuneMax 0x10FFFFu - -#define utf8·onebyte(c) (((c)&0x80u)==0x00u) -#define utf8·twobyte(c) (((c)&0xE0u)==0xC0u) -#define utf8·threebyte(c) (((c)&0xF0u)==0xE0u) -#define utf8·fourbyte(c) (((c)&0xF8u)==0xF0u) - -/* - * UTF-8 functions. - */ -int utf8·len(char *s); // returns number of runes for s -int utf8·runelen(rune r); // returns number of bytes for rune -int utf8·runewidth(rune r); // returns number of printed columns 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 -int utf8·decodeprev(char *s, rune *r); // decode 1 rune from char stream, reading backwards, store into rune, 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·isalpha(rune r); -int utf8·isdigit(rune r); -int utf8·isspace(rune r); -int utf8·istitle(rune r); -int utf8·ispunct(rune r); - -rune utf8·toupper(rune r); -rune utf8·tolower(rune r); -rune utf8·totitle(rune r); -- cgit v1.2.1