about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-09-26 23:05:36 -0700
committerKartik Agaram <vc@akkartik.com>2020-09-26 23:05:36 -0700
commit866e6e72a84c33a83f6b0d1dcc259050b8ca0681 (patch)
treef8e7cd68441bc1a33ea062788b5ba11efd72b1f4
parente5aa1b3cb6c91cf8b3b3b3a53b5258c10a9392ed (diff)
downloadmu-866e6e72a84c33a83f6b0d1dcc259050b8ca0681.tar.gz
6876
Back to commit 6872.
-rw-r--r--apps/tile/data.mu3
-rw-r--r--apps/tile/environment.mu31
-rw-r--r--apps/tile/rpn.mu29
3 files changed, 10 insertions, 53 deletions
diff --git a/apps/tile/data.mu b/apps/tile/data.mu
index 408756ff..9b852a82 100644
--- a/apps/tile/data.mu
+++ b/apps/tile/data.mu
@@ -31,9 +31,6 @@ type word {
   scalar-data: (handle gap-buffer)
   text-data: (handle array byte)
   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 39dc41b8..399901ac 100644
--- a/apps/tile/environment.mu
+++ b/apps/tile/environment.mu
@@ -142,18 +142,6 @@ $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
@@ -230,22 +218,7 @@ fn render-line screen: (addr screen), defs: (addr handle function), bindings: (a
   {
     compare curr-word, 0
     break-if-=
-    # 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
+    move-cursor screen, top-row, curr-col
     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
@@ -377,7 +350,7 @@ fn clear-canvas _env: (addr environment) {
   reset-formatting screen
   print-string screen, " tbd  "
   move-cursor screen, 3, 2
-  print-string screen, "x 2* = 2 x *"
+  print-string screen, "x f = 2 x *"
 }
 
 fn real-grapheme? g: grapheme -> result/eax: boolean {
diff --git a/apps/tile/rpn.mu b/apps/tile/rpn.mu
index fe22752b..2b45d981 100644
--- a/apps/tile/rpn.mu
+++ b/apps/tile/rpn.mu
@@ -51,16 +51,12 @@ fn evaluate defs: (addr handle function), bindings: (addr table), scratch: (addr
       # if curr-stream is a known function name, call it appropriately
       {
         var callee-h: (handle function)
-        var callee/ecx: (addr function) <- copy 0
-        {
-          var callee-ah/eax: (addr handle function) <- address callee-h
-          find-function defs, curr-stream, callee-ah
-          var _callee/eax: (addr function) <- lookup *callee-ah
-          callee <- copy _callee
-        }
+        var callee-ah/eax: (addr handle function) <- address callee-h
+        find-function defs, curr-stream, callee-ah
+        var callee/eax: (addr function) <- lookup *callee-ah
         compare callee, 0
         break-if-=
-        perform-call callee, out, defs, curr
+        perform-call callee, out, defs
         break $evaluate:process-word
       }
       # if it's a name, push its value
@@ -123,7 +119,7 @@ fn find-function first: (addr handle function), name: (addr stream byte), out: (
   }
 }
 
-fn perform-call _callee: (addr function), caller-stack: (addr value-stack), defs: (addr handle function), _current-word: (addr word) {
+fn perform-call _callee: (addr function), caller-stack: (addr value-stack), defs: (addr handle function) {
   var callee/ecx: (addr function) <- copy _callee
   # create bindings for args
   var table-storage: table
@@ -157,14 +153,10 @@ fn perform-call _callee: (addr function), caller-stack: (addr value-stack), defs
   }
   # obtain body
   var body-ah/eax: (addr handle line) <- get callee, body
-  var _body/eax: (addr line) <- lookup *body-ah
-  var body/ebx: (addr line) <- copy _body
+  var body/eax: (addr line) <- lookup *body-ah
   # perform call
-  var stack-storage: (handle value-stack)
-  var stack-ah/edi: (addr handle value-stack) <- address stack-storage
-  allocate stack-ah
-  var _stack/eax: (addr value-stack) <- lookup *stack-ah
-  var stack/edx: (addr value-stack) <- copy _stack
+  var stack-storage: value-stack
+  var stack/edi: (addr value-stack) <- address stack-storage
   initialize-value-stack stack, 0x10
 #?   print-string-to-real-screen "about to enter recursive eval\n"
   evaluate defs, table, body, 0, stack
@@ -172,11 +164,6 @@ fn perform-call _callee: (addr function), caller-stack: (addr value-stack), defs
   # stitch result from stack into caller
   var result/eax: int <- pop-int-from-value-stack stack
   push-int-to-value-stack caller-stack, result
-  # attach callee stack to curr-word in case it needs to be rendered
-  push-int-to-value-stack stack, result
-  var current-word/esi: (addr word) <- copy _current-word
-  var dest/eax: (addr handle value-stack) <- get current-word, subsidiary-stack
-  copy-object stack-ah, dest
 }
 
 # Copy of 'simplify' that just tracks the maximum stack depth needed