about summary refs log tree commit diff stats
path: root/sandbox
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-12-03 23:25:40 -0800
committerKartik K. Agaram <vc@akkartik.com>2017-12-03 23:25:40 -0800
commit4a48bedcd1d708a43d43dc6259a4e45c52ea3d00 (patch)
tree85c1b7310cca932797d727a3de8da96eb175d8da /sandbox
parentef7d834fdd826977cd8d43253052a7b8e1c5aa72 (diff)
downloadmu-4a48bedcd1d708a43d43dc6259a4e45c52ea3d00.tar.gz
4134 - 'input' = 'ingredient'
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/001-editor.mu14
-rw-r--r--sandbox/002-typing.mu28
-rw-r--r--sandbox/003-shortcuts.mu36
-rw-r--r--sandbox/004-programming-environment.mu14
-rw-r--r--sandbox/005-sandbox.mu32
-rw-r--r--sandbox/006-sandbox-copy.mu12
-rw-r--r--sandbox/007-sandbox-delete.mu6
-rw-r--r--sandbox/008-sandbox-edit.mu4
-rw-r--r--sandbox/009-sandbox-test.mu6
-rw-r--r--sandbox/010-sandbox-trace.mu4
-rw-r--r--sandbox/011-errors.mu4
-rw-r--r--sandbox/012-editor-undo.mu2
12 files changed, 81 insertions, 81 deletions
diff --git a/sandbox/001-editor.mu b/sandbox/001-editor.mu
index 807cf442..9f1adbe7 100644
--- a/sandbox/001-editor.mu
+++ b/sandbox/001-editor.mu
@@ -4,7 +4,7 @@
 # screen dimensions, then stop
 def main text:text [
   local-scope
-  load-ingredients
+  load-inputs
   open-console
   clear-screen 0/screen  # non-scrolling app
   e:&:editor <- new-editor text, 0/left, 5/right
@@ -50,7 +50,7 @@ container editor [
 #   right is exclusive
 def new-editor s:text, left:num, right:num -> result:&:editor [
   local-scope
-  load-ingredients
+  load-inputs
   # no clipping of bounds
   right <- subtract right, 1
   result <- new editor:type
@@ -71,7 +71,7 @@ def new-editor s:text, left:num, right:num -> result:&:editor [
 
 def insert-text editor:&:editor, text:text -> editor:&:editor [
   local-scope
-  load-ingredients
+  load-inputs
   curr:&:duplex-list:char <- get *editor, data:offset
   insert curr, text
 ]
@@ -106,7 +106,7 @@ scenario editor-initializes-without-data [
 # outside text.
 def render screen:&:screen, editor:&:editor -> last-row:num, last-column:num, screen:&:screen, editor:&:editor [
   local-scope
-  load-ingredients
+  load-inputs
   return-unless editor, 1/top, 0/left
   left:num <- get *editor, left:offset
   screen-height:num <- screen-height screen
@@ -206,7 +206,7 @@ def render screen:&:screen, editor:&:editor -> last-row:num, last-column:num, sc
 
 def clear-screen-from screen:&:screen, row:num, column:num, left:num, right:num -> screen:&:screen [
   local-scope
-  load-ingredients
+  load-inputs
   # if it's the real screen, use the optimized primitive
   {
     break-if screen
@@ -221,7 +221,7 @@ def clear-screen-from screen:&:screen, row:num, column:num, left:num, right:num
 
 def clear-rest-of-screen screen:&:screen, row:num, left:num, right:num -> screen:&:screen [
   local-scope
-  load-ingredients
+  load-inputs
   row <- add row, 1
   # if it's the real screen, use the optimized primitive
   {
@@ -395,7 +395,7 @@ after <character-c-received> [
 # so far the previous color is all the information we need; that may change
 def get-color color:num, c:char -> color:num [
   local-scope
-  load-ingredients
+  load-inputs
   color-is-white?:bool <- equal color, 7/white
   # if color is white and next character is '#', switch color to blue
   {
diff --git a/sandbox/002-typing.mu b/sandbox/002-typing.mu
index f5bbeb6f..709e8d22 100644
--- a/sandbox/002-typing.mu
+++ b/sandbox/002-typing.mu
@@ -4,7 +4,7 @@
 # hit ctrl-c to exit
 def! main text:text [
   local-scope
-  load-ingredients
+  load-inputs
   open-console
   clear-screen 0/screen  # non-scrolling app
   editor:&:editor <- new-editor text, 5/left, 45/right
@@ -15,7 +15,7 @@ def! main text:text [
 
 def editor-event-loop screen:&:screen, console:&:console, editor:&:editor -> screen:&:screen, console:&:console, editor:&:editor [
   local-scope
-  load-ingredients
+  load-inputs
   {
     # looping over each (keyboard or touch) event as it occurs
     +next-event
@@ -49,7 +49,7 @@ def editor-event-loop screen:&:screen, console:&:console, editor:&:editor -> scr
 # process click, return if it was on current editor
 def move-cursor editor:&:editor, screen:&:screen, t:touch-event -> in-focus?:bool, editor:&:editor [
   local-scope
-  load-ingredients
+  load-inputs
   return-unless editor, 0/false
   click-row:num <- get t, row:offset
   return-unless click-row, 0/false  # ignore clicks on 'menu'
@@ -74,7 +74,7 @@ def move-cursor editor:&:editor, screen:&:screen, t:touch-event -> in-focus?:boo
 # past the last line it positions at end of last line.
 def snap-cursor editor:&:editor, screen:&:screen, target-row:num, target-column:num -> editor:&:editor [
   local-scope
-  load-ingredients
+  load-inputs
   return-unless editor
   left:num <- get *editor, left:offset
   right:num <- get *editor, right:offset
@@ -165,7 +165,7 @@ def snap-cursor editor:&:editor, screen:&:screen, target-row:num, target-column:
 # Set 'go-render?' to true to indicate the caller must perform a non-minimal update.
 def handle-keyboard-event screen:&:screen, editor:&:editor, e:event -> go-render?:bool, screen:&:screen, editor:&:editor [
   local-scope
-  load-ingredients
+  load-inputs
   return-unless editor, 0/don't-render
   screen-width:num <- screen-width screen
   screen-height:num <- screen-height screen
@@ -202,7 +202,7 @@ def handle-keyboard-event screen:&:screen, editor:&:editor, e:event -> go-render
 
 def insert-at-cursor editor:&:editor, c:char, screen:&:screen -> go-render?:bool, editor:&:editor, screen:&:screen [
   local-scope
-  load-ingredients
+  load-inputs
   before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset
   insert c, before-cursor
   before-cursor <- next before-cursor
@@ -264,7 +264,7 @@ def insert-at-cursor editor:&:editor, c:char, screen:&:screen -> go-render?:bool
 # helper for tests
 def editor-render screen:&:screen, editor:&:editor -> screen:&:screen, editor:&:editor [
   local-scope
-  load-ingredients
+  load-inputs
   old-top-idx:num <- save-top-idx screen
   left:num <- get *editor, left:offset
   right:num <- get *editor, right:offset
@@ -867,7 +867,7 @@ after <handle-special-character> [
 
 def insert-new-line-and-indent editor:&:editor, screen:&:screen -> editor:&:editor, screen:&:screen [
   local-scope
-  load-ingredients
+  load-inputs
   cursor-row:num <- get *editor, cursor-row:offset
   cursor-column:num <- get *editor, cursor-column:offset
   before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset
@@ -913,7 +913,7 @@ def insert-new-line-and-indent editor:&:editor, screen:&:screen -> editor:&:edit
 
 def at-start-of-wrapped-line? editor:&:editor -> result:bool [
   local-scope
-  load-ingredients
+  load-inputs
   left:num <- get *editor, left:offset
   cursor-column:num <- get *editor, cursor-column:offset
   cursor-at-left?:bool <- equal cursor-column, left
@@ -933,7 +933,7 @@ def at-start-of-wrapped-line? editor:&:editor -> result:bool [
 # the number of spaces at the start of the line containing 'curr'.
 def line-indent curr:&:duplex-list:char, start:&:duplex-list:char -> result:num [
   local-scope
-  load-ingredients
+  load-inputs
   result:num <- copy 0
   return-unless curr
   at-start?:bool <- equal curr, start
@@ -1115,22 +1115,22 @@ after <handle-special-key> [
 
 def draw-horizontal screen:&:screen, row:num, x:num, right:num -> screen:&:screen [
   local-scope
-  load-ingredients
+  load-inputs
   height:num <- screen-height screen
   past-bottom?:bool <- greater-or-equal row, height
   return-if past-bottom?
-  style:char, style-found?:bool <- next-ingredient
+  style:char, style-found?:bool <- next-input
   {
     break-if style-found?
     style <- copy 9472/horizontal
   }
-  color:num, color-found?:bool <- next-ingredient
+  color:num, color-found?:bool <- next-input
   {
     # default color to white
     break-if color-found?
     color <- copy 245/grey
   }
-  bg-color:num, bg-color-found?:bool <- next-ingredient
+  bg-color:num, bg-color-found?:bool <- next-input
   {
     break-if bg-color-found?
     bg-color <- copy 0/black
diff --git a/sandbox/003-shortcuts.mu b/sandbox/003-shortcuts.mu
index 919a1870..c152f504 100644
--- a/sandbox/003-shortcuts.mu
+++ b/sandbox/003-shortcuts.mu
@@ -108,7 +108,7 @@ after <handle-special-character> [
 #   backspaced-cell - value deleted (or 0 if nothing was deleted) so we can save it for undo, etc.
 def delete-before-cursor editor:&:editor, screen:&:screen -> go-render?:bool, backspaced-cell:&:duplex-list:char, editor:&:editor, screen:&:screen [
   local-scope
-  load-ingredients
+  load-inputs
   before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset
   data:&:duplex-list:char <- get *editor, data:offset
   # if at start of text (before-cursor at § sentinel), return
@@ -154,7 +154,7 @@ def delete-before-cursor editor:&:editor, screen:&:screen -> go-render?:bool, ba
 
 def move-cursor-coordinates-left editor:&:editor -> editor:&:editor [
   local-scope
-  load-ingredients
+  load-inputs
   before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset
   cursor-row:num <- get *editor, cursor-row:offset
   cursor-column:num <- get *editor, cursor-column:offset
@@ -215,7 +215,7 @@ def move-cursor-coordinates-left editor:&:editor -> editor:&:editor [
 # the length of the previous line before the 'curr' pointer.
 def previous-line-length curr:&:duplex-list:char, start:&:duplex-list:char -> result:num [
   local-scope
-  load-ingredients
+  load-inputs
   result:num <- copy 0
   return-unless curr
   at-start?:bool <- equal curr, start
@@ -369,7 +369,7 @@ after <handle-special-key> [
 
 def delete-at-cursor editor:&:editor, screen:&:screen -> go-render?:bool, deleted-cell:&:duplex-list:char, editor:&:editor, screen:&:screen [
   local-scope
-  load-ingredients
+  load-inputs
   before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset
   data:&:duplex-list:char <- get *editor, data:offset
   deleted-cell:&:duplex-list:char <- next before-cursor
@@ -449,7 +449,7 @@ after <handle-special-key> [
 
 def move-cursor-coordinates-right editor:&:editor, screen-height:num -> go-render?:bool, editor:&:editor [
   local-scope
-  load-ingredients
+  load-inputs
   before-cursor:&:duplex-list:char <- get *editor before-cursor:offset
   cursor-row:num <- get *editor, cursor-row:offset
   cursor-column:num <- get *editor, cursor-column:offset
@@ -994,7 +994,7 @@ after <handle-special-key> [
 
 def move-to-previous-line editor:&:editor -> editor:&:editor [
   local-scope
-  load-ingredients
+  load-inputs
   cursor-row:num <- get *editor, cursor-row:offset
   cursor-column:num <- get *editor, cursor-column:offset
   before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset
@@ -1340,7 +1340,7 @@ after <handle-special-key> [
 
 def move-to-next-line editor:&:editor, screen-height:num -> editor:&:editor [
   local-scope
-  load-ingredients
+  load-inputs
   cursor-row:num <- get *editor, cursor-row:offset
   cursor-column:num <- get *editor, cursor-column:offset
   before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset
@@ -1486,7 +1486,7 @@ after <handle-special-key> [
 # precondition: cursor-column should be in a consistent state
 def move-to-start-of-screen-line editor:&:editor -> editor:&:editor [
   local-scope
-  load-ingredients
+  load-inputs
   # update cursor column
   left:num <- get *editor, left:offset
   col:num <- get *editor, cursor-column:offset
@@ -1709,7 +1709,7 @@ after <handle-special-key> [
 
 def move-to-end-of-line editor:&:editor -> editor:&:editor [
   local-scope
-  load-ingredients
+  load-inputs
   before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset
   cursor-column:num <- get *editor, cursor-column:offset
   right:num <- get *editor, right:offset
@@ -1892,7 +1892,7 @@ after <handle-special-character> [
 
 def minimal-render-for-ctrl-u screen:&:screen, editor:&:editor, deleted-cells:&:duplex-list:char -> go-render?:bool, screen:&:screen [
   local-scope
-  load-ingredients
+  load-inputs
   curr-column:num <- get *editor, cursor-column:offset
   # accumulate the current line as text and render it
   buf:&:buffer:char <- new-buffer 30  # accumulator for the text we need to render
@@ -1927,7 +1927,7 @@ def minimal-render-for-ctrl-u screen:&:screen, editor:&:editor, deleted-cells:&:
 
 def delete-to-start-of-line editor:&:editor -> result:&:duplex-list:char, editor:&:editor [
   local-scope
-  load-ingredients
+  load-inputs
   # compute range to delete
   init:&:duplex-list:char 
ctx'> def render-code screen:&:screen, s:text, left:num, right:num, row:num -> row:num, screen:&:screen [ local-scope - load-ingredients + load-inputs return-unless s color:num <- copy 7/white column:num <- copy left @@ -2285,7 +2285,7 @@ after <handle-special-character> [ def minimal-render-for-ctrl-k screen:&:screen, editor:&:editor, deleted-cells:&:duplex-list:char -> go-render?:bool, screen:&:screen [ local-scope - load-ingredients + load-inputs # if we deleted nothing, there's nothing to render return-unless deleted-cells, 0/dont-render # if the line used to wrap before, give up and render the whole screen @@ -2303,7 +2303,7 @@ def minimal-render-for-ctrl-k screen:&:screen, editor:&:editor, deleted-cells:&: def delete-to-end-of-line editor:&:editor -> result:&:duplex-list:char, editor:&:editor [ local-scope - load-ingredients + load-inputs # compute range to delete start:&:duplex-list:char <- get *editor, before-cursor:offset end:&:duplex-list:char <- next start @@ -2491,7 +2491,7 @@ scenario editor-deletes-to-end-of-wrapped-line-with-ctrl-k [ # beware: never return null pointer. def before-start-of-next-line original:&:duplex-list:char, max:num -> curr:&:duplex-list:char [ local-scope - load-ingredients + load-inputs count:num <- copy 0 curr:&:duplex-list:char <- copy original # skip the initial newline if it exists @@ -2523,7 +2523,7 @@ def before-start-of-next-line original:&:duplex-list:char, max:num -> curr:&:dup # beware: never return null pointer def before-previous-screen-line in:&:duplex-list:char, editor:&:editor -> out:&:duplex-list:char [ local-scope - load-ingredients + load-inputs curr:&:duplex-list:char <- copy in c:char <- get *curr, value:offset # compute max, number of characters to skip @@ -2600,7 +2600,7 @@ after <handle-special-character> [ # the caller to go-render? the entire screen. def render-line-from-start screen:&:screen, editor:&:editor, right-margin:num -> go-render?:bool, screen:&:screen [ local-scope - load-ingredients + load-inputs before-line-start:&:duplex-list:char <- before-start-of-screen-line editor line-start:&:duplex-list:char <- next before-line-start color:num <- copy 7/white @@ -2630,7 +2630,7 @@ def render-line-from-start screen:&:screen, editor:&:editor, right-margin:num -> def before-start-of-screen-line editor:&:editor -> result:&:duplex-list:char [ local-scope - load-ingredients + load-inputs cursor:&:duplex-list:char <- get *editor, before-cursor:offset { next:&:duplex-list:char <- next cursor diff --git a/sandbox/004-programming-environment.mu b/sandbox/004-programming-environment.mu index d79272a8..68d6ef24 100644 --- a/sandbox/004-programming-environment.mu +++ b/sandbox/004-programming-environment.mu @@ -15,7 +15,7 @@ container environment [ def new-programming-environment resources:&:resources, screen:&:screen, test-sandbox-editor-contents:text -> result:&:environment [ local-scope - load-ingredients + load-inputs width:num <- screen-width screen result <- new environment:type # sandbox editor @@ -26,7 +26,7 @@ def new-programming-environment resources:&:resources, screen:&:screen, test-san def event-loop screen:&:screen, console:&:console, env:&:environment, resources:&:resources -> screen:&:screen, console:&:console, env:&:environment, resources:&:resources [ local-scope - load-ingredients + load-inputs current-sandbox:&:editor <- get *env, current-sandbox:offset # if we fall behind we'll stop updating the screen, but then we have to # render the entire screen when we catch up. @@ -97,7 +97,7 @@ def event-loop screen:&:screen, console:&:console, env:&:environment, resources: def resize screen:&:screen, env:&:environment -> env:&:environment, screen:&:screen [ local-scope - load-ingredients + load-inputs clear-screen screen # update screen dimensions width:num <- screen-width screen # update sandbox editor @@ -114,7 +114,7 @@ def resize screen:&:screen, env:&:environment -> env:&:environment, screen:&:scr # off-screen, it resets cursor-row and cursor-column. def render-without-moving-cursor screen:&:screen, editor:&:editor -> last-row:num, last-column:num, screen:&:screen, editor:&:editor [ local-scope - load-ingredients + load-inputs return-unless editor, 1/top, 0/left left:num <- get *editor, left:offset screen-height:num <- screen-height screen @@ -195,7 +195,7 @@ type render-recipe = (recipe (address screen) (address editor) -> number number def render-all screen:&:screen, env:&:environment, render-editor:render-recipe -> screen:&:screen, env:&:environment [ local-scope - load-ingredients + load-inputs trace 10, [app], [render all] # top menu trace 11, [app], [render top menu] @@ -217,7 +217,7 @@ def render-all screen:&:screen, env:&:environment, render-editor:render-recipe - # replaced in a later layer def render-sandbox-side screen:&:screen, env:&:environment, render-editor:render-recipe -> screen:&:screen, env:&:environment [ local-scope - load-ingredients + load-inputs trace 11, [app], [render sandboxes] old-top-idx:num <- save-top-idx screen current-sandbox:&:editor <- get *env, current-sandbox:offset @@ -236,7 +236,7 @@ def render-sandbox-side screen:&:screen, env:&:environment, render-editor:render def update-cursor screen:&:screen, current-sandbox:&:editor, env:&:environment -> screen:&:screen [ local-scope - load-ingredients + load-inputs <update-cursor-special-cases> cursor-row:num <- get *current-sandbox, cursor-row:offset cursor-column:num <- get *current-sandbox, cursor-column:offset diff --git a/sandbox/005-sandbox.mu b/sandbox/005-sandbox.mu index ee58638b..89ebf3ca 100644 --- a/sandbox/005-sandbox.mu +++ b/sandbox/005-sandbox.mu @@ -136,7 +136,7 @@ after <global-keypress> [ def run-sandboxes env:&:environment, resources:&:resources, screen:&:screen -> errors-found?:bool, env:&:environment, resources:&:resources, screen:&:screen [ local-scope - load-ingredients + load-inputs errors-found?:bool <- update-recipes env, resources, screen # check contents of editor <begin-run-sandboxes> @@ -185,7 +185,7 @@ def run-sandboxes env:&:environment, resources:&:resources, screen:&:screen -> e # replaced in a later layer (whereupon errors-found? will actually be set) def update-recipes env:&:environment, resources:&:resources, screen:&:screen -> errors-found?:bool, env:&:environment, screen:&:screen [ local-scope - load-ingredients + load-inputs in:text <- slurp resources, [lesson/recipes.mu] reload in errors-found? <- copy 0/false @@ -194,7 +194,7 @@ def update-recipes env:&:environment, resources:&:resources, screen:&:screen -> # replaced in a later layer def update-sandbox sandbox:&:sandbox, env:&:environment, idx:num -> sandbox:&:sandbox, env:&:environment [ local-scope - load-ingredients + load-inputs data:text <- get *sandbox, data:offset response:text, _, fake-screen:&:screen <- run-sandboxed data *sandbox <- put *sandbox, response:offset, response @@ -203,14 +203,14 @@ def update-sandbox sandbox:&:sandbox, env:&:environment, idx:num -> sandbox:&:sa def update-status screen:&:screen, msg:text, color:num -> screen:&:screen [ local-scope - load-ingredients + load-inputs screen <- move-cursor screen, 0, 2 screen <- print screen, msg, color, 238/grey/background ] def save-sandboxes env:&:environment, resources:&:resources -> resources:&:resources [ local-scope - load-ingredients + load-inputs trace 11, [app], [save sandboxes] current-sandbox:&:editor <- get *env, current-sandbox:offset # first clear previous versions, in case we deleted some sandbox @@ -228,7 +228,7 @@ def save-sandboxes env:&:environment, resources:&:resources -> resources:&:resou def save-sandbox resources:&:resources, sandbox:&:sandbox, sandbox-index:num -> resources:&:resources [ local-scope - load-ingredients + load-inputs data:text <- get *sandbox, data:offset filename:text <- append [lesson/], sandbox-index resources <- dump resources, filename, data @@ -237,7 +237,7 @@ def save-sandbox resources:&:resources, sandbox:&:sandbox, sandbox-index:num -> def! render-sandbox-side screen:&:screen, env:&:environment, render-editor:render-recipe -> screen:&:screen, env:&:environment [ local-scope - load-ingredients + load-inputs trace 11, [app], [render sandbox side] old-top-idx:num <- save-top-idx screen current-sandbox:&:editor <- get *env, current-sandbox:offset @@ -264,8 +264,8 @@ def! render-sandbox-side screen:&:screen, env:&:environment, render-editor:rende def render-sandboxes screen:&:screen, sandbox:&:sandbox, left:num, right:num, row:num, render-from:num, idx:num -> row:num, screen:&:screen, sandbox:&:sandbox [ local-scope - load-ingredients - env:&:environment, _/optional <- next-ingredient + load-inputs + env:&:environment, _/optional <- next-input return-unless sandbox screen-height:num <- screen-height screen hidden?:bool <- lesser-than idx, render-from @@ -320,7 +320,7 @@ def render-sandboxes screen:&:screen, sandbox:&:sandbox, left:num, right:num, ro def render-sandbox-menu screen:&:screen, sandbox-index:num, left:num, right:num -> screen:&:screen [ local-scope - load-ingredients + load-inputs move-cursor-to-column screen, left edit-button-left:num, edit-button-right:num, copy-button-left:num, copy-button-right:num, delete-button-left:num <- sandbox-menu-columns left, right print screen, sandbox-index, 232/dark-grey, 245/grey @@ -363,7 +363,7 @@ scenario skip-rendering-sandbox-menu-past-bottom-row [ # all left/right pairs are inclusive def sandbox-menu-columns left:num, right:num -> edit-button-left:num, edit-button-right:num, copy-button-left:num, copy-button-right:num, delete-button-left:num [ local-scope - load-ingredients + load-inputs start-buttons:num <- add left, 4/space-for-sandbox-index buttons-space:num <- subtract right, start-buttons button-width:num <- divide-with-remainder buttons-space, 3 # integer division @@ -380,7 +380,7 @@ def sandbox-menu-columns left:num, right:num -> edit-button-left:num, edit-butto # clear rest of last line, move cursor to next line def render-text screen:&:screen, s:text, left:num, right:num, color:num, row:num -> row:num, screen:&:screen [ local-scope - load-ingredients + load-inputs return-unless s column:num <- copy left screen <- move-cursor screen, row, column @@ -457,7 +457,7 @@ scenario render-text-wraps-barely-long-lines [ # assumes programming environment has no sandboxes; restores them from previous session def restore-sandboxes env:&:environment, resources:&:resources -> env:&:environment [ local-scope - load-ingredients + load-inputs # read all scenarios, pushing them to end of a list of scenarios idx:num <- copy 0 curr:&:sandbox <- copy 0 @@ -491,7 +491,7 @@ def restore-sandboxes env:&:environment, resources:&:resources -> env:&:environm # leave cursor at start of next line def render-screen screen:&:screen, sandbox-screen:&:screen, left:num, right:num, row:num -> row:num, screen:&:screen [ local-scope - load-ingredients + load-inputs return-unless sandbox-screen # print 'screen:' row <- render-text screen, [screen:], left, right, 245/grey, row @@ -664,7 +664,7 @@ scenario run-instruction-manages-screen-per-sandbox [ def editor-contents editor:&:editor -> result:text [ local-scope - load-ingredients + load-inputs buf:&:buffer:char <- new-buffer 80 curr:&:duplex-list:char <- get *editor, data:offset # skip § sentinel @@ -822,7 +822,7 @@ after <global-keypress> [ # return 0 if there's no such sandbox, either because 'in' doesn't exist in 'env', or because it's the first sandbox def previous-sandbox env:&:environment, in:&:sandbox -> out:&:sandbox [ local-scope - load-ingredients + load-inputs curr:&:sandbox <- get *env, sandbox:offset return-unless curr, 0/nil next:&:sandbox <- get *curr, next-sandbox:offset diff --git a/sandbox/006-sandbox-copy.mu b/sandbox/006-sandbox-copy.mu index 33e31cc9..541618e6 100644 --- a/sandbox/006-sandbox-copy.mu +++ b/sandbox/006-sandbox-copy.mu @@ -151,7 +151,7 @@ after <global-touch> [ # some preconditions for attempting to copy a sandbox def should-attempt-copy? click-row:num, click-column:num, env:&:environment -> result:bool [ local-scope - load-ingredients + load-inputs # are we below the sandbox editor? click-sandbox-area?:bool <- click-on-sandbox-area? click-row, env return-unless click-sandbox-area?, 0/false @@ -170,7 +170,7 @@ def should-attempt-copy? click-row:num, click-column:num, env:&:environment -> r def try-copy-sandbox click-row:num, env:&:environment -> clicked-on-copy-button?:bool, env:&:environment [ local-scope - load-ingredients + load-inputs # identify the sandbox to copy, if the click was actually on the 'copy' button sandbox:&:sandbox <- find-sandbox env, click-row return-unless sandbox, 0/false @@ -184,7 +184,7 @@ def try-copy-sandbox click-row:num, env:&:environment -> clicked-on-copy-button? def find-sandbox env:&:environment, click-row:num -> result:&:sandbox [ local-scope - load-ingredients + load-inputs curr-sandbox:&:sandbox <- get *env, sandbox:offset { break-unless curr-sandbox @@ -199,7 +199,7 @@ def find-sandbox env:&:environment, click-row:num -> result:&:sandbox [ def click-on-sandbox-area? click-row:num, env:&:environment -> result:bool [ local-scope - load-ingredients + load-inputs first-sandbox:&:sandbox <- get *env, sandbox:offset return-unless first-sandbox, 0/false first-sandbox-begins:num <- get *first-sandbox, starting-row-on-screen:offset @@ -208,7 +208,7 @@ def click-on-sandbox-area? click-row:num, env:&:environment -> result:bool [ def empty-editor? editor:&:editor -> result:bool [ local-scope - load-ingredients + load-inputs head:&:duplex-list:char <- get *editor, data:offset first:&:duplex-list:char <- next head result <- not first @@ -216,7 +216,7 @@ def empty-editor? editor:&:editor -> result:bool [ def within-range? x:num, low:num, high:num -> result:bool [ local-scope - load-ingredients + load-inputs not-too-far-left?:bool <- greater-or-equal x, low not-too-far-right?:bool <- lesser-or-equal x, high result <- and not-too-far-left? not-too-far-right? diff --git a/sandbox/007-sandbox-delete.mu b/sandbox/007-sandbox-delete.mu index 955eac8f..2e8ab759 100644 --- a/sandbox/007-sandbox-delete.mu +++ b/sandbox/007-sandbox-delete.mu @@ -79,7 +79,7 @@ after <global-touch> [ # some preconditions for attempting to delete a sandbox def should-attempt-delete? click-row:num, click-column:num, env:&:environment -> result:bool [ local-scope - load-ingredients + load-inputs # are we below the sandbox editor? click-sandbox-area?:bool <- click-on-sandbox-area? click-row, env return-unless click-sandbox-area?, 0/false @@ -94,7 +94,7 @@ def should-attempt-delete? click-row:num, click-column:num, env:&:environment -> def try-delete-sandbox click-row:num, env:&:environment -> clicked-on-delete-button?:bool, env:&:environment [ local-scope - load-ingredients + load-inputs # identify the sandbox to delete, if the click was actually on the 'delete' button sandbox:&:sandbox <- find-sandbox env, click-row return-unless sandbox, 0/false @@ -104,7 +104,7 @@ def try-delete-sandbox click-row:num, env:&:environment -> clicked-on-delete-but def delete-sandbox env:&:environment, sandbox:&:sandbox -> env:&:environment [ local-scope - load-ingredients + load-inputs curr-sandbox:&:sandbox <- get *env, sandbox:offset first-sandbox?:bool <- equal curr-sandbox, sandbox { diff --git a/sandbox/008-sandbox-edit.mu b/sandbox/008-sandbox-edit.mu index aef61619..3cef65ce 100644 --- a/sandbox/008-sandbox-edit.mu +++ b/sandbox/008-sandbox-edit.mu @@ -122,7 +122,7 @@ after <global-touch> [ # some preconditions for attempting to edit a sandbox def should-attempt-edit? click-row:num, click-column:num, env:&:environment -> result:bool [ local-scope - load-ingredients + load-inputs # are we below the sandbox editor? click-sandbox-area?:bool <- click-on-sandbox-area? click-row, env return-unless click-sandbox-area?, 0/false @@ -141,7 +141,7 @@ def should-attempt-edit? click-row:num, click-column:num, env:&:environment -> r def try-edit-sandbox click-row:num, env:&:environment -> clicked-on-edit-button?:bool, env:&:environment [ local-scope - load-ingredients + load-inputs # identify the sandbox to edit, if the click was actually on the 'edit' button sandbox:&:sandbox <- find-sandbox env, click-row return-unless sandbox, 0/false diff --git a/sandbox/009-sandbox-test.mu b/sandbox/009-sandbox-test.mu index 2bd3aac9..3fd4dafc 100644 --- a/sandbox/009-sandbox-test.mu +++ b/sandbox/009-sandbox-test.mu @@ -153,7 +153,7 @@ after <global-touch> [ def find-click-in-sandbox-output env:&:environment, click-row:num -> sandbox:&:sandbox, sandbox-index:num [ local-scope - load-ingredients + load-inputs # assert click-row >= sandbox.starting-row-on-screen sandbox:&:sandbox <- get *env, sandbox:offset start:num <- get *sandbox, starting-row-on-screen:offset @@ -181,7 +181,7 @@ def find-click-in-sandbox-output env:&:environment, click-row:num -> sandbox:&:s def toggle-expected-response sandbox:&:sandbox -> sandbox:&:sandbox [ local-scope - load-ingredients + load-inputs expected-response:text <- get *sandbox, expected-response:offset { # if expected-response is set, reset @@ -208,7 +208,7 @@ after <render-sandbox-response> [ def render-sandbox-response screen:&:screen, sandbox:&:sandbox, left:num, right:num -> row:num, screen:&:screen [ local-scope - load-ingredients + load-inputs sandbox-response:text <- get *sandbox, response:offset expected-response:text <- get *sandbox, expected-response:offset row:num <- get *sandbox response-starting-row-on-screen:offset diff --git a/sandbox/010-sandbox-trace.mu b/sandbox/010-sandbox-trace.mu index 2c4e40cc..6d775322 100644 --- a/sandbox/010-sandbox-trace.mu +++ b/sandbox/010-sandbox-trace.mu @@ -164,7 +164,7 @@ container sandbox [ # replaced in a later layer def! update-sandbox sandbox:&:sandbox, env:&:environment, idx:num -> sandbox:&:sandbox, env:&:environment [ local-scope - load-ingredients + load-inputs data:text <- get *sandbox, data:offset response:text, _, fake-screen:&:screen, trace:text <- run-sandboxed data *sandbox <- put *sandbox, response:offset, response @@ -201,7 +201,7 @@ after <global-touch> [ def find-click-in-sandbox-code env:&:environment, click-row:num -> sandbox:&:sandbox [ local-scope - load-ingredients + load-inputs # assert click-row >= sandbox.starting-row-on-screen sandbox <- get *env, sandbox:offset start:num <- get *sandbox, starting-row-on-screen:offset diff --git a/sandbox/011-errors.mu b/sandbox/011-errors.mu index 05f6a0af..893515bf 100644 --- a/sandbox/011-errors.mu +++ b/sandbox/011-errors.mu @@ -7,7 +7,7 @@ container environment [ # load code from disk, save any errors def! update-recipes env:&:environment, resources:&:resources, screen:&:screen -> errors-found?:bool, env:&:environment, screen:&:screen [ local-scope - load-ingredients + load-inputs in:text <- slurp resources, [lesson/recipes.mu] recipe-errors:text <- reload in *env <- put *env, recipe-errors:offset, recipe-errors @@ -69,7 +69,7 @@ container sandbox [ def! update-sandbox sandbox:&:sandbox, env:&:environment, idx:num -> sandbox:&:sandbox, env:&:environment [ local-scope - load-ingredients + load-inputs { recipe-errors:text <- get *env, recipe-errors:offset break-unless recipe-errors diff --git a/sandbox/012-editor-undo.mu b/sandbox/012-editor-undo.mu index 20d53f5c..e5782f0c 100644 --- a/sandbox/012-editor-undo.mu +++ b/sandbox/012-editor-undo.mu @@ -199,7 +199,7 @@ before <end-insert-enter> [ # moving the cursor can lose work on the undo stack. def add-operation editor:&:editor, op:&:operation -> editor:&:editor [ local-scope - load-ingredients + load-inputs undo:&:list:&:operation <- get *editor, undo:offset undo <- push op undo *editor <- put *editor, undo:offset, undo