Finish ducking.

This commit is contained in:
Dominik Pantůček 2023-07-07 14:42:57 +02:00
parent 1b18c99d3c
commit c42582a799
4 changed files with 107 additions and 31 deletions

View file

@ -609,3 +609,74 @@ Directory handling which didn't fit elsewhere.
Makes sure given path exists and it is a directory. Throws an error
if it exists and it is not a directory.
## util-utf8 [module]
(import util-utf8)
High-performance UTF-8 support.
### utf8-char->string [procedure]
(utf8-char->string ch)
Encodes given character as UTF-8.
### make-utf8-string [procedure]
(make-utf8-string n
(ch #\space))
UTF-8 version of make-string.
### string-append-utf8-char [procedure]
(string-append-utf8-char s
ch)
UTF-8 character append.
### utf8-string->lists [procedure]
(utf8-string->lists str)
Converts a UTF-8 string into two lists: list of UTF-8 characters
of the string and a list of remaining bytes (as integers).
### utf8-bytes->lists [procedure]
(utf8-bytes->lists chars)
The same as above but accepts a list of bytes (as integers).
### utf8-string-next-char [procedure]
(utf8-string-next-char str
(si0 0))
Returns the position right after the character at specified
position.
### utf8-string-length [procedure]
(utf8-string-length s)
Calculates the length of given UTF-8 string.
### utf8-string->list [procedure]
(utf8-string->list s)
Converts utf8 string to list of unicode characters.
### list->utf8-string [procedure]
(list->utf8-string lst)
Converts list of unicode characters into utf8 string.
### string-utf8? [procedure]
(string-utf8? s)
Returns true, if given string contains UTF-8 characters.