aboutsummaryrefslogtreecommitdiff
path: root/include/libutf.h
diff options
context:
space:
mode:
authorNicholas <nbnoll@eml.cc>2021-11-20 10:53:19 -0800
committerNicholas <nbnoll@eml.cc>2021-11-20 10:53:19 -0800
commita9bfe650038afea8b751175cac16f6027345e45f (patch)
tree9a7f9feb76a64bb3efe573036d80b7bdbf8a59a5 /include/libutf.h
parent1c8d4e69205fd875f6bec3fa3bd929c2e7f52f62 (diff)
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.
Diffstat (limited to 'include/libutf.h')
-rw-r--r--include/libutf.h36
1 files changed, 0 insertions, 36 deletions
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);