about summary refs log tree commit diff stats
path: root/apps/tile
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-11-07 20:22:19 -0800
committerKartik Agaram <vc@akkartik.com>2020-11-07 20:22:19 -0800
commit8fdf344ea9f63d4d733c28067c3732681de65fa5 (patch)
tree07211526dae498e631cb10320ecfb4071e6199d7 /apps/tile
parent97b665c9b4bde629fb57eba00e51917b619c892a (diff)
downloadmu-8fdf344ea9f63d4d733c28067c3732681de65fa5.tar.gz
7214 - undo 7213
Turns out even that doesn't work.

There are two distinct use cases here:
  1. Keeping columns from infecting each other.
  2. Expanding function calls.

Perhaps ping-ponging between them is a sign I need tests.
Diffstat (limited to 'apps/tile')
-rw-r--r--apps/tile/environment.mu1
-rw-r--r--apps/tile/table.mu11
2 files changed, 7 insertions, 5 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu
index 17224883..e2eaa13c 100644
--- a/apps/tile/environment.mu
+++ b/apps/tile/environment.mu
@@ -1431,6 +1431,7 @@ fn render-column screen: (addr screen), functions: (addr handle function), bindi
     var stack: value-stack
     var stack-addr/edi: (addr value-stack) <- address stack
     initialize-value-stack stack-addr, 0x10  # max-words
+    initialize-table bindings, 0x10
     evaluate functions, bindings, first-line, final-word, stack-addr
     # render stack
     var curr-row/edx: int <- copy top-row
diff --git a/apps/tile/table.mu b/apps/tile/table.mu
index fba6918e..a4a2bae6 100644
--- a/apps/tile/table.mu
+++ b/apps/tile/table.mu
@@ -65,18 +65,18 @@ fn lookup-binding _self: (addr table), key: (addr array byte), out: (addr handle
   var data-ah/esi: (addr handle array bind) <- get self, data
   var _data/eax: (addr array bind) <- lookup *data-ah
   var data/esi: (addr array bind) <- copy _data
-  var i/edx: int <- length data
+  var len/edx: int <- length data
+  var i/ebx: int <- copy 0
   $lookup-binding:loop: {
-    i <- decrement
-    compare i, 0
-    break-if-<
+    compare i, len
+    break-if->=
     {
       var offset/edx: (offset bind) <- compute-offset data, i
       var target-bind/esi: (addr bind) <- index data, offset
       var target2/edx: (addr handle array byte) <- get target-bind, key
       var target3/eax: (addr array byte) <- lookup *target2
       compare target3, 0
-      break-if-=
+      break-if-= $lookup-binding:loop
       var is-match?/eax: boolean <- string-equal? target3, key
       compare is-match?, 0  # false
       break-if-=
@@ -85,6 +85,7 @@ fn lookup-binding _self: (addr table), key: (addr array byte), out: (addr handle
       copy-object target, out
       break $lookup-binding:loop
     }
+    i <- increment
     loop
   }
 }