about summary refs log tree commit diff stats
path: root/shell
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-06-11 17:37:28 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-06-11 17:37:28 -0700
commitc6e3bce98110c807d618519fa74057ef12afdb25 (patch)
treef2f672417a81b742e6c4ee0a058c22622be18800 /shell
parent14f00ab3697f7d5351ea23b2810a56e2c00dd4b7 (diff)
downloadmu-c6e3bce98110c807d618519fa74057ef12afdb25.tar.gz
.
Diffstat (limited to 'shell')
-rw-r--r--shell/environment.mu41
-rw-r--r--shell/sandbox.mu41
2 files changed, 41 insertions, 41 deletions
diff --git a/shell/environment.mu b/shell/environment.mu
index bc582dcd..9e9a3bb7 100644
--- a/shell/environment.mu
+++ b/shell/environment.mu
@@ -371,6 +371,47 @@ fn edit-environment _self: (addr environment), key: grapheme, data-disk: (addr d
   edit-sandbox sandbox, key, globals, data-disk
 }
 
+fn read-evaluate-and-save-to-globals _in-ah: (addr handle gap-buffer), result-ah: (addr handle cell), globals: (addr global-table), definitions-created: (addr stream int), trace: (addr trace), screen-cell: (addr handle cell), keyboard-cell: (addr handle cell) {
+  var in-ah/eax: (addr handle gap-buffer) <- copy _in-ah
+  var in/eax: (addr gap-buffer) <- lookup *in-ah
+  var read-result-h: (handle cell)
+  var read-result-ah/esi: (addr handle cell) <- address read-result-h
+  read-cell in, read-result-ah, trace
+  var error?/eax: boolean <- has-errors? trace
+  {
+    compare error?, 0/false
+    break-if-=
+    return
+  }
+  macroexpand read-result-ah, globals, trace
+  var error?/eax: boolean <- has-errors? trace
+  {
+    compare error?, 0/false
+    break-if-=
+    return
+  }
+  var nil-h: (handle cell)
+  var nil-ah/eax: (addr handle cell) <- address nil-h
+  allocate-pair nil-ah
+#?   set-cursor-position 0/screen, 0 0
+#?   turn-on-debug-print
+  debug-print "^", 4/fg, 0/bg
+  evaluate read-result-ah, result-ah, *nil-ah, globals, trace, screen-cell, keyboard-cell, definitions-created, 1/call-number
+  debug-print "$", 4/fg, 0/bg
+  var error?/eax: boolean <- has-errors? trace
+  {
+    compare error?, 0/false
+    break-if-=
+    return
+  }
+  # refresh various rendering caches
+  mark-lines-dirty trace
+  # If any definitions were created or modified in the process, link this gap
+  # buffer to them.
+  # TODO: detect and create UI for conflicts.
+  stash-gap-buffer-to-globals globals, definitions-created, _in-ah
+}
+
 fn test-go-modal {
   var env-storage: environment
   var env/esi: (addr environment) <- address env-storage
diff --git a/shell/sandbox.mu b/shell/sandbox.mu
index 769177c1..3c492d58 100644
--- a/shell/sandbox.mu
+++ b/shell/sandbox.mu
@@ -655,47 +655,6 @@ fn run-sandbox _self: (addr sandbox), globals: (addr global-table) {
   print-cell eval-result-ah, value, trace
 }
 
-fn read-evaluate-and-save-to-globals _in-ah: (addr handle gap-buffer), result-ah: (addr handle cell), globals: (addr global-table), definitions-created: (addr stream int), trace: (addr trace), screen-cell: (addr handle cell), keyboard-cell: (addr handle cell) {
-  var in-ah/eax: (addr handle gap-buffer) <- copy _in-ah
-  var in/eax: (addr gap-buffer) <- lookup *in-ah
-  var read-result-h: (handle cell)
-  var read-result-ah/esi: (addr handle cell) <- address read-result-h
-  read-cell in, read-result-ah, trace
-  var error?/eax: boolean <- has-errors? trace
-  {
-    compare error?, 0/false
-    break-if-=
-    return
-  }
-  macroexpand read-result-ah, globals, trace
-  var error?/eax: boolean <- has-errors? trace
-  {
-    compare error?, 0/false
-    break-if-=
-    return
-  }
-  var nil-h: (handle cell)
-  var nil-ah/eax: (addr handle cell) <- address nil-h
-  allocate-pair nil-ah
-#?   set-cursor-position 0/screen, 0 0
-#?   turn-on-debug-print
-  debug-print "^", 4/fg, 0/bg
-  evaluate read-result-ah, result-ah, *nil-ah, globals, trace, screen-cell, keyboard-cell, definitions-created, 1/call-number
-  debug-print "$", 4/fg, 0/bg
-  var error?/eax: boolean <- has-errors? trace
-  {
-    compare error?, 0/false
-    break-if-=
-    return
-  }
-  # refresh various rendering caches
-  mark-lines-dirty trace
-  # If any definitions were created or modified in the process, link this gap
-  # buffer to them.
-  # TODO: detect and create UI for conflicts.
-  stash-gap-buffer-to-globals globals, definitions-created, _in-ah
-}
-
 fn test-run-integer {
   var sandbox-storage: sandbox
   var sandbox/esi: (addr sandbox) <- address sandbox-storage