about summary refs log tree commit diff stats
path: root/sandbox
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-03-14 13:00:21 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-03-14 13:00:21 -0700
commit44bab2e4b4c8252b20c848108fa7bf9e33e2b26a (patch)
tree59312503c564a69b33105fe5801e5f79db65587e /sandbox
parent3c393fd2449ebdd362f39873106199f089ed6718 (diff)
downloadmu-44bab2e4b4c8252b20c848108fa7bf9e33e2b26a.tar.gz
2782 - directly use string literals everywhere
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/004-programming-environment.mu6
-rw-r--r--sandbox/005-sandbox.mu13
-rw-r--r--sandbox/008-sandbox-test.mu2
-rw-r--r--sandbox/010-errors.mu9
4 files changed, 10 insertions, 20 deletions
diff --git a/sandbox/004-programming-environment.mu b/sandbox/004-programming-environment.mu
index 8c6e58cb..bbbb45e2 100644
--- a/sandbox/004-programming-environment.mu
+++ b/sandbox/004-programming-environment.mu
@@ -31,8 +31,7 @@ def new-programming-environment screen:address:shared:screen, initial-sandbox-co
   button-on-screen?:boolean <- greater-or-equal button-start, 0
   assert button-on-screen?, [screen too narrow for menu]
   screen <- move-cursor screen, 0/row, button-start
-  run-button:address:shared:array:character <- new [ run (F4) ]
-  print screen, run-button, 255/white, 161/reddish
+  print screen, [ run (F4) ], 255/white, 161/reddish
   # sandbox editor
   current-sandbox:address:address:shared:editor-data <- get-address *result, current-sandbox:offset
   *current-sandbox <- new-editor initial-sandbox-contents, screen, 0, width/right
@@ -165,8 +164,7 @@ def render-all screen:address:shared:screen, env:address:shared:programming-envi
   button-on-screen?:boolean <- greater-or-equal button-start, 0
   assert button-on-screen?, [screen too narrow for menu]
   screen <- move-cursor screen, 0/row, button-start
-  run-button:address:shared:array:character <- new [ run (F4) ]
-  print screen, run-button, 255/white, 161/reddish
+  print screen, [ run (F4) ], 255/white, 161/reddish
   #
   screen <- render-sandbox-side screen, env
   <render-components-end>
diff --git a/sandbox/005-sandbox.mu b/sandbox/005-sandbox.mu
index a9c07e5e..57a4f5cf 100644
--- a/sandbox/005-sandbox.mu
+++ b/sandbox/005-sandbox.mu
@@ -112,8 +112,7 @@ after <global-keypress> [
   {
     do-run?:boolean <- equal *k, 65532/F4
     break-unless do-run?
-    status:address:shared:array:character <- new [running...       ]
-    screen <- update-status screen, status, 245/grey
+    screen <- update-status screen, [running...       ], 245/grey
     test-recipes:address:shared:array:character, _/optional <- next-ingredient
     error?:boolean, env, screen <- run-sandboxes env, screen, test-recipes
 #?     test-recipes <- copy 0  # abandon
@@ -121,8 +120,7 @@ after <global-keypress> [
     screen <- render-all screen, env
     {
       break-if error?
-      status:address:shared:array:character <- new [                 ]
-      screen <- update-status screen, status, 245/grey
+      screen <- update-status screen, [                 ], 245/grey
     }
     screen <- update-cursor screen, current-sandbox, env
     loop +next-event:label
@@ -214,7 +212,6 @@ def save-sandboxes env:address:shared:programming-environment-data [
   # first clear previous versions, in case we deleted some sandbox
   $system [rm lesson/[0-9]* >/dev/null 2>/dev/null]  # some shells can't handle '>&'
   curr:address:shared:sandbox-data <- get *env, sandbox:offset
-  suffix:address:shared:array:character <- new [.out]
   idx:number <- copy 0
   {
     break-unless curr
@@ -320,7 +317,6 @@ def! restore-sandboxes env:address:shared:programming-environment-data -> env:ad
   local-scope
   load-ingredients
   # read all scenarios, pushing them to end of a list of scenarios
-  suffix:address:shared:array:character <- new [.out]
   idx:number <- copy 0
   curr:address:address:shared:sandbox-data <- get-address *env, sandbox:offset
   {
@@ -333,7 +329,7 @@ def! restore-sandboxes env:address:shared:programming-environment-data -> env:ad
     *data <- copy contents
     # restore expected output for sandbox if it exists
     {
-      filename <- append filename, suffix
+      filename <- append filename, [.out]
       contents <- restore filename
       break-unless contents
       <end-restore-sandbox>
@@ -355,8 +351,7 @@ def render-screen screen:address:shared:screen, sandbox-screen:address:shared:sc
   load-ingredients
   return-unless sandbox-screen
   # print 'screen:'
-  header:address:shared:array:character <- new [screen:]
-  row <- render screen, header, left, right, 245/grey, row
+  row <- render screen, [screen:], left, right, 245/grey, row
   screen <- move-cursor screen, row, left
   # start printing sandbox-screen
   column:number <- copy left
diff --git a/sandbox/008-sandbox-test.mu b/sandbox/008-sandbox-test.mu
index a7010190..b64a5980 100644
--- a/sandbox/008-sandbox-test.mu
+++ b/sandbox/008-sandbox-test.mu
@@ -92,7 +92,7 @@ before <end-save-sandbox> [
   {
     expected-response:address:shared:array:character <- get *curr, expected-response:offset
     break-unless expected-response
-    filename <- append filename, suffix
+    filename <- append filename, [.out]
     save filename, expected-response
   }
 ]
diff --git a/sandbox/010-errors.mu b/sandbox/010-errors.mu
index 1a84764d..b76c9fc0 100644
--- a/sandbox/010-errors.mu
+++ b/sandbox/010-errors.mu
@@ -22,8 +22,7 @@ def! update-recipes env:address:shared:programming-environment-data, screen:addr
   # if recipe editor has errors, stop
   {
     break-unless *recipe-errors
-    status:address:shared:array:character <- new [errors found     ]
-    update-status screen, status, 1/red
+    update-status screen, [errors found     ], 1/red
     errors-found? <- copy 1/true
     return
   }
@@ -35,8 +34,7 @@ before <render-components-end> [
   recipe-errors:address:shared:array:character <- get *env, recipe-errors:offset
   {
     break-unless recipe-errors
-    status:address:shared:array:character <- new [errors found     ]
-    update-status screen, status, 1/red
+    update-status screen, [errors found     ], 1/red
   }
 ]
 
@@ -68,9 +66,8 @@ before <render-components-end> [
     error-index:number <- get *env, error-index:offset
     sandboxes-completed-successfully?:boolean <- equal error-index, -1
     break-if sandboxes-completed-successfully?
-    status-template:address:shared:array:character <- new [errors found (_)    ]
     error-index-text:address:shared:array:character <- to-text error-index
-    status:address:shared:array:character <- interpolate status-template, error-index-text
+    status:address:shared:array:character <- interpolate [errors found (_)    ], error-index-text
     update-status screen, status, 1/red
   }
 ]