diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-06-17 11:20:53 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-06-17 15:57:37 -0700 |
commit | 01ce563dfe3e6cf58337708b9dbb60a8a99fa0f2 (patch) | |
tree | 696fce7bb207e77952d10b7358f4ce00faed3874 /sandbox | |
parent | dd66068298b0a11f2a1f195376cba98e0c8570b5 (diff) | |
download | mu-01ce563dfe3e6cf58337708b9dbb60a8a99fa0f2.tar.gz |
4262 - literal 'null'
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/001-editor.mu | 10 | ||||
-rw-r--r-- | sandbox/002-typing.mu | 10 | ||||
-rw-r--r-- | sandbox/003-shortcuts.mu | 4 | ||||
-rw-r--r-- | sandbox/004-programming-environment.mu | 8 | ||||
-rw-r--r-- | sandbox/005-sandbox.mu | 24 | ||||
-rw-r--r-- | sandbox/006-sandbox-copy.mu | 2 | ||||
-rw-r--r-- | sandbox/009-sandbox-test.mu | 6 | ||||
-rw-r--r-- | sandbox/010-sandbox-trace.mu | 2 | ||||
-rw-r--r-- | sandbox/011-errors.mu | 4 | ||||
-rw-r--r-- | sandbox/012-editor-undo.mu | 2 |
10 files changed, 36 insertions, 36 deletions
diff --git a/sandbox/001-editor.mu b/sandbox/001-editor.mu index 8855395a..963bb1cf 100644 --- a/sandbox/001-editor.mu +++ b/sandbox/001-editor.mu @@ -6,10 +6,10 @@ def main text:text [ local-scope load-inputs open-console - clear-screen 0/screen # non-scrolling app + clear-screen null/screen # non-scrolling app e:&:editor <- new-editor text, 0/left, 5/right - render 0/screen, e - wait-for-event 0/console + render null/screen, e + wait-for-event null/console close-console ] @@ -61,7 +61,7 @@ def new-editor s:text, left:num, right:num -> result:&:editor [ *result <- put *result, cursor-row:offset, 1/top *result <- put *result, cursor-column:offset, left # initialize empty contents - init:&:duplex-list:char <- push 167/§, 0/tail + init:&:duplex-list:char <- push 167/§, null *result <- put *result, data:offset, init *result <- put *result, top-of-screen:offset, init *result <- put *result, before-cursor:offset, init @@ -80,7 +80,7 @@ scenario editor-initializes-without-data [ local-scope assume-screen 5/width, 3/height run [ - e:&:editor <- new-editor 0/data, 2/left, 5/right + e:&:editor <- new-editor null/data, 2/left, 5/right 2:editor/raw <- copy *e ] memory-should-contain [ diff --git a/sandbox/002-typing.mu b/sandbox/002-typing.mu index a67fcf3c..ef3f25d2 100644 --- a/sandbox/002-typing.mu +++ b/sandbox/002-typing.mu @@ -6,10 +6,10 @@ def! main text:text [ local-scope load-inputs open-console - clear-screen 0/screen # non-scrolling app + clear-screen null/screen # non-scrolling app editor:&:editor <- new-editor text, 5/left, 45/right - editor-render 0/screen, editor - editor-event-loop 0/screen, 0/console, editor + editor-render null/screen, editor + editor-event-loop null/screen, null/console, editor close-console ] @@ -223,7 +223,7 @@ def insert-at-cursor editor:&:editor, c:char, screen:&:screen -> go-render?:bool next:&:duplex-list:char <- next before-cursor { # at end of all text? no need to scroll? just print the character and leave - at-end?:bool <- equal next, 0/null + at-end?:bool <- equal next, null break-unless at-end? bottom:num <- subtract screen-height, 1 at-bottom?:bool <- equal save-row, bottom @@ -701,7 +701,7 @@ after <insert-character-special-case> [ just-before-wrap?:bool <- greater-or-equal cursor-column, before-wrap-column next:&:duplex-list:char <- next before-cursor # at end of line? next == 0 || next.value == 10/newline - at-end-of-line?:bool <- equal next, 0 + at-end-of-line?:bool <- equal next, null { break-if at-end-of-line? next-character:char <- get *next, value:offset diff --git a/sandbox/003-shortcuts.mu b/sandbox/003-shortcuts.mu index db19443d..c9e66d5b 100644 --- a/sandbox/003-shortcuts.mu +++ b/sandbox/003-shortcuts.mu @@ -113,7 +113,7 @@ def delete-before-cursor editor:&:editor, screen:&:screen -> go-render?:bool, ba data:&:duplex-list:char <- get *editor, data:offset # if at start of text (before-cursor at § sentinel), return prev:&:duplex-list:char <- prev before-cursor - return-unless prev, false/no-more-render, 0/nothing-deleted + return-unless prev, false/no-more-render, null/nothing-deleted trace 10, [app], [delete-before-cursor] original-row:num <- get *editor, cursor-row:offset move-cursor-coordinates-left editor @@ -2353,7 +2353,7 @@ def delete-to-end-of-line editor:&:editor -> result:&:duplex-list:char, editor:& start:&:duplex-list:char <- get *editor, before-cursor:offset end:&:duplex-list:char <- next start { - at-end-of-text?:bool <- equal end, 0/null + at-end-of-text?:bool <- equal end, null break-if at-end-of-text? curr:char <- get *end, value:offset at-end-of-line?:bool <- equal curr, 10/newline diff --git a/sandbox/004-programming-environment.mu b/sandbox/004-programming-environment.mu index 1208d0e8..1454144b 100644 --- a/sandbox/004-programming-environment.mu +++ b/sandbox/004-programming-environment.mu @@ -3,10 +3,10 @@ def! main [ local-scope open-console - clear-screen 0/screen # non-scrolling app - env:&:environment <- new-programming-environment 0/filesystem, 0/screen - render-all 0/screen, env, render - event-loop 0/screen, 0/console, env, 0/filesystem + clear-screen null/screen # non-scrolling app + env:&:environment <- new-programming-environment null/filesystem, null/screen + render-all null/screen, env, render + event-loop null/screen, null/console, env, null/filesystem ] container environment [ diff --git a/sandbox/005-sandbox.mu b/sandbox/005-sandbox.mu index ae4372a1..632a5df1 100644 --- a/sandbox/005-sandbox.mu +++ b/sandbox/005-sandbox.mu @@ -10,11 +10,11 @@ def! main [ local-scope open-console - clear-screen 0/screen # non-scrolling app - env:&:environment <- new-programming-environment 0/filesystem, 0/screen - env <- restore-sandboxes env, 0/filesystem - render-all 0/screen, env, render - event-loop 0/screen, 0/console, env, 0/filesystem + clear-screen null/screen # non-scrolling app + env:&:environment <- new-programming-environment null/filesystem, null/screen + env <- restore-sandboxes env, null/filesystem + render-all null/screen, env, render + event-loop null/screen, null/console, env, null/filesystem ] container environment [ @@ -160,7 +160,7 @@ def run-sandboxes env:&:environment, resources:&:resources, screen:&:screen -> e # needs to be before running them, in case we die when running save-sandboxes env, resources # clear sandbox editor - init:&:duplex-list:char <- push 167/§, 0/tail + init:&:duplex-list:char <- push 167/§, null *current-sandbox <- put *current-sandbox, data:offset, init *current-sandbox <- put *current-sandbox, top-of-screen:offset, init } @@ -458,8 +458,8 @@ def restore-sandboxes env:&:environment, resources:&:resources -> env:&:environm load-inputs # read all scenarios, pushing them to end of a list of scenarios idx:num <- copy 0 - curr:&:sandbox <- copy 0 - prev:&:sandbox <- copy 0 + curr:&:sandbox <- copy null + prev:&:sandbox <- copy null { filename:text <- append [lesson/], idx contents:text <- slurp resources, filename @@ -668,7 +668,7 @@ def editor-contents editor:&:editor -> result:text [ # skip § sentinel assert curr, [editor without data is illegal; must have at least a sentinel] curr <- next curr - return-unless curr, 0 + return-unless curr, null { break-unless curr c:char <- get *curr, value:offset @@ -817,15 +817,15 @@ after <global-keypress> [ ] # sandbox belonging to 'env' whose next-sandbox is 'in' -# return 0 if there's no such sandbox, either because 'in' doesn't exist in 'env', or because it's the first sandbox +# return null 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-inputs curr:&:sandbox <- get *env, sandbox:offset - return-unless curr, 0/nil + return-unless curr, null next:&:sandbox <- get *curr, next-sandbox:offset { - return-unless next, 0/nil + return-unless next, null found?:bool <- equal next, in break-if found? curr <- copy next diff --git a/sandbox/006-sandbox-copy.mu b/sandbox/006-sandbox-copy.mu index 4b7222f3..0eae6cf7 100644 --- a/sandbox/006-sandbox-copy.mu +++ b/sandbox/006-sandbox-copy.mu @@ -194,7 +194,7 @@ def find-sandbox env:&:environment, click-row:num -> result:&:sandbox [ curr-sandbox <- get *curr-sandbox, next-sandbox:offset loop } - return 0/not-found + return null/not-found ] def click-on-sandbox-area? click-row:num, env:&:environment -> result:bool [ diff --git a/sandbox/009-sandbox-test.mu b/sandbox/009-sandbox-test.mu index 3fd4dafc..c22916a7 100644 --- a/sandbox/009-sandbox-test.mu +++ b/sandbox/009-sandbox-test.mu @@ -173,9 +173,9 @@ def find-click-in-sandbox-output env:&:environment, click-row:num -> sandbox:&:s } # return sandbox if click is in its output region response-starting-row:num <- get *sandbox, response-starting-row-on-screen:offset - return-unless response-starting-row, 0/no-click-in-sandbox-output, 0/sandbox-index + return-unless response-starting-row, null/no-click-in-sandbox-output, 0/sandbox-index click-in-response?:bool <- greater-or-equal click-row, response-starting-row - return-unless click-in-response?, 0/no-click-in-sandbox-output, 0/sandbox-index + return-unless click-in-response?, null/no-click-in-sandbox-output, 0/sandbox-index return sandbox, sandbox-index ] @@ -186,7 +186,7 @@ def toggle-expected-response sandbox:&:sandbox -> sandbox:&:sandbox [ { # if expected-response is set, reset break-unless expected-response - *sandbox <- put *sandbox, expected-response:offset, 0 + *sandbox <- put *sandbox, expected-response:offset, null } { # if not, set expected response to the current response diff --git a/sandbox/010-sandbox-trace.mu b/sandbox/010-sandbox-trace.mu index 6d775322..d544dd8c 100644 --- a/sandbox/010-sandbox-trace.mu +++ b/sandbox/010-sandbox-trace.mu @@ -225,7 +225,7 @@ def find-click-in-sandbox-code env:&:environment, click-row:num -> sandbox:&:san click-on-sandbox-code?:bool <- and click-above-response?, click-below-menu? { break-if click-on-sandbox-code? - return 0/no-click-in-sandbox-output + return null/no-click-in-sandbox-output } return sandbox ] diff --git a/sandbox/011-errors.mu b/sandbox/011-errors.mu index 8678989f..2f59d1fe 100644 --- a/sandbox/011-errors.mu +++ b/sandbox/011-errors.mu @@ -253,7 +253,7 @@ scenario run-updates-errors-for-shape-shifting-recipes [ |recipe foo x:_elem -> z:_elem [| | local-scope| | load-ingredients| - | y:&:num <- copy 0| + | y:&:num <- copy null| | z <- add x, y| |]| ] @@ -308,7 +308,7 @@ scenario run-avoids-spurious-errors-on-reloading-shape-shifting-recipes [ ] ] # call code that uses other variants of it, but not it itself - test-sandbox:text <- new [x:&:list:num <- copy 0 + test-sandbox:text <- new [x:&:list:num <- copy null to-text x] env:&:environment <- new-programming-environment resources, screen, test-sandbox render-all screen, env, render diff --git a/sandbox/012-editor-undo.mu b/sandbox/012-editor-undo.mu index 23448ea2..69afd207 100644 --- a/sandbox/012-editor-undo.mu +++ b/sandbox/012-editor-undo.mu @@ -204,7 +204,7 @@ def add-operation editor:&:editor, op:&:operation -> editor:&:editor [ undo <- push op undo *editor <- put *editor, undo:offset, undo redo:&:list:&:operation <- get *editor, redo:offset - redo <- copy 0 + redo <- copy null *editor <- put *editor, redo:offset, redo ] |