From 2960dfcc2cef9f1c361a2c547fcd980ff5ff06fe Mon Sep 17 00:00:00 2001 From: crc <> Date: Fri, 19 Jan 2024 13:11:51 +0000 Subject: [PATCH] add first stage of takawiri, a new listener FossilOrigin-Name: 48fb492e1be05dd04ad045c40b7d4464b38f1174180c0cb4298af2cf305c1743 --- RELEASE-NOTES | 2 ++ takawiri.retro | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 takawiri.retro diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ab4c387..3076382 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -10,6 +10,8 @@ - general + - added takawiri, a new listener + - toolchain - documentation diff --git a/takawiri.retro b/takawiri.retro new file mode 100644 index 0000000..c0f6729 --- /dev/null +++ b/takawiri.retro @@ -0,0 +1,75 @@ +================================================================ + _ _ _ _ + | |_ __ _| | ____ ___ _(_)_ __(_) crc's new listener for + | __/ _` | |/ / _` \ \ /\ / / | '__| | RetroForth + | || (_| | < (_| |\ V V /| | | | | + \__\__,_|_|\_\__,_| \_/\_/ |_|_| |_| ** UNDER DEVELOPMENT ** + +================================================================ + +Load depenencies from the library. + +~~~ +{ 'konilo 'termina 'tob } &library:load a:for-each +~~~ + +# ui + +~~~ +:dss:label (-) fg:red ; +:dss:value (-) fg:cyan ; +:dss:sep (-) fg:blue ; + +:~left dss:sep #23 [ I n:inc #82 vt:row,col $| c:put ] indexed-times vt:reset ; +:~bottom dss:sep #24 #1 vt:row,col #81 [ $= c:put ] times $+ c:put vt:reset ; + +'Items d:create #0 comma #32 allot + +:dss + [ depth #32 n:min !Items + &Items fetch-next [ store-next ] times drop + &Items a:reverse [ ] a:for-each + #0 &Items [ + over n:inc #6 n:add #84 vt:row,col + dss:label + over n:zero? [ 'TOS:___ s:put ] [ '_______ s:put ] choose + vt:reset + n:put + n:inc ] a:for-each + drop ] gc ; + +:stats + #1 #84 vt:row,col dss:label 'HERE:__ s:put dss:value here n:put + #2 #84 vt:row,col dss:label 'FREE:__ s:put dss:value FREE n:put + #3 #84 vt:row,col dss:label 'DEPTH:_ s:put dss:value depth n:put + #4 #84 vt:row,col dss:label 'ROW:___ s:put dss:value @TY n:put + #5 #84 vt:row,col dss:label 'COL:___ s:put dss:value @TX n:put + vt:reset +; + +#1 #2 #3 #4 #5 + +:ui + &err:notfound unhook + &banner tob:with + [ vt:clear vt:home tob:display + ~left stats dss + ~bottom + #25 #1 vt:row,col '>>_ s:put s:get + [ dup s:put nl s:evaluate ] tob:with + ] forever ; + +ui +~~~ + +================================================================ + +Things needed: + +- termios device & words (or add termios to unix device?) +- colors for interface elements +- write a better alternative to `s:evaluate` to avoid consuming + the temporary string space +- refactor & document everything + +================================================================