dill: move %mor case into $blit

This lets us send a single blit around, instead of sending facts for
every individual blit in a draw event.
This commit is contained in:
fang 2022-03-05 18:17:48 -06:00
parent 87ac253b8d
commit 8906d1c17d
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
7 changed files with 27 additions and 15 deletions

View File

@ -122,7 +122,7 @@
=+ (~(gut by bin) ses *source)
=* dev -
=| moz=(list card:agent:gall)
=| biz=(list dill-blit:dill)
=| biz=(list blit:dill) ::TODO should be per-session
|%
++ this .
++ klr klr:format
@ -284,13 +284,13 @@
^- (list card:agent:gall)
?~ biz (flop moz)
:_ (flop moz)
=/ =dill-blit:dill ?~(t.biz i.biz [%mor (flop biz)])
=/ =blit:dill ?~(t.biz i.biz [%mor (flop biz)])
::TODO remove /drum after dill cleans up
::TODO but once we remove it, the empty trailing segment of
:: /dill/[ses] would prevent outsiders from subscribing
:: to the default session...
=/ to=(list path) [/dill/[ses] ?~(ses ~[/drum] ~)]
[%give %fact to %dill-blit !>(dill-blit)]
[%give %fact to %dill-blit !>(blit)]
::
++ se-adze :: update connections
^+ .
@ -473,7 +473,7 @@
+>(eel (~(put in eel) gyl))
::
++ se-blit :: give output
|= bil=dill-blit:dill
|= bil=blit:dill
+>(biz [bil biz])
::
++ se-blit-sys :: output to system
@ -640,7 +640,7 @@
%d ?^ buf.say.inp
ta-del
?: =([our.hid %dojo] gyl)
+>(..ta (se-blit qit+~)) :: quit pier
+>(..ta (se-blit-sys %qit ~)) :: quit pier
+>(..ta (se-klin gyl)) :: unlink app
%e +>(pos.inp (lent buf.say.inp))
%f (ta-aro %r)

View File

@ -1088,8 +1088,9 @@
[%clr ~] :: clear the screen
[%hop p=$@(@ud [r=@ud c=@ud])] :: set cursor col/pos
[%klr p=stub] :: put styled
[%put p=(list @c)] :: put text at cursor
[%mor p=(list blit)] :: multiple blits
[%nel ~] :: newline
[%put p=(list @c)] :: put text at cursor
[%sag p=path q=*] :: save to jamfile
[%sav p=path q=@] :: save to file
[%url p=@t] :: activate url
@ -1099,12 +1100,12 @@
$% belt :: client input
[%cru p=@tas q=(list tank)] :: echo error
[%hey ~] :: refresh
::TODO inconsistent with %hit and %hop
[%rez p=@ud q=@ud] :: resize, cols, rows
[%yow p=gill:gall] :: connect to app
== ::
+$ dill-blit :: arvo output
$% blit :: client output
[%mor p=(list dill-blit)] :: multiple blits
[%qit ~] :: close console
== ::
+$ flog :: sent to %dill

View File

@ -178,13 +178,10 @@
++ from :: receive blit
|= bit=dill-blit
^+ +>
?: ?=(%mor -.bit)
|- ^+ +>.^$
?~ p.bit +>.^$
$(p.bit t.p.bit, +>.^$ ^$(bit i.p.bit))
?: ?=(%qit -.bit)
(dump %logo ~)
(done %blit [bit ~])
::TODO so why is this a (list blit) again?
(done %blit bit ~)
::
++ sponsor
^- ship

View File

@ -18,6 +18,7 @@
%nel b+&
%url s+p.blit
%wyp b+&
%mor a+(turn p.blit ^blit)
::
%sag
%- pairs

View File

@ -10,7 +10,9 @@ export const csi = (cmd: string, ...args: number[]) => {
export const showBlit = (term: Terminal, blit: Blit) => {
let out = '';
if ('bel' in blit) {
if ('mor' in blit) {
return blit.mor.map(b => showBlit(term, b));
} else if ('bel' in blit) {
out += '\x07';
} else if ('clr' in blit) {
term.clear();

View File

@ -27,8 +27,9 @@ export type Blit =
| { clr: null } // clear the screen
| { hop: number | { r: number, c: number } } // set cursor col/pos
| { klr: Stub[] } // put styled
| { put: string[] } // put text at cursor
| { mor: Blit[] } // multiple blits
| { nel: null } // newline
| { put: string[] } // put text at cursor
| { sag: { path: string, file: string } } // save to jamfile
| { sav: { path: string, file: string } } // save to file
| { url: string } // activate url

View File

@ -1353,7 +1353,17 @@ _term_ef_blit(u3_utty* uty_u,
_term_it_show_tour(uty_u, u3k(u3t(blt)));
} break;
case c3__mor: //TMP backwards compatibility
case c3__mor: {
if (u3_nul != u3t(blt)) {
u3_noun bis = u3t(blt);
while (u3_nul != bis) {
_term_ef_blit(uty_u, u3k(u3h(bis)));
bis = u3t(bis);
}
break;
}
//TMP fall through to nel for backwards compatibility
}
case c3__nel: {
_term_it_show_nel(uty_u);
} break;