diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-06-12 16:24:23 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-06-12 16:24:27 -0700 |
commit | 286819685e13e4651b3e6212d6b59562b291b791 (patch) | |
tree | 74b9b73b63433abbfa90ef73a72e19d461d39ed4 /shell/sandbox.mu | |
parent | 70919b45f090e00d79b01928e311cfc77bac7f33 (diff) | |
download | mu-286819685e13e4651b3e6212d6b59562b291b791.tar.gz |
eliminate some implicit writes to real screen
Diffstat (limited to 'shell/sandbox.mu')
-rw-r--r-- | shell/sandbox.mu | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/shell/sandbox.mu b/shell/sandbox.mu index 1b6cd61e..0f0083f5 100644 --- a/shell/sandbox.mu +++ b/shell/sandbox.mu @@ -476,7 +476,7 @@ fn render-keyboard-menu screen: (addr screen) { draw-text-rightward-from-cursor screen, " to sandbox ", width, 7/fg, 0xc5/bg=blue-bg } -fn edit-sandbox _self: (addr sandbox), key: grapheme, globals: (addr global-table), data-disk: (addr disk) { +fn edit-sandbox _self: (addr sandbox), key: grapheme, globals: (addr global-table), data-disk: (addr disk), outer-screen: (addr screen), outer-keyboard: (addr keyboard) { var self/esi: (addr sandbox) <- copy _self # ctrl-s { @@ -490,7 +490,7 @@ fn edit-sandbox _self: (addr sandbox), key: grapheme, globals: (addr global-tabl # persisted until the next call to ctrl-s. store-state data-disk, self, globals # - run-sandbox self, globals + run-sandbox self, globals, outer-screen, outer-keyboard return } # ctrl-m @@ -609,7 +609,7 @@ fn edit-sandbox _self: (addr sandbox), key: grapheme, globals: (addr global-tabl # rerun at higher depth var max-depth-addr/ecx: (addr int) <- get trace, max-depth increment *max-depth-addr - run-sandbox self, globals + run-sandbox self, globals, outer-screen, outer-keyboard # recompute cached indices recompute-all-visible-lines trace var save-addr/ecx: (addr trace-index-stash) <- address save @@ -620,7 +620,7 @@ fn edit-sandbox _self: (addr sandbox), key: grapheme, globals: (addr global-tabl } } -fn run-sandbox _self: (addr sandbox), globals: (addr global-table) { +fn run-sandbox _self: (addr sandbox), globals: (addr global-table), outer-screen: (addr screen), outer-keyboard: (addr keyboard) { var self/esi: (addr sandbox) <- copy _self var data-ah/ecx: (addr handle gap-buffer) <- get self, data var eval-result-h: (handle cell) @@ -638,7 +638,7 @@ fn run-sandbox _self: (addr sandbox), globals: (addr global-table) { var inner-keyboard-var/eax: (addr handle cell) <- get self, keyboard-var rewind-keyboard-var inner-keyboard-var # don't clear keys from before # - read-and-evaluate-and-save-gap-buffer-to-globals data-ah, eval-result-ah, globals, definitions-created, trace, inner-screen-var, inner-keyboard-var + read-and-evaluate-and-save-gap-buffer-to-globals data-ah, eval-result-ah, globals, definitions-created, trace, inner-screen-var, inner-keyboard-var, outer-screen, outer-keyboard # if necessary, initialize a new gap-buffer for sandbox { compare globals, 0 @@ -666,7 +666,7 @@ fn test-run-integer { var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox-with sandbox, "1" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -684,7 +684,7 @@ fn test-run-negative-integer { var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox-with sandbox, "-1" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -702,7 +702,7 @@ fn test-run-error-invalid-integer { var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox-with sandbox, "1a" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -720,7 +720,7 @@ fn test-run-error-unknown-symbol { var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox-with sandbox, "a" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -738,7 +738,7 @@ fn test-run-with-spaces { var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox-with sandbox, " 1 \n" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -757,7 +757,7 @@ fn test-run-quote { var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox-with sandbox, "'a" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -775,7 +775,7 @@ fn test-run-dotted-list { var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox-with sandbox, "'(a . b)" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -793,7 +793,7 @@ fn test-run-dot-and-list { var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox-with sandbox, "'(a . (b))" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -811,7 +811,7 @@ fn test-run-final-dot { var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox-with sandbox, "'(a .)" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -830,7 +830,7 @@ fn test-run-double-dot { var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox-with sandbox, "'(a . .)" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -849,7 +849,7 @@ fn test-run-multiple-expressions-after-dot { var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox-with sandbox, "'(a . b c)" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -868,7 +868,7 @@ fn test-run-stream { var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox-with sandbox, "[a b]" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -886,7 +886,7 @@ fn test-run-move-cursor-into-trace { var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox-with sandbox, "12" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -901,7 +901,7 @@ fn test-run-move-cursor-into-trace { check-screen-row screen, 3/y, " => 12 ", "F - test-run-move-cursor-into-trace/pre-2" check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-move-cursor-into-trace/pre-2/cursor" # move cursor into trace - edit-sandbox sandbox, 0xd/ctrl-m, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0xd/ctrl-m, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor # skip one line of padding @@ -912,7 +912,7 @@ fn test-run-move-cursor-into-trace { check-screen-row screen, 3/y, " => 12 ", "F - test-run-move-cursor-into-trace/trace-2" check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-move-cursor-into-trace/trace-2/cursor" # move cursor into input - edit-sandbox sandbox, 0xd/ctrl-m, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0xd/ctrl-m, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor # skip one line of padding @@ -948,7 +948,7 @@ fn test-run-expand-trace { var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox-with sandbox, "12" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -963,7 +963,7 @@ fn test-run-expand-trace { check-screen-row screen, 3/y, " => 12 ", "F - test-run-expand-trace/pre0-2" check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-expand-trace/pre0-2/cursor" # move cursor into trace - edit-sandbox sandbox, 0xd/ctrl-m, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0xd/ctrl-m, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor # skip one line of padding @@ -974,7 +974,7 @@ fn test-run-expand-trace { check-screen-row screen, 3/y, " => 12 ", "F - test-run-expand-trace/pre1-2" check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-expand-trace/pre1-2/cursor" # expand - edit-sandbox sandbox, 0xa/newline, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0xa/newline, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # clear-screen screen render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor @@ -995,7 +995,7 @@ fn test-run-can-rerun-when-expanding-trace { # initialize sandbox with a max-depth of 3 initialize-sandbox-with sandbox, "12" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -1010,7 +1010,7 @@ fn test-run-can-rerun-when-expanding-trace { check-screen-row screen, 3/y, " => 12 ", "F - test-run-can-rerun-when-expanding-trace/pre0-2" check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-can-rerun-when-expanding-trace/pre0-2/cursor" # move cursor into trace - edit-sandbox sandbox, 0xd/ctrl-m, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0xd/ctrl-m, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor # skip one line of padding @@ -1021,7 +1021,7 @@ fn test-run-can-rerun-when-expanding-trace { check-screen-row screen, 3/y, " => 12 ", "F - test-run-can-rerun-when-expanding-trace/pre1-2" check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-can-rerun-when-expanding-trace/pre1-2/cursor" # expand - edit-sandbox sandbox, 0xa/newline, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0xa/newline, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # clear-screen screen render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor @@ -1035,9 +1035,9 @@ fn test-run-can-rerun-when-expanding-trace { check-screen-row screen, 4/y, " 1 pars", "F - test-run-can-rerun-when-expanding-trace/pre2-2" check-background-color-in-screen-row screen, 7/bg=cursor, 4/y, " ", "F - test-run-can-rerun-when-expanding-trace/pre2-2/cursor" # move cursor down and expand - edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor - edit-sandbox sandbox, 0xa/newline, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0xa/newline, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # clear-screen screen render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor @@ -1060,7 +1060,7 @@ fn test-run-preserves-trace-view-on-rerun { # initialize sandbox with a max-depth of 3 initialize-sandbox-with sandbox, "7" # eval - edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x13/ctrl-s, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack @@ -1075,7 +1075,7 @@ fn test-run-preserves-trace-view-on-rerun { check-screen-row screen, 3/y, " => 7 ", "F - test-run-preserves-trace-view-on-rerun/pre0-2" check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre0-2/cursor" # move cursor into trace - edit-sandbox sandbox, 0xd/ctrl-m, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0xd/ctrl-m, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor # check-screen-row screen, 1/y, " 7 ", "F - test-run-preserves-trace-view-on-rerun/pre1-0" @@ -1085,7 +1085,7 @@ fn test-run-preserves-trace-view-on-rerun { check-screen-row screen, 3/y, " => 7 ", "F - test-run-preserves-trace-view-on-rerun/pre1-2" check-background-color-in-screen-row screen, 7/bg=cursor, 3/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre1-2/cursor" # expand - edit-sandbox sandbox, 0xa/newline, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0xa/newline, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard clear-screen screen render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor # @@ -1106,15 +1106,15 @@ fn test-run-preserves-trace-view-on-rerun { check-screen-row screen, 8/y, " 1 => 7 ", "F - test-run-preserves-trace-view-on-rerun/pre2-7" check-background-color-in-screen-row screen, 7/bg=cursor, 8/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre2-7/cursor" # move cursor down below the macroexpand line and expand - edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor - edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor - edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor - edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor - edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0x6a/j, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor # check-screen-row screen, 1/y, " 7 ", "F - test-run-preserves-trace-view-on-rerun/pre3-0" @@ -1134,7 +1134,7 @@ fn test-run-preserves-trace-view-on-rerun { check-screen-row screen, 8/y, " 1 => 7 ", "F - test-run-preserves-trace-view-on-rerun/pre3-7" check-background-color-in-screen-row screen, 7/bg=cursor, 8/y, " ", "F - test-run-preserves-trace-view-on-rerun/pre3-7/cursor" # expand - edit-sandbox sandbox, 0xa/newline, 0/no-globals, 0/no-disk + edit-sandbox sandbox, 0xa/newline, 0/no-globals, 0/no-disk, 0/unused-outer-screen, 0/unused-outer-keyboard clear-screen screen render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height, 1/show-cursor # cursor line is expanded |