colorForth ASCII/UTF-8 support

22 views
Skip to first unread message

Howerd

unread,
Apr 21, 2022, 12:18:39 AM4/21/22
to ColorForth
 Hi colorForthers,

Yesterday I had an idea about how to add ASCII/UTF-8 support to colorForth.

Today I wrote the code to do this, as a demonstration, and it works!!!

You can see the demonstration here :
http://www.inventio.co.uk/cf2022/Encoding%20ASCII%20into%20cf2022%20colorForth%20tokens.pdf

I've been trying to do this for about 15 years, so I am very excited that the idea just came to me yesterday.

In cf2022 colorForth, a Shannon-Fano encoded token consists of a 4 bit colour in the bottom four bits, and 28 bits of up to 7 letters.
For example, a white lower case comment "rrrrrrr" is
$11111119 , where '1' is a four bit code for the letter 'r', and '9' is a white colour token. A sequence of Shannon-Fano letters can be terminated by a 4-bit Shannon-Fano NULL, which displays as a space character.

The simple idea is that if the first Shannon-Fano encoded letter is a NULL ( all four bits are 0 ) the token does not display anything (except a space), so that in this case the remaining 24 bits can be interpreted as three 8 bit ASCII/UTF-8 characters.

Now all I need to do is add ASCII/UTF-8 input, and support for international QWERTZ, AZERTY and QWERTY etc. keyboards...

Watch this space :-)

Cheers
Howerd (very excited)  
Reply all
Reply to author
Forward
0 new messages