From e5aa1b3cb6c91cf8b3b3b3a53b5258c10a9392ed Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 26 Sep 2020 23:02:39 -0700 Subject: 6875 Snapshot. Caching subsidiary stacks is a dead end; they're just the final iteration. We need to render all iterations. --- apps/tile/data.mu | 1 + apps/tile/environment.mu | 29 ++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/apps/tile/data.mu b/apps/tile/data.mu index 6f0f6e48..408756ff 100644 --- a/apps/tile/data.mu +++ b/apps/tile/data.mu @@ -33,6 +33,7 @@ type word { box-data: (handle line) # recurse # other metadata attached to this word subsidiary-stack: (handle value-stack) # if this word is a call + display-subsidiary-stack?: boolean next: (handle word) prev: (handle word) } diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index 3a295755..39dc41b8 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -142,6 +142,18 @@ $process:body: { copy-object next-word-ah, cursor-word-ah break $process:body } + compare key, 0xa # enter + { + break-if-!= + # toggle display of subsidiary stack + var cursor-word-ah/edx: (addr handle word) <- get self, cursor-word + var cursor-word/eax: (addr word) <- lookup *cursor-word-ah + var display-subsidiary-stack?/eax: (addr boolean) <- get cursor-word, display-subsidiary-stack? + var tmp/ecx: int <- copy 1 + tmp <- subtract *display-subsidiary-stack? + copy-to *display-subsidiary-stack?, tmp + break $process:body + } # otherwise insert key within current word var g/edx: grapheme <- copy key var print?/eax: boolean <- real-grapheme? key @@ -218,7 +230,22 @@ fn render-line screen: (addr screen), defs: (addr handle function), bindings: (a { compare curr-word, 0 break-if-= - move-cursor screen, top-row, curr-col + # if necessary, first render columns for subsidiary stack + $render-line:subsidiary: { + { + var display-subsidiary-stack?/eax: (addr boolean) <- get curr-word, display-subsidiary-stack? + compare *display-subsidiary-stack?, 0 # false + break-if-= $render-line:subsidiary + } + var subsidiary-stack-ah/eax: (addr handle value-stack) <- get curr-word, subsidiary-stack + var subsidiary-stack/eax: (addr value-stack) <- lookup *subsidiary-stack-ah + compare subsidiary-stack, 0 + break-if-= + top-row <- add 3 + curr-col <- render-subsidiary-stack + print-string screen, "!" + } + # now render main column curr-col <- render-column screen, defs, bindings, line, curr-word, top-row, curr-col, cursor-word, cursor-col-a var next-word-ah/edx: (addr handle word) <- get curr-word, next curr-word <- lookup *next-word-ah -- cgit 1.4.1-2-gfad0