a***@spenarnc.xs4all.nl
2024-07-29 10:17:45 UTC
I got annoyed with google, refusing to deliver a zip file.
Assuming a case-insensitive Forth that allows digits into base 64
I came up with a poor mans uudecode/uuencode for linux.
This assumes scripting and interpreted control structures.
In ciforth at least it could be compiled as easily.
(Executables take up more space than scripts.)
16 byte chunks translate to 22/23 printable characters
by mere printing them in BASE 64.
It works on 32 bits but the chunks are half.
/-------------------------- 8< ENCODE ----------------------
#!/usr/bin/lina -s
64 BASE !
BEGIN PAD DUP 2 CELLS 0 READ-FILE THROW WHILE 2@ .UD CR REPEAT
/-------------------------- 8< -----------------------------
You may need to define .UD if you don't have it
: .UD <# #S #> TYPE ;
/-------------------------- 8< DECODE ----------------------
#!/usr/bin/lina -s
64 BASE !
BEGIN PAD DUP 64 ACCEPT DUP WHILE
0. 2SWAP >NUMBER 2DROP DSP@ 2 CELLS TYPE 2DROP REPEAT
/-------------------------- 8< -----------------------------
If you can't address the stack, you will substitute
<untested> /DSP@ 2 CELLS /PAD 2! PAD 2 CELLS / <untested>
Sending
uuen.script < hcc2020feb.zip >q.txt
Receiving:
uude.script > hcc2020feb.zip <q.txt
Groetjes Albert
Assuming a case-insensitive Forth that allows digits into base 64
I came up with a poor mans uudecode/uuencode for linux.
This assumes scripting and interpreted control structures.
In ciforth at least it could be compiled as easily.
(Executables take up more space than scripts.)
16 byte chunks translate to 22/23 printable characters
by mere printing them in BASE 64.
It works on 32 bits but the chunks are half.
/-------------------------- 8< ENCODE ----------------------
#!/usr/bin/lina -s
64 BASE !
BEGIN PAD DUP 2 CELLS 0 READ-FILE THROW WHILE 2@ .UD CR REPEAT
/-------------------------- 8< -----------------------------
You may need to define .UD if you don't have it
: .UD <# #S #> TYPE ;
/-------------------------- 8< DECODE ----------------------
#!/usr/bin/lina -s
64 BASE !
BEGIN PAD DUP 64 ACCEPT DUP WHILE
0. 2SWAP >NUMBER 2DROP DSP@ 2 CELLS TYPE 2DROP REPEAT
/-------------------------- 8< -----------------------------
If you can't address the stack, you will substitute
<untested> /DSP@ 2 CELLS /PAD 2! PAD 2 CELLS / <untested>
Sending
uuen.script < hcc2020feb.zip >q.txt
Receiving:
uude.script > hcc2020feb.zip <q.txt
Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat purring. - the Wise from Antrim -
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat purring. - the Wise from Antrim -