about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-09-26 23:02:39 -0700
committerKartik Agaram <vc@akkartik.com>2020-09-26 23:02:39 -0700
commite5aa1b3cb6c91cf8b3b3b3a53b5258c10a9392ed (patch)
tree6411ad52aaee4c07a6a9a10a9c8a388077f618bc /apps
parent270dce161f47c2dadd151dc6fc1e9c16e71abed0 (diff)
downloadmu-e5aa1b3cb6c91cf8b3b3b3a53b5258c10a9392ed.tar.gz
6875
Snapshot. Caching subsidiary stacks is a dead end; they're just the final
iteration. We need to render all iterations.
Diffstat (limited to 'apps')
-rw-r--r--apps/tile/data.mu1
-rw-r--r--apps/tile/environment.mu29
2 files changed, 29 insertions, 1 deletions
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