about summary refs log tree commit diff stats
path: root/apps/tile
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-11-15 23:13:23 -0800
committerKartik Agaram <vc@akkartik.com>2020-11-15 23:13:23 -0800
commit002f2609e91ed2e49c250202877290f58609a982 (patch)
tree079a758e20ff5137b197abc9ce535810351ae12e /apps/tile
parent2715d377b6108b0a607d9322d470bedd77c9c717 (diff)
downloadmu-002f2609e91ed2e49c250202877290f58609a982.tar.gz
7248 - mu.subx: new primitive 'clear-object'
Diffstat (limited to 'apps/tile')
-rw-r--r--apps/tile/environment.mu10
-rw-r--r--apps/tile/rpn.mu15
2 files changed, 8 insertions, 17 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu
index b774356d..c70efd7c 100644
--- a/apps/tile/environment.mu
+++ b/apps/tile/environment.mu
@@ -522,8 +522,7 @@ $process-sandbox-rename:body: {
   compare key, 0x1b  # esc
   $process-sandbox-rename:cancel: {
     break-if-!=
-    var empty: (handle word)
-    copy-handle empty, new-name-ah
+    clear-object new-name-ah
     break $process-sandbox-rename:body
   }
   # if 'enter' pressed, perform rename
@@ -586,9 +585,7 @@ $process-sandbox-rename:body: {
     # sandbox->data = new-line
     copy-handle new-line-h, sandbox-slot
     # clear partial-name-for-cursor-word
-    var empty: (handle word)
-    copy-handle empty, new-name-ah
-#?     # XXX
+    clear-object new-name-ah
 #?     var cursor-ah/eax: (addr handle call-path-element) <- get sandbox, cursor-call-path
 #?     var cursor/eax: (addr call-path-element) <- lookup *cursor-ah
 #?     var word-at-cursor-ah/eax: (addr handle word) <- get cursor, word
@@ -643,8 +640,7 @@ $process-sandbox-define:body: {
   compare key, 0x1b  # esc
   $process-sandbox-define:cancel: {
     break-if-!=
-    var empty: (handle word)
-    copy-handle empty, new-name-ah
+    clear-object new-name-ah
     break $process-sandbox-define:body
   }
   # if 'enter' pressed, perform define
diff --git a/apps/tile/rpn.mu b/apps/tile/rpn.mu
index 22aa9c19..1b288fa5 100644
--- a/apps/tile/rpn.mu
+++ b/apps/tile/rpn.mu
@@ -81,8 +81,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch:
           var type-addr/eax: (addr int) <- get target-val, type
           copy-to *type-addr, 0  # int
           var target-string-ah/eax: (addr handle array byte) <- get target-val, text-data
-          var empty: (handle array byte)
-          copy-handle empty, target-string-ah
+          clear-object target-string-ah
           var target/eax: (addr int) <- get target-val, int-data
           copy-to *target, result
           break $evaluate:process-word
@@ -98,8 +97,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch:
           var type-addr/eax: (addr int) <- get target-val, type
           copy-to *type-addr, 0  # int
           var target-array-ah/eax: (addr handle array value) <- get target-val, array-data
-          var empty: (handle array value)
-          copy-handle empty, target-array-ah
+          clear-object target-array-ah
           var target/eax: (addr int) <- get target-val, int-data
           copy-to *target, result
           break $evaluate:process-word
@@ -136,8 +134,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch:
         var target-string-ah/eax: (addr handle array byte) <- get target-val, text-data
         var filename-ah/ecx: (addr handle array byte) <- get target-val, filename
         copy-object target-string-ah, filename-ah
-        var empty: (handle array byte)
-        copy-handle empty, target-string-ah
+        clear-object target-string-ah
         break $evaluate:process-word
       }
       {
@@ -172,8 +169,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch:
         var type-addr/eax: (addr int) <- get target-val, type
         copy-to *type-addr, 1  # string
         var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data
-        var empty: (handle buffered-file)
-        copy-handle empty, target-file-ah
+        clear-object target-file-ah
         break $evaluate:process-word
       }
       {
@@ -208,8 +204,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch:
         var type-addr/eax: (addr int) <- get target-val, type
         copy-to *type-addr, 1  # string
         var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data
-        var empty: (handle buffered-file)
-        copy-handle empty, target-file-ah
+        clear-object target-file-ah
         break $evaluate:process-word
       }
       {