From 01ce563dfe3e6cf58337708b9dbb60a8a99fa0f2 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sun, 17 Jun 2018 11:20:53 -0700 Subject: 4262 - literal 'null' --- edit/001-editor.mu | 10 +++++----- edit/002-typing.mu | 10 +++++----- edit/003-shortcuts.mu | 4 ++-- edit/004-programming-environment.mu | 8 ++++---- edit/005-sandbox.mu | 24 ++++++++++++------------ edit/006-sandbox-copy.mu | 2 +- edit/009-sandbox-test.mu | 6 +++--- edit/010-sandbox-trace.mu | 2 +- edit/011-errors.mu | 8 ++++---- edit/012-editor-undo.mu | 2 +- 10 files changed, 38 insertions(+), 38 deletions(-) (limited to 'edit') diff --git a/edit/001-editor.mu b/edit/001-editor.mu index 8855395a..963bb1cf 100644 --- a/edit/001-editor.mu +++ b/edit/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/edit/002-typing.mu b/edit/002-typing.mu index a67fcf3c..ef3f25d2 100644 --- a/edit/002-typing.mu +++ b/edit/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 [ 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/edit/003-shortcuts.mu b/edit/003-shortcuts.mu index b8f49731..872dfcea 100644 --- a/edit/003-shortcuts.mu +++ b/edit/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 scroll?:bool <- move-cursor-coordinates-left editor @@ -2616,7 +2616,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/edit/004-programming-environment.mu b/edit/004-programming-environment.mu index 1065dd64..dec8a2d5 100644 --- a/edit/004-programming-environment.mu +++ b/edit/004-programming-environment.mu @@ -6,10 +6,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/edit/005-sandbox.mu b/edit/005-sandbox.mu index ae8561a9..96ec804d 100644 --- a/edit/005-sandbox.mu +++ b/edit/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 [ @@ -170,7 +170,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 } @@ -475,8 +475,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 @@ -686,7 +686,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 @@ -939,15 +939,15 @@ after [ ] # 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/edit/006-sandbox-copy.mu b/edit/006-sandbox-copy.mu index 04d22ab5..6af72f77 100644 --- a/edit/006-sandbox-copy.mu +++ b/edit/006-sandbox-copy.mu @@ -184,7 +184,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, click-column:num, env:&:environment -> result:bool [ diff --git a/edit/009-sandbox-test.mu b/edit/009-sandbox-test.mu index b871107e..52c1e909 100644 --- a/edit/009-sandbox-test.mu +++ b/edit/009-sandbox-test.mu @@ -171,9 +171,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 ] @@ -184,7 +184,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/edit/010-sandbox-trace.mu b/edit/010-sandbox-trace.mu index cc8b2805..23b88833 100644 --- a/edit/010-sandbox-trace.mu +++ b/edit/010-sandbox-trace.mu @@ -235,7 +235,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/edit/011-errors.mu b/edit/011-errors.mu index 373193d6..47258815 100644 --- a/edit/011-errors.mu +++ b/edit/011-errors.mu @@ -310,7 +310,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| |]| ] @@ -326,7 +326,7 @@ scenario run-updates-errors-for-shape-shifting-recipes [ .recipe foo x:_elem -> z:_elem [ ┊ . . local-scope ┊─────────────────────────────────────────────────. . load-ingredients ┊0 edit copy to recipe delete . - . y:&:num <- copy 0 ┊foo 2 . + . y:&:num <- copy null ┊foo 2 . . z <- add x, y ┊foo_2: 'add' requires number ingredients, but go↩. .] ┊t 'y' . . ┊─────────────────────────────────────────────────. @@ -346,7 +346,7 @@ scenario run-updates-errors-for-shape-shifting-recipes [ .recipe foo x:_elem -> z:_elem [ ┊ . . local-scope ┊─────────────────────────────────────────────────. . load-ingredients ┊0 edit copy to recipe delete . - . y:&:num <- copy 0 ┊foo 2 . + . y:&:num <- copy null ┊foo 2 . . z <- add x, y ┊foo_3: 'add' requires number ingredients, but go↩. .] ┊t 'y' . . ┊─────────────────────────────────────────────────. @@ -367,7 +367,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/edit/012-editor-undo.mu b/edit/012-editor-undo.mu index 42d325bd..871f6c74 100644 --- a/edit/012-editor-undo.mu +++ b/edit/012-editor-undo.mu @@ -206,7 +206,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 ] -- cgit 1.4.1-2-gfad0