diff options
author | Kartik Agaram <vc@akkartik.com> | 2021-02-07 00:17:17 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2021-02-07 00:20:29 -0800 |
commit | 74f1512ff113cf35706af57e9d40c78b7d77f49e (patch) | |
tree | 7c7acb23e1a26387117e464ec6ab01126dbc8ae8 /apps/tile | |
parent | 6c4c25555c7df0d78ad41c813345f63cae1819de (diff) | |
download | mu-74f1512ff113cf35706af57e9d40c78b7d77f49e.tar.gz |
7690
Convert comments about magic constants into metadata.
Diffstat (limited to 'apps/tile')
-rw-r--r-- | apps/tile/box.mu | 4 | ||||
-rw-r--r-- | apps/tile/data.mu | 18 | ||||
-rw-r--r-- | apps/tile/environment.mu | 228 | ||||
-rw-r--r-- | apps/tile/float-stack.mu | 4 | ||||
-rw-r--r-- | apps/tile/gap-buffer.mu | 18 | ||||
-rw-r--r-- | apps/tile/grapheme-stack.mu | 12 | ||||
-rw-r--r-- | apps/tile/main.mu | 18 | ||||
-rw-r--r-- | apps/tile/rpn.mu | 52 | ||||
-rw-r--r-- | apps/tile/surface.mu | 12 | ||||
-rw-r--r-- | apps/tile/table.mu | 2 | ||||
-rw-r--r-- | apps/tile/value-stack.mu | 12 | ||||
-rw-r--r-- | apps/tile/value.mu | 62 | ||||
-rw-r--r-- | apps/tile/word.mu | 12 |
13 files changed, 227 insertions, 227 deletions
diff --git a/apps/tile/box.mu b/apps/tile/box.mu index c4fa4ad2..859d0b8e 100644 --- a/apps/tile/box.mu +++ b/apps/tile/box.mu @@ -78,7 +78,7 @@ fn clear-rect screen: (addr screen), row1: int, col1: int, row2: int, col2: int { compare j, col2 break-if-> - print-grapheme screen 0x20 # space + print-grapheme screen 0x20/space j <- increment loop } @@ -98,7 +98,7 @@ fn clear-rect2 screen: (addr screen), row1: int, col1: int, w: int, h: int { { compare j, h break-if->= - print-grapheme screen 0x20 # space + print-grapheme screen 0x20/space j <- increment loop } diff --git a/apps/tile/data.mu b/apps/tile/data.mu index 6968d880..d711e7d7 100644 --- a/apps/tile/data.mu +++ b/apps/tile/data.mu @@ -248,7 +248,7 @@ fn function-body functions: (addr handle function), _word: (addr handle word), o var curr-name-ah/eax: (addr handle array byte) <- get curr, name var curr-name/eax: (addr array byte) <- lookup *curr-name-ah var found?/eax: boolean <- string-equal? curr-name, function-name - compare found?, 0 # false + compare found?, 0/false { break-if-= var src/eax: (addr handle line) <- get curr, body @@ -333,16 +333,16 @@ fn find-in-call-paths call-paths: (addr handle call-path), needle: (addr handle { var curr-data/eax: (addr handle call-path-element) <- get curr, data var match?/eax: boolean <- call-path-element-match? curr-data, needle - compare match?, 0 # false + compare match?, 0/false { break-if-= - return 1 # true + return 1/true } } curr-ah <- get curr, next loop } - return 0 # false + return 0/false } fn call-path-element-match? _x: (addr handle call-path-element), _y: (addr handle call-path-element) -> _/eax: boolean { @@ -355,17 +355,17 @@ fn call-path-element-match? _x: (addr handle call-path-element), _y: (addr handl compare x, y { break-if-!= - return 1 # true + return 1/true } compare x, 0 { break-if-!= - return 0 # false + return 0/false } compare y, 0 { break-if-!= - return 0 # false + return 0/false } # compare word addresses, not contents var x-data-ah/ecx: (addr handle word) <- get x, word @@ -382,7 +382,7 @@ fn call-path-element-match? _x: (addr handle call-path-element), _y: (addr handl compare x-data, y-data { break-if-= - return 0 # false + return 0/false } var x-next/ecx: (addr handle call-path-element) <- get x, next var y-next/eax: (addr handle call-path-element) <- get y, next @@ -437,7 +437,7 @@ fn delete-in-call-path list: (addr handle call-path), needle: (addr handle call- { var curr-data/eax: (addr handle call-path-element) <- get curr, data var match?/eax: boolean <- call-path-element-match? curr-data, needle - compare match?, 0 # false + compare match?, 0/false { break-if-= var next-ah/ecx: (addr handle call-path) <- get curr, next diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index 3517e0ef..de771dee 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -106,14 +106,14 @@ fn process-goto-dialog _self: (addr environment), key: grapheme { var self/esi: (addr environment) <- copy _self var fn-name-ah/edi: (addr handle word) <- get self, partial-function-name # if 'esc' pressed, cancel goto - compare key, 0x1b # esc + compare key, 0x1b/esc $process-goto-dialog:cancel: { break-if-!= clear-object fn-name-ah return } # if 'enter' pressed, location function and set cursor to it - compare key, 0xa # enter + compare key, 0xa/enter $process-goto-dialog:commit: { break-if-!= #? print-string 0, "jump\n" @@ -127,13 +127,13 @@ fn process-goto-dialog _self: (addr environment), key: grapheme { return } # - compare key, 0x7f # del (backspace on Macs) + compare key, 0x7f/del # backspace on Macs $process-goto-dialog:backspace: { break-if-!= # if not at start, delete grapheme before cursor var fn-name/eax: (addr word) <- lookup *fn-name-ah var at-start?/eax: boolean <- cursor-at-start? fn-name - compare at-start?, 0 # false + compare at-start?, 0/false { break-if-!= var fn-name/eax: (addr word) <- lookup *fn-name-ah @@ -144,7 +144,7 @@ fn process-goto-dialog _self: (addr environment), key: grapheme { # otherwise insert key within current word var print?/eax: boolean <- real-grapheme? key $process-goto-dialog:real-grapheme: { - compare print?, 0 # false + compare print?, 0/false break-if-= var fn-name/eax: (addr word) <- lookup *fn-name-ah add-grapheme-to-word fn-name, key @@ -165,13 +165,13 @@ fn process-function-edit _self: (addr environment), _function: (addr function), var cursor-word-ah/ebx: (addr handle word) <- get function, cursor-word var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah var cursor-word/ecx: (addr word) <- copy _cursor-word - compare key, 0x445b1b # left-arrow + compare key, 0x445b1b/left-arrow $process-function-edit:key-left-arrow: { break-if-!= #? print-string 0, "left-arrow\n" # if not at start, move left within current word var at-start?/eax: boolean <- cursor-at-start? cursor-word - compare at-start?, 0 # false + compare at-start?, 0/false { break-if-!= #? print-string 0, "cursor left within word\n" @@ -190,12 +190,12 @@ fn process-function-edit _self: (addr environment), _function: (addr function), } return } - compare key, 0x435b1b # right-arrow + compare key, 0x435b1b/right-arrow $process-function-edit:key-right-arrow: { break-if-!= # if not at end, move right within current word var at-end?/eax: boolean <- cursor-at-end? cursor-word - compare at-end?, 0 # false + compare at-end?, 0/false { break-if-!= cursor-right cursor-word @@ -213,7 +213,7 @@ fn process-function-edit _self: (addr environment), _function: (addr function), return } # word-based motions - compare key, 2 # ctrl-b + compare key, 2/ctrl-b $process-function-edit:prev-word: { break-if-!= # jump to previous word if possible @@ -227,7 +227,7 @@ fn process-function-edit _self: (addr environment), _function: (addr function), } return } - compare key, 6 # ctrl-f + compare key, 6/ctrl-f $process-function-edit:next-word: { break-if-!= # jump to previous word if possible @@ -242,7 +242,7 @@ fn process-function-edit _self: (addr environment), _function: (addr function), return } # line-based motions - compare key, 1 # ctrl-a + compare key, 1/ctrl-a $process-function-edit:start-of-line: { break-if-!= # move cursor to start of first word @@ -254,7 +254,7 @@ fn process-function-edit _self: (addr environment), _function: (addr function), cursor-to-start body-contents return } - compare key, 5 # ctrl-e + compare key, 5/ctrl-e $process-function-edit:end-of-line: { break-if-!= # move cursor to end of final word @@ -268,7 +268,7 @@ fn process-function-edit _self: (addr environment), _function: (addr function), return } # bounce to another function - compare key, 7 # ctrl-g + compare key, 7/ctrl-g $process-function-edit:goto-function: { break-if-!= # initialize dialog to name function to jump to @@ -279,7 +279,7 @@ fn process-function-edit _self: (addr environment), _function: (addr function), return } # bounce to sandbox - compare key, 9 # tab + compare key, 9/tab $process-function-edit:goto-sandbox: { break-if-!= var function-ah/eax: (addr handle function) <- get self, cursor-function @@ -287,12 +287,12 @@ fn process-function-edit _self: (addr environment), _function: (addr function), return } # editing the current function - compare key, 0x7f # del (backspace on Macs) + compare key, 0x7f/del # backspace on Macs $process-function-edit:backspace: { break-if-!= # if not at start of some word, delete grapheme before cursor within current word var at-start?/eax: boolean <- cursor-at-start? cursor-word - compare at-start?, 0 # false + compare at-start?, 0/false { break-if-!= delete-before-cursor cursor-word @@ -310,14 +310,14 @@ fn process-function-edit _self: (addr environment), _function: (addr function), } return } - compare key, 0x20 # space + compare key, 0x20/space $process-function-edit:space: { break-if-!= #? print-string 0, "space\n" # if cursor is at start of word, insert word before { var at-start?/eax: boolean <- cursor-at-start? cursor-word - compare at-start?, 0 # false + compare at-start?, 0/false break-if-= var prev-word-ah/eax: (addr handle word) <- get cursor-word, prev append-word prev-word-ah @@ -329,10 +329,10 @@ fn process-function-edit _self: (addr environment), _function: (addr function), # TODO: support string escaping { var first-grapheme/eax: grapheme <- first-grapheme cursor-word - compare first-grapheme, 0x22 # double quote + compare first-grapheme, 0x22/double-quote break-if-!= var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word - compare final-grapheme, 0x22 # double quote + compare final-grapheme, 0x22/double-quote break-if-= break $process-function-edit:space } @@ -340,10 +340,10 @@ fn process-function-edit _self: (addr environment), _function: (addr function), # TODO: support nested arrays { var first-grapheme/eax: grapheme <- first-grapheme cursor-word - compare first-grapheme, 0x5b # '[' + compare first-grapheme, 0x5b/[ break-if-!= var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word - compare final-grapheme, 0x5d # ']' + compare final-grapheme, 0x5d/] break-if-= break $process-function-edit:space } @@ -354,7 +354,7 @@ fn process-function-edit _self: (addr environment), _function: (addr function), copy-object next-word-ah, cursor-word-ah # if cursor is at end of word, that's all var at-end?/eax: boolean <- cursor-at-end? cursor-word - compare at-end?, 0 # false + compare at-end?, 0/false { break-if-= return @@ -366,7 +366,7 @@ fn process-function-edit _self: (addr environment), _function: (addr function), var next-word/ebx: (addr word) <- copy _next-word { var at-end?/eax: boolean <- cursor-at-end? cursor-word - compare at-end?, 0 # false + compare at-end?, 0/false break-if-!= var g/eax: grapheme <- pop-after-cursor cursor-word add-grapheme-to-word next-word, g @@ -379,7 +379,7 @@ fn process-function-edit _self: (addr environment), _function: (addr function), var g/edx: grapheme <- copy key var print?/eax: boolean <- real-grapheme? key $process-function-edit:real-grapheme: { - compare print?, 0 # false + compare print?, 0/false break-if-= add-grapheme-to-word cursor-word, g return @@ -421,13 +421,13 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key var cursor-word-ah/ebx: (addr handle word) <- get cursor-call-path, word var _cursor-word/eax: (addr word) <- lookup *cursor-word-ah var cursor-word/ecx: (addr word) <- copy _cursor-word - compare key, 0x445b1b # left-arrow + compare key, 0x445b1b/left-arrow $process-sandbox-edit:key-left-arrow: { break-if-!= #? print-string 0, "left-arrow\n" # if not at start, move left within current word var at-start?/eax: boolean <- cursor-at-start? cursor-word - compare at-start?, 0 # false + compare at-start?, 0/false { break-if-!= #? print-string 0, "cursor left within word\n" @@ -439,7 +439,7 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key var cursor-call-path/esi: (addr handle call-path-element) <- get sandbox, cursor-call-path var expanded-words/edx: (addr handle call-path) <- get sandbox, expanded-words var curr-word-is-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path - compare curr-word-is-expanded?, 0 # false + compare curr-word-is-expanded?, 0/false break-if-= # update cursor-call-path #? print-string 0, "curr word is expanded\n" @@ -519,12 +519,12 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key } return } - compare key, 0x435b1b # right-arrow + compare key, 0x435b1b/right-arrow $process-sandbox-edit:key-right-arrow: { break-if-!= # if not at end, move right within current word var at-end?/eax: boolean <- cursor-at-end? cursor-word - compare at-end?, 0 # false + compare at-end?, 0/false { break-if-!= #? print-string 0, "a\n" @@ -564,7 +564,7 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key { var expanded-words/eax: (addr handle call-path) <- get sandbox, expanded-words var curr-word-is-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path - compare curr-word-is-expanded?, 0 # false + compare curr-word-is-expanded?, 0/false break-if-= $process-sandbox-edit:key-right-arrow-next-word-is-call-expanded } var callee-h: (handle function) @@ -588,14 +588,14 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key } return } - compare key, 0xa # enter + compare key, 0xa/enter { break-if-!= # toggle display of subsidiary stack toggle-cursor-word sandbox return } - compare key, 0xc # ctrl-l + compare key, 0xc/ctrl-l $process-sandbox-edit:new-line: { break-if-!= # new line in sandbox @@ -603,7 +603,7 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key return } # word-based motions - compare key, 2 # ctrl-b + compare key, 2/ctrl-b $process-sandbox-edit:prev-word: { break-if-!= # jump to previous word at same level @@ -638,7 +638,7 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key return } } - compare key, 6 # ctrl-f + compare key, 6/ctrl-f $process-sandbox-edit:next-word: { break-if-!= #? print-string 0, "AA\n" @@ -666,7 +666,7 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key copy-object caller-cursor-element-ah, cursor-call-path-ah return } - compare key, 7 # ctrl-g + compare key, 7/ctrl-g $process-sandbox-edit:goto-function: { break-if-!= # initialize dialog to name function to jump to @@ -677,7 +677,7 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key return } # line-based motions - compare key, 1 # ctrl-a + compare key, 1/ctrl-a $process-sandbox-edit:start-of-line: { break-if-!= # move cursor up past all calls and to start of line @@ -693,7 +693,7 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key # but we don't expect to see zero-arg functions first-up return } - compare key, 5 # ctrl-e + compare key, 5/ctrl-e $process-sandbox-edit:end-of-line: { break-if-!= # move cursor up past all calls and to start of line @@ -709,7 +709,7 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key # so the final word is always guaranteed to be at the top-level return } - compare key, 0x15 # ctrl-u + compare key, 0x15/ctrl-u $process-sandbox-edit:clear-line: { break-if-!= # clear line in sandbox @@ -727,12 +727,12 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key return } # - remaining keys only work at the top row outside any function calls - compare key, 0x7f # del (backspace on Macs) + compare key, 0x7f/del # backspace on Macs $process-sandbox-edit:backspace: { break-if-!= # if not at start of some word, delete grapheme before cursor within current word var at-start?/eax: boolean <- cursor-at-start? cursor-word - compare at-start?, 0 # false + compare at-start?, 0/false { break-if-!= delete-before-cursor cursor-word @@ -751,14 +751,14 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key } return } - compare key, 0x20 # space + compare key, 0x20/space $process-sandbox-edit:space: { break-if-!= #? print-string 0, "space\n" # if cursor is at start of word, insert word before { var at-start?/eax: boolean <- cursor-at-start? cursor-word - compare at-start?, 0 # false + compare at-start?, 0/false break-if-= var prev-word-ah/eax: (addr handle word) <- get cursor-word, prev append-word prev-word-ah @@ -770,10 +770,10 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key # TODO: support string escaping { var first-grapheme/eax: grapheme <- first-grapheme cursor-word - compare first-grapheme, 0x22 # double quote + compare first-grapheme, 0x22/double-quote break-if-!= var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word - compare final-grapheme, 0x22 # double quote + compare final-grapheme, 0x22/double-quote break-if-= break $process-sandbox-edit:space } @@ -781,10 +781,10 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key # TODO: support nested arrays { var first-grapheme/eax: grapheme <- first-grapheme cursor-word - compare first-grapheme, 0x5b # '[' + compare first-grapheme, 0x5b/[ break-if-!= var final-grapheme/eax: grapheme <- grapheme-before-cursor cursor-word - compare final-grapheme, 0x5d # ']' + compare final-grapheme, 0x5d/] break-if-= break $process-sandbox-edit:space } @@ -795,7 +795,7 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key increment-final-element cursor-call-path # if cursor is at end of word, that's all var at-end?/eax: boolean <- cursor-at-end? cursor-word - compare at-end?, 0 # false + compare at-end?, 0/false { break-if-= return @@ -807,7 +807,7 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key var next-word/ebx: (addr word) <- copy _next-word { var at-end?/eax: boolean <- cursor-at-end? cursor-word - compare at-end?, 0 # false + compare at-end?, 0/false break-if-!= var g/eax: grapheme <- pop-after-cursor cursor-word add-grapheme-to-word next-word, g @@ -816,7 +816,7 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key cursor-to-start next-word return } - compare key, 0xe # ctrl-n + compare key, 0xe/ctrl-n $process:rename-word: { break-if-!= # TODO: ensure current word is not a function @@ -827,7 +827,7 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key initialize-word new-name return } - compare key, 4 # ctrl-d + compare key, 4/ctrl-d $process:define-function: { break-if-!= # define function out of line at cursor @@ -841,7 +841,7 @@ fn process-sandbox-edit _self: (addr environment), _sandbox: (addr sandbox), key var g/edx: grapheme <- copy key var print?/eax: boolean <- real-grapheme? key $process-sandbox-edit:real-grapheme: { - compare print?, 0 # false + compare print?, 0/false break-if-= add-grapheme-to-word cursor-word, g return @@ -856,14 +856,14 @@ fn process-sandbox-rename _sandbox: (addr sandbox), key: grapheme { var sandbox/esi: (addr sandbox) <- copy _sandbox var new-name-ah/edi: (addr handle word) <- get sandbox, partial-name-for-cursor-word # if 'esc' pressed, cancel rename - compare key, 0x1b # esc + compare key, 0x1b/esc $process-sandbox-rename:cancel: { break-if-!= clear-object new-name-ah return } # if 'enter' pressed, perform rename - compare key, 0xa # enter + compare key, 0xa/enter $process-sandbox-rename:commit: { break-if-!= #? print-string 0, "rename\n" @@ -911,7 +911,7 @@ fn process-sandbox-rename _sandbox: (addr sandbox), key: grapheme { { var new-name/eax: (addr word) <- lookup *new-name-ah cursor-to-start new-name - add-grapheme-to-word new-name, 0x3d # '=' + add-grapheme-to-word new-name, 0x3d/= } # append name to new line chain-words new-line-word-ah, new-name-ah @@ -938,13 +938,13 @@ fn process-sandbox-rename _sandbox: (addr sandbox), key: grapheme { return } # - compare key, 0x7f # del (backspace on Macs) + compare key, 0x7f/del # backspace on Macs $process-sandbox-rename:backspace: { break-if-!= # if not at start, delete grapheme before cursor var new-name/eax: (addr word) <- lookup *new-name-ah var at-start?/eax: boolean <- cursor-at-start? new-name - compare at-start?, 0 # false + compare at-start?, 0/false { break-if-!= var new-name/eax: (addr word) <- lookup *new-name-ah @@ -955,7 +955,7 @@ fn process-sandbox-rename _sandbox: (addr sandbox), key: grapheme { # otherwise insert key within current word var print?/eax: boolean <- real-grapheme? key $process-sandbox-rename:real-grapheme: { - compare print?, 0 # false + compare print?, 0/false break-if-= var new-name/eax: (addr word) <- lookup *new-name-ah add-grapheme-to-word new-name, key @@ -972,14 +972,14 @@ fn process-sandbox-define _sandbox: (addr sandbox), functions: (addr handle func var sandbox/esi: (addr sandbox) <- copy _sandbox var new-name-ah/edi: (addr handle word) <- get sandbox, partial-name-for-function # if 'esc' pressed, cancel define - compare key, 0x1b # esc + compare key, 0x1b/esc $process-sandbox-define:cancel: { break-if-!= clear-object new-name-ah return } # if 'enter' pressed, perform define - compare key, 0xa # enter + compare key, 0xa/enter $process-sandbox-define:commit: { break-if-!= #? print-string 0, "define\n" @@ -1030,13 +1030,13 @@ fn process-sandbox-define _sandbox: (addr sandbox), functions: (addr handle func return } # - compare key, 0x7f # del (backspace on Macs) + compare key, 0x7f/del # backspace on Macs $process-sandbox-define:backspace: { break-if-!= # if not at start, delete grapheme before cursor var new-name/eax: (addr word) <- lookup *new-name-ah var at-start?/eax: boolean <- cursor-at-start? new-name - compare at-start?, 0 # false + compare at-start?, 0/false { break-if-!= var new-name/eax: (addr word) <- lookup *new-name-ah @@ -1047,7 +1047,7 @@ fn process-sandbox-define _sandbox: (addr sandbox), functions: (addr handle func # otherwise insert key within current word var print?/eax: boolean <- real-grapheme? key $process-sandbox-define:real-grapheme: { - compare print?, 0 # false + compare print?, 0/false break-if-= var new-name/eax: (addr word) <- lookup *new-name-ah add-grapheme-to-word new-name, key @@ -1079,16 +1079,16 @@ fn copy-unbound-words-to-args _functions: (addr handle function) { # is it a number? { var is-int?/eax: boolean <- word-is-decimal-integer? curr - compare is-int?, 0 # false + compare is-int?, 0/false break-if-!= $copy-unbound-words-to-args:loop-iter } # is it a pre-existing function? var bound?/ebx: boolean <- bound-function? curr, functions-ah - compare bound?, 0 # false + compare bound?, 0/false break-if-!= # is it already bound as an arg? var dup?/ebx: boolean <- arg-exists? _functions, curr # _functions = target-ah - compare dup?, 0 # false + compare dup?, 0/false break-if-!= $copy-unbound-words-to-args:loop-iter # push copy of curr before dest-ah var rest-h: (handle word) @@ -1104,88 +1104,88 @@ fn copy-unbound-words-to-args _functions: (addr handle function) { } fn bound-function? w: (addr word), functions-ah: (addr handle function) -> _/ebx: boolean { - var result/ebx: boolean <- copy 1 # true + var result/ebx: boolean <- copy 1/true { ## numbers # if w == "+" return true var subresult/eax: boolean <- word-equal? w, "+" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= # if w == "-" return true subresult <- word-equal? w, "-" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= # if w == "*" return true subresult <- word-equal? w, "*" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= # if w == "/" return true subresult <- word-equal? w, "/" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= # if w == "sqrt" return true subresult <- word-equal? w, "sqrt" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= ## strings/arrays # if w == "len" return true subresult <- word-equal? w, "len" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= ## files # if w == "open" return true subresult <- word-equal? w, "open" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= # if w == "read" return true subresult <- word-equal? w, "read" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= # if w == "slurp" return true subresult <- word-equal? w, "slurp" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= # if w == "lines" return true subresult <- word-equal? w, "lines" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= ## screens # if w == "fake-screen" return true subresult <- word-equal? w, "fake-screen" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= # if w == "print" return true subresult <- word-equal? w, "print" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= # if w == "move" return true subresult <- word-equal? w, "move" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= # if w == "up" return true subresult <- word-equal? w, "up" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= # if w == "down" return true subresult <- word-equal? w, "down" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= # if w == "left" return true subresult <- word-equal? w, "left" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= # if w == "right" return true subresult <- word-equal? w, "right" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= ## hacks # if w == "dup" return true subresult <- word-equal? w, "dup" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= # if w == "swap" return true subresult <- word-equal? w, "swap" - compare subresult, 0 # false + compare subresult, 0/false break-if-!= # return w in functions var out-h: (handle function) @@ -1244,7 +1244,7 @@ fn toggle-cursor-word _sandbox: (addr sandbox) { #? print-string 0, "expanded words:\n" #? dump-call-paths 0, expanded-words var already-expanded?/eax: boolean <- find-in-call-paths expanded-words, cursor-call-path - compare already-expanded?, 0 # false + compare already-expanded?, 0/false { break-if-!= #? print-string 0, "expand\n" @@ -1322,7 +1322,7 @@ fn render _env: (addr environment) { render-functions screen, *sep-col, env # sandbox var repl-col/ecx: int <- copy *sep-col - repl-col <- add 2 # repl-margin-left + repl-col <- add 2/repl-margin-left var cursor-sandbox-ah/eax: (addr handle sandbox) <- get env, cursor-sandbox var cursor-sandbox/eax: (addr sandbox) <- lookup *cursor-sandbox-ah # bindings @@ -1410,7 +1410,7 @@ fn render-goto-dialog screen: (addr screen), _env: (addr environment) { var env/esi: (addr environment) <- copy _env var goto-function-mode-ah?/eax: (addr handle word) <- get env, partial-function-name var goto-function-mode?/eax: (addr word) <- lookup *goto-function-mode-ah? - compare goto-function-mode?, 0 # false + compare goto-function-mode?, 0/false break-if-= # clear a space for the dialog var top-row/ebx: int <- copy 3 @@ -1542,7 +1542,7 @@ fn render-rename-dialog screen: (addr screen), _sandbox: (addr sandbox) { var sandbox/edi: (addr sandbox) <- copy _sandbox var rename-word-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-cursor-word var rename-word-mode?/eax: (addr word) <- lookup *rename-word-mode-ah? - compare rename-word-mode?, 0 # false + compare rename-word-mode?, 0/false break-if-= # clear a space for the dialog var cursor-row/ebx: (addr int) <- get sandbox, cursor-row @@ -1588,7 +1588,7 @@ fn render-define-dialog screen: (addr screen), _sandbox: (addr sandbox) { var sandbox/edi: (addr sandbox) <- copy _sandbox var define-function-mode-ah?/ecx: (addr handle word) <- get sandbox, partial-name-for-function var define-function-mode?/eax: (addr word) <- lookup *define-function-mode-ah? - compare define-function-mode?, 0 # false + compare define-function-mode?, 0/false break-if-= # clear a space for the dialog var cursor-row/ebx: (addr int) <- get sandbox, cursor-row @@ -1656,7 +1656,7 @@ fn render-line-without-stack screen: (addr screen), _line: (addr line), curr-row { var max-width/eax: int <- word-length curr-word curr-col <- add max-width - curr-col <- add 1 # margin-right + curr-col <- add 1/margin-right } # cache cursor column if necessary { @@ -1739,7 +1739,7 @@ fn render-line screen: (addr screen), functions: (addr handle function), binding { #? print-string 0, "check sub\n" var display-subsidiary-stack?/eax: boolean <- find-in-call-paths expanded-words, curr-path - compare display-subsidiary-stack?, 0 # false + compare display-subsidiary-stack?, 0/false break-if-= $render-line:subsidiary } #? print-string 0, "render subsidiary stack\n" @@ -1796,7 +1796,7 @@ fn render-line screen: (addr screen), functions: (addr handle function), binding drop-from-call-path-element curr-path # move-cursor screen, top-row, curr-col - print-code-point screen, 0x21d7 # ⇗ + print-code-point screen, 0x21d7/⇗ # curr-col <- add 2 decrement top-row @@ -1815,7 +1815,7 @@ fn render-line screen: (addr screen), functions: (addr handle function), binding $render-line:cache-cursor-column: { { var found?/eax: boolean <- call-path-element-match? curr-path, cursor-call-path - compare found?, 0 # false + compare found?, 0/false break-if-= $render-line:cache-cursor-column } var dest/edi: (addr int) <- copy cursor-row-addr @@ -1863,7 +1863,7 @@ fn render-column screen: (addr screen), functions: (addr handle function), bindi # compute stack var stack: value-stack var stack-addr/edi: (addr value-stack) <- address stack - initialize-value-stack stack-addr, 0x10 # max-words + initialize-value-stack stack-addr, 0x10/max-words # copy bindings var bindings2-storage: table var bindings2/ebx: (addr table) <- address bindings2-storage @@ -1873,10 +1873,10 @@ fn render-column screen: (addr screen), functions: (addr handle function), bindi evaluate functions, bindings2, first-line, final-word, stack-addr # indent stack var indented-col/ebx: int <- copy left-col - indented-col <- add 1 # margin-right + indented-col <- add 1/margin-right # render stack var curr-row/edx: int <- copy top-row - curr-row <- add 2 # stack-margin-top + curr-row <- add 2/stack-margin-top { var top-addr/ecx: (addr int) <- get stack-addr, top compare *top-addr, 0 @@ -1887,7 +1887,7 @@ fn render-column screen: (addr screen), functions: (addr handle function), bindi var top/ecx: int <- copy *top-addr var dest-offset/ecx: (offset value) <- compute-offset data, top var val/eax: (addr value) <- index data, dest-offset - render-value-at screen, curr-row, indented-col, val, 1 # top-level + render-value-at screen, curr-row, indented-col, val, 1/top-level=true { var width/eax: int <- value-width val, 1 compare width, max-width @@ -1916,7 +1916,7 @@ fn render-column screen: (addr screen), functions: (addr handle function), bindi # post-process right-col var right-col/ecx: int <- copy left-col right-col <- add max-width - right-col <- add 1 # margin-right + right-col <- add 1/margin-right #? print-int32-decimal 0, left-col #? print-string 0, " => " #? print-int32-decimal 0, right-col @@ -2086,7 +2086,7 @@ fn render-functions screen: (addr screen), right-col: int, _env: (addr environme break-if-= row, dummy-col <- render-function-right-aligned screen, row, right-col, curr functions <- get curr, next - row <- add 1 # inter-function-margin + row <- add 1/inter-function-margin loop } } @@ -2095,7 +2095,7 @@ fn render-functions screen: (addr screen), right-col: int, _env: (addr environme # return row, col printed until fn render-function-right-aligned screen: (addr screen), row: int, right-col: int, f: (addr function) -> _/ecx: int, _/edx: int { var col/edx: int <- copy right-col - col <- subtract 1 # function-right-margin + col <- subtract 1/function-right-margin var col2/ebx: int <- copy col var width/eax: int <- function-width f col <- subtract width @@ -2103,15 +2103,15 @@ fn render-function-right-aligned screen: (addr screen), row: int, right-col: int var height/eax: int <- function-height f new-row <- add height new-row <- decrement - col <- subtract 1 # function-left-padding + col <- subtract 1/function-left-padding start-color screen, 0, 0xf7 clear-rect screen, row, col, new-row, col2 col <- add 1 #? var dummy/eax: grapheme <- read-key-from-real-keyboard render-function screen, row, col, f - new-row <- add 1 # function-bottom-margin - col <- subtract 1 # function-left-padding - col <- subtract 1 # function-left-margin + new-row <- add 1/function-bottom-margin + col <- subtract 1/function-left-padding + col <- subtract 1/function-left-margin reset-formatting screen return new-row, col } @@ -2149,33 +2149,33 @@ fn real-grapheme? g: grapheme -> _/eax: boolean { compare g, 0xa { break-if-!= - return 1 # true + return 1/true } # if g == tab return true compare g, 9 { break-if-!= - return 1 # true + return 1/true } # if g < 32 return false compare g, 0x20 { break-if->= - return 0 # false + return 0/false } # if g <= 255 return true compare g, 0xff { break-if-> - return 1 # true + return 1/true } # if (g&0xff == Esc) it's an escape sequence and-with g, 0xff - compare g, 0x1b # Esc + compare g, 0x1b/esc { break-if-!= - return 0 # false + return 0/false } # otherwise return true - return 1 # true + return 1/true } diff --git a/apps/tile/float-stack.mu b/apps/tile/float-stack.mu index 58a13ef4..146995e7 100644 --- a/apps/tile/float-stack.mu +++ b/apps/tile/float-stack.mu @@ -52,9 +52,9 @@ fn float-stack-empty? _self: (addr float-stack) -> _/eax: boolean { compare *top-addr, 0 { break-if-!= - return 1 # true + return 1/true } - return 0 # false + return 0/false } fn float-stack-length _self: (addr float-stack) -> _/eax: int { diff --git a/apps/tile/gap-buffer.mu b/apps/tile/gap-buffer.mu index 4d71789d..b5a690ec 100644 --- a/apps/tile/gap-buffer.mu +++ b/apps/tile/gap-buffer.mu @@ -6,9 +6,9 @@ type gap-buffer { fn initialize-gap-buffer _self: (addr gap-buffer) { var self/esi: (addr gap-buffer) <- copy _self var left/eax: (addr grapheme-stack) <- get self, left - initialize-grapheme-stack left, 0x10 # max-word-size + initialize-grapheme-stack left, 0x10/max-word-size var right/eax: (addr grapheme-stack) <- get self, right - initialize-grapheme-stack right, 0x10 # max-word-size + initialize-grapheme-stack right, 0x10/max-word-size } # just for tests @@ -19,7 +19,7 @@ fn initialize-gap-buffer-with self: (addr gap-buffer), s: (addr array byte) { write stream, s { var done?/eax: boolean <- stream-empty? stream - compare done?, 0 # false + compare done?, 0/false break-if-!= var g/eax: grapheme <- read-grapheme stream add-grapheme-at-gap self, g @@ -244,7 +244,7 @@ fn gap-buffer-equal? _self: (addr gap-buffer), s: (addr array byte) -> _/eax: bo # compare left var left/edx: (addr grapheme-stack) <- get self, left var result/eax: boolean <- prefix-match? left, expected-stream - compare result, 0 # false + compare result, 0/false { break-if-!= return result @@ -252,7 +252,7 @@ fn gap-buffer-equal? _self: (addr gap-buffer), s: (addr array byte) -> _/eax: bo # compare right var right/edx: (addr grapheme-stack) <- get self, right result <- suffix-match? right, expected-stream - compare result, 0 # false + compare result, 0/false { break-if-!= return result @@ -267,7 +267,7 @@ fn test-gap-buffer-equal-from-end? { var g/esi: (addr gap-buffer) <- address _g initialize-gap-buffer g # - var c/eax: grapheme <- copy 0x61 # 'a' + var c/eax: grapheme <- copy 0x61/a add-grapheme-at-gap g, c add-grapheme-at-gap g, c add-grapheme-at-gap g, c @@ -282,7 +282,7 @@ fn test-gap-buffer-equal-from-middle? { var g/esi: (addr gap-buffer) <- address _g initialize-gap-buffer g # - var c/eax: grapheme <- copy 0x61 # 'a' + var c/eax: grapheme <- copy 0x61/a add-grapheme-at-gap g, c add-grapheme-at-gap g, c add-grapheme-at-gap g, c @@ -298,7 +298,7 @@ fn test-gap-buffer-equal-from-start? { var g/esi: (addr gap-buffer) <- address _g initialize-gap-buffer g # - var c/eax: grapheme <- copy 0x61 # 'a' + var c/eax: grapheme <- copy 0x61/a add-grapheme-at-gap g, c add-grapheme-at-gap g, c add-grapheme-at-gap g, c @@ -334,7 +334,7 @@ fn gap-buffer-is-decimal-integer? _self: (addr gap-buffer) -> _/eax: boolean { var curr/ecx: (addr grapheme-stack) <- get self, left var result/eax: boolean <- grapheme-stack-is-decimal-integer? curr { - compare result, 0 # false + compare result, 0/false break-if-= curr <- get self, right result <- grapheme-stack-is-decimal-integer? curr diff --git a/apps/tile/grapheme-stack.mu b/apps/tile/grapheme-stack.mu index 8b123331..e0d40ecc 100644 --- a/apps/tile/grapheme-stack.mu +++ b/apps/tile/grapheme-stack.mu @@ -23,9 +23,9 @@ fn grapheme-stack-empty? _self: (addr grapheme-stack) -> _/eax: boolean { compare *top, 0 { break-if-!= - return 1 # true + return 1/true } - return 0 # false + return 0/false } fn push-grapheme-stack _self: (addr grapheme-stack), _val: grapheme { @@ -131,7 +131,7 @@ fn prefix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: b { compare expected, *curr-a break-if-= - return 0 # false + return 0/false } } i <- increment @@ -160,7 +160,7 @@ fn suffix-match? _self: (addr grapheme-stack), s: (addr stream byte) -> _/eax: b { compare expected, *curr-a break-if-= - return 0 # false + return 0/false } } i <- decrement @@ -176,13 +176,13 @@ fn grapheme-stack-is-decimal-integer? _self: (addr grapheme-stack) -> _/eax: boo var data/edx: (addr array grapheme) <- copy _data var top-addr/ecx: (addr int) <- get self, top var i/ebx: int <- copy 0 - var result/eax: boolean <- copy 1 # true + var result/eax: boolean <- copy 1/true $grapheme-stack-is-integer?:loop: { compare i, *top-addr break-if->= var g/edx: (addr grapheme) <- index data, i result <- is-decimal-digit? *g - compare result, 0 # false + compare result, 0/false break-if-= i <- increment loop diff --git a/apps/tile/main.mu b/apps/tile/main.mu index 120913c4..e0daaf1b 100644 --- a/apps/tile/main.mu +++ b/apps/tile/main.mu @@ -7,7 +7,7 @@ fn main args-on-stack: (addr array addr array byte) -> _/ebx: int { # if single arg is 'test', run tests var tmp/ecx: (addr addr array byte) <- index args, 1 var tmp2/eax: boolean <- string-equal? *tmp, "test" - compare tmp2, 0 # false + compare tmp2, 0/false { break-if-= run-tests @@ -15,7 +15,7 @@ fn main args-on-stack: (addr array addr array byte) -> _/ebx: int { } # if single arg is 'screen', run in full-screen mode tmp2 <- string-equal? *tmp, "screen" - compare tmp2, 0 # false + compare tmp2, 0/false { break-if-= interactive @@ -23,7 +23,7 @@ fn main args-on-stack: (addr array addr array byte) -> _/ebx: int { } # if single arg is 'type', run in typewriter mode tmp2 <- string-equal? *tmp, "type" - compare tmp2, 0 # false + compare tmp2, 0/false { break-if-= repl @@ -31,7 +31,7 @@ fn main args-on-stack: (addr array addr array byte) -> _/ebx: int { } # if single arg is 'test' ... tmp2 <- string-equal? *tmp, "test2" - compare tmp2, 0 # false + compare tmp2, 0/false { break-if-= test @@ -55,7 +55,7 @@ fn interactive { { render env var key/eax: grapheme <- read-key-from-real-keyboard - compare key, 0x11 # 'ctrl-q' + compare key, 0x11/ctrl-q break-if-= process env, key loop @@ -77,7 +77,7 @@ fn process-all env: (addr environment), cmds: (addr array byte) { write cmds-stream-a, cmds { var done?/eax: boolean <- stream-empty? cmds-stream-a - compare done?, 0 # false + compare done?, 0/false break-if-!= var g/eax: grapheme <- read-grapheme cmds-stream-a process env, g @@ -95,7 +95,7 @@ fn repl { clear-stream line read-line-from-real-keyboard line var done?/eax: boolean <- stream-empty? line - compare done?, 0 # false + compare done?, 0/false break-if-!= # parse var env-storage: environment @@ -103,7 +103,7 @@ fn repl { initialize-environment env { var done?/eax: boolean <- stream-empty? line - compare done?, 0 # false + compare done?, 0/false break-if-!= var g/eax: grapheme <- read-grapheme line process env, g @@ -117,7 +117,7 @@ fn repl { # print var empty?/eax: boolean <- value-stack-empty? stack { - compare empty?, 0 # false + compare empty?, 0/false break-if-!= var result/xmm0: float <- pop-number-from-value-stack stack print-float-decimal-approximate 0, result, 3 diff --git a/apps/tile/rpn.mu b/apps/tile/rpn.mu index 219e9b09..bf81308b 100644 --- a/apps/tile/rpn.mu +++ b/apps/tile/rpn.mu @@ -90,7 +90,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: var target-val/edx: (addr value) <- index data, dest-offset # check target-val is a string or array var target-type-addr/eax: (addr int) <- get target-val, type - compare *target-type-addr, 1 # string + compare *target-type-addr, 1/string { break-if-!= # compute length @@ -100,14 +100,14 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: var result-f/xmm0: float <- convert result # save result into target-val var type-addr/eax: (addr int) <- get target-val, type - copy-to *type-addr, 0 # int + copy-to *type-addr, 0/int var target-string-ah/eax: (addr handle array byte) <- get target-val, text-data clear-object target-string-ah var target/eax: (addr float) <- get target-val, number-data copy-to *target, result-f break $evaluate:process-word } - compare *target-type-addr, 2 # array of ints + compare *target-type-addr, 2/array { break-if-!= # compute length @@ -117,7 +117,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: var result-f/xmm0: float <- convert result # save result into target-val var type-addr/eax: (addr int) <- get target-val, type - copy-to *type-addr, 0 # int + copy-to *type-addr, 0/int var target-array-ah/eax: (addr handle array value) <- get target-val, array-data clear-object target-array-ah var target/eax: (addr float) <- get target-val, number-data @@ -143,7 +143,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: var target-val/edx: (addr value) <- index data, dest-offset # check target-val is a string var target-type-addr/eax: (addr int) <- get target-val, type - compare *target-type-addr, 1 # string + compare *target-type-addr, 1/string break-if-!= # open target-val as a filename and save the handle in target-val var src-ah/eax: (addr handle array byte) <- get target-val, text-data @@ -152,7 +152,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: open src, 0, result-ah # write? = false # save result into target-val var type-addr/eax: (addr int) <- get target-val, type - copy-to *type-addr, 3 # file + copy-to *type-addr, 3/file var target-string-ah/eax: (addr handle array byte) <- get target-val, text-data var filename-ah/ecx: (addr handle array byte) <- get target-val, filename copy-object target-string-ah, filename-ah @@ -176,7 +176,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: var target-val/edx: (addr value) <- index data, dest-offset # check target-val is a file var target-type-addr/eax: (addr int) <- get target-val, type - compare *target-type-addr, 3 # file + compare *target-type-addr, 3/file break-if-!= # read a line from the file and save in target-val # read target-val as a filename and save the handle in target-val @@ -189,7 +189,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: stream-to-array s-addr, target # save result into target-val var type-addr/eax: (addr int) <- get target-val, type - copy-to *type-addr, 1 # string + copy-to *type-addr, 1/string var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data clear-object target-file-ah break $evaluate:process-word @@ -211,7 +211,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: var target-val/edx: (addr value) <- index data, dest-offset # check target-val is a file var target-type-addr/eax: (addr int) <- get target-val, type - compare *target-type-addr, 3 # file + compare *target-type-addr, 3/file break-if-!= # slurp all contents from file and save in target-val # read target-val as a filename and save the handle in target-val @@ -224,7 +224,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: stream-to-array s-addr, target # save result into target-val var type-addr/eax: (addr int) <- get target-val, type - copy-to *type-addr, 1 # string + copy-to *type-addr, 1/string var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data clear-object target-file-ah break $evaluate:process-word @@ -246,7 +246,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: var target-val/edx: (addr value) <- index data, dest-offset # check target-val is a file var target-type-addr/eax: (addr int) <- get target-val, type - compare *target-type-addr, 3 # file + compare *target-type-addr, 3/file break-if-!= # read all lines from file and save as an array of strings in target-val # read target-val as a filename and save the handle in target-val @@ -269,7 +269,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: save-lines h, target # save result into target-val var type-addr/eax: (addr int) <- get target-val, type - copy-to *type-addr, 2 # array + copy-to *type-addr, 2/array var target-file-ah/eax: (addr handle buffered-file) <- get target-val, file-data var empty-file: (handle buffered-file) copy-handle empty-file, target-file-ah @@ -306,7 +306,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: var dest-offset/edx: (offset value) <- compute-offset data, top var target-val/edx: (addr value) <- index data, dest-offset var type/eax: (addr int) <- get target-val, type - copy-to *type, 4 # screen + copy-to *type, 4/screen var dest/eax: (addr handle screen) <- get target-val, screen-data copy-handle screen-h, dest break $evaluate:process-word @@ -338,7 +338,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: var dest-offset/edx: (offset value) <- compute-offset data, top var target-val/edx: (addr value) <- index data, dest-offset var type/eax: (addr int) <- get target-val, type - compare *type, 4 # screen + compare *type, 4/screen break-if-!= # print string to target screen var dest-ah/eax: (addr handle screen) <- get target-val, screen-data @@ -370,7 +370,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: var target-offset/eax: (offset value) <- compute-offset data, top var target-val/ebx: (addr value) <- index data, target-offset var type/eax: (addr int) <- get target-val, type - compare *type, 4 # screen + compare *type, 4/screen break-if-!= var target-ah/eax: (addr handle screen) <- get target-val, screen-data var target/eax: (addr screen) <- lookup *target-ah @@ -399,7 +399,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: var target-offset/eax: (offset value) <- compute-offset data, top var target-val/ebx: (addr value) <- index data, target-offset var type/eax: (addr int) <- get target-val, type - compare *type, 4 # screen + compare *type, 4/screen break-if-!= var target-ah/eax: (addr handle screen) <- get target-val, screen-data var _target/eax: (addr screen) <- lookup *target-ah @@ -442,7 +442,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: var target-offset/eax: (offset value) <- compute-offset data, top var target-val/ebx: (addr value) <- index data, target-offset var type/eax: (addr int) <- get target-val, type - compare *type, 4 # screen + compare *type, 4/screen break-if-!= var target-ah/eax: (addr handle screen) <- get target-val, screen-data var _target/eax: (addr screen) <- lookup *target-ah @@ -487,7 +487,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: var target-offset/eax: (offset value) <- compute-offset data, top var target-val/ebx: (addr value) <- index data, target-offset var type/eax: (addr int) <- get target-val, type - compare *type, 4 # screen + compare *type, 4/screen break-if-!= var target-ah/eax: (addr handle screen) <- get target-val, screen-data var _target/eax: (addr screen) <- lookup *target-ah @@ -531,7 +531,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: var target-offset/eax: (offset value) <- compute-offset data, top var target-val/ebx: (addr value) <- index data, target-offset var type/eax: (addr int) <- get target-val, type - compare *type, 4 # screen + compare *type, 4/screen break-if-!= var target-ah/eax: (addr handle screen) <- get target-val, screen-data var _target/eax: (addr screen) <- lookup *target-ah @@ -610,10 +610,10 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: ### if curr-stream defines a binding, save top of stack to bindings { var done?/eax: boolean <- stream-empty? curr-stream - compare done?, 0 # false + compare done?, 0/false break-if-!= var new-byte/eax: byte <- read-byte curr-stream - compare new-byte, 0x3d # '=' + compare new-byte, 0x3d/= break-if-!= # pop target-val from out var out2/esi: (addr value-stack) <- copy out @@ -665,10 +665,10 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: ### if the word starts with a quote and ends with a quote, turn it into a string { var start/eax: byte <- stream-first curr-stream - compare start, 0x22 # double-quote + compare start, 0x22/double-quote break-if-!= var end/eax: byte <- stream-final curr-stream - compare end, 0x22 # double-quote + compare end, 0x22/double-quote break-if-!= var h: (handle array byte) var s/eax: (addr handle array byte) <- address h @@ -679,10 +679,10 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: ### if the word starts with a '[' and ends with a ']', turn it into an array { var start/eax: byte <- stream-first curr-stream - compare start, 0x5b # '[' + compare start, 0x5b/[ break-if-!= var end/eax: byte <- stream-final curr-stream - compare end, 0x5d # ']' + compare end, 0x5d/] break-if-!= # wastefully create a new input string to strip quotes var h: (handle array value) @@ -781,7 +781,7 @@ fn find-function first: (addr handle function), name: (addr stream byte), out: ( var curr-name-ah/eax: (addr handle array byte) <- get f, name var curr-name/eax: (addr array byte) <- lookup *curr-name-ah var done?/eax: boolean <- stream-data-equal? name, curr-name - compare done?, 0 # false + compare done?, 0/false { break-if-= copy-handle *curr, out diff --git a/apps/tile/surface.mu b/apps/tile/surface.mu index cd54b5b4..2e353022 100644 --- a/apps/tile/surface.mu +++ b/apps/tile/surface.mu @@ -262,10 +262,10 @@ fn num-lines in: (addr array byte) -> _/ecx: int { var result/ecx: int <- copy 1 { var done?/eax: boolean <- stream-empty? s-addr - compare done?, 0 # false + compare done?, 0/false break-if-!= var g/eax: grapheme <- read-grapheme s-addr - compare g, 0xa # newline + compare g, 0xa/newline loop-if-!= result <- increment loop @@ -280,10 +280,10 @@ fn first-line-length in: (addr array byte) -> _/edx: int { var result/edx: int <- copy 0 { var done?/eax: boolean <- stream-empty? s-addr - compare done?, 0 # false + compare done?, 0/false break-if-!= var g/eax: grapheme <- read-grapheme s-addr - compare g, 0xa # newline + compare g, 0xa/newline break-if-= result <- increment loop @@ -299,10 +299,10 @@ fn fill-in _out: (addr array screen-cell), in: (addr array byte) { var idx/ecx: int <- copy 0 { var done?/eax: boolean <- stream-empty? s-addr - compare done?, 0 # false + compare done?, 0/false break-if-!= var g/eax: grapheme <- read-grapheme s-addr - compare g, 0xa # newline + compare g, 0xa/newline loop-if-= var offset/edx: (offset screen-cell) <- compute-offset out, idx var dest/edx: (addr screen-cell) <- index out, offset diff --git a/apps/tile/table.mu b/apps/tile/table.mu index 899408e1..9c03117b 100644 --- a/apps/tile/table.mu +++ b/apps/tile/table.mu @@ -123,7 +123,7 @@ fn lookup-binding _self: (addr table), key: (addr array byte), out: (addr handle compare target3, 0 break-if-= $lookup-binding:loop var is-match?/eax: boolean <- string-equal? target3, key - compare is-match?, 0 # false + compare is-match?, 0/false break-if-= # found var target/eax: (addr handle value) <- get target-bind, value diff --git a/apps/tile/value-stack.mu b/apps/tile/value-stack.mu index e437f616..886b4037 100644 --- a/apps/tile/value-stack.mu +++ b/apps/tile/value-stack.mu @@ -33,7 +33,7 @@ fn push-number-to-value-stack _self: (addr value-stack), _val: float { copy-to *dest-addr2, val increment *top-addr var type-addr/eax: (addr int) <- get dest-addr, type - copy-to *type-addr, 0 # number + copy-to *type-addr, 0/number } fn push-string-to-value-stack _self: (addr value-stack), val: (handle array byte) { @@ -53,7 +53,7 @@ fn push-string-to-value-stack _self: (addr value-stack), val: (handle array byte #? print-int32-hex 0, foo #? } #? print-string 0, "\n" - copy-to *dest-addr3, 1 # type string + copy-to *dest-addr3, 1/string increment *top-addr } @@ -69,7 +69,7 @@ fn push-array-to-value-stack _self: (addr value-stack), val: (handle array value copy-handle val, dest-addr2 # update type var dest-addr3/eax: (addr int) <- get dest-addr, type - copy-to *dest-addr3, 2 # type array + copy-to *dest-addr3, 2/array increment *top-addr } @@ -111,9 +111,9 @@ fn value-stack-empty? _self: (addr value-stack) -> _/eax: boolean { compare *top, 0 { break-if-!= - return 1 # true + return 1/true } - return 0 # false + return 0/false } fn value-stack-length _self: (addr value-stack) -> _/eax: int { @@ -142,7 +142,7 @@ fn save-lines in-h: (handle array (handle array byte)), _out-ah: (addr handle ar var dest/eax: (addr handle array byte) <- get dest-val, text-data copy-object src, dest var type/edx: (addr int) <- get dest-val, type - copy-to *type, 1 # string + copy-to *type, 1/string i <- increment loop } diff --git a/apps/tile/value.mu b/apps/tile/value.mu index 912f9ffa..8bd01676 100644 --- a/apps/tile/value.mu +++ b/apps/tile/value.mu @@ -3,7 +3,7 @@ fn render-value-at screen: (addr screen), row: int, col: int, _val: (addr value) var val/esi: (addr value) <- copy _val var val-type/ecx: (addr int) <- get val, type # per-type rendering logic goes here - compare *val-type, 1 # string + compare *val-type, 1/string { break-if-!= var val-ah/eax: (addr handle array byte) <- get val, text-data @@ -17,18 +17,18 @@ fn render-value-at screen: (addr screen), row: int, col: int, _val: (addr value) var truncated-string/eax: (addr array byte) <- lookup *truncated-ah var len/edx: int <- length truncated-string start-color screen, 0xf2, 7 - print-code-point screen, 0x275d # open-quote + print-code-point screen, 0x275d/open-quote print-string screen, truncated-string compare len, orig-len { break-if-= - print-code-point screen, 0x2026 # ellipses + print-code-point screen, 0x2026/ellipses } - print-code-point screen, 0x275e # close-quote + print-code-point screen, 0x275e/close-quote reset-formatting screen return } - compare *val-type, 2 # array + compare *val-type, 2/array { break-if-!= var val-ah/eax: (addr handle array value) <- get val, array-data @@ -36,7 +36,7 @@ fn render-value-at screen: (addr screen), row: int, col: int, _val: (addr value) render-array-at screen, row, col, val-array return } - compare *val-type, 3 # file + compare *val-type, 3/file { break-if-!= var val-ah/eax: (addr handle buffered-file) <- get val, file-data @@ -46,7 +46,7 @@ fn render-value-at screen: (addr screen), row: int, col: int, _val: (addr value) print-string screen, " FILE " return } - compare *val-type, 4 # screen + compare *val-type, 4/screen { break-if-!= #? print-string 0, "render-screen" @@ -90,15 +90,15 @@ fn render-number screen: (addr screen), val: float, top-level?: boolean { fg <- copy 0 } start-color screen, fg, bg - print-grapheme screen, 0x20 # space + print-grapheme screen, 0x20/space print-float-decimal-approximate screen, val, 3 - print-grapheme screen, 0x20 # space + print-grapheme screen, 0x20/space } fn render-array-at screen: (addr screen), row: int, col: int, _a: (addr array value) { start-color screen, 0xf2, 7 # don't surround in spaces - print-grapheme screen, 0x5b # '[' + print-grapheme screen, 0x5b/[ increment col var a/esi: (addr array value) <- copy _a var max/ecx: int <- length a @@ -122,7 +122,7 @@ fn render-array-at screen: (addr screen), row: int, col: int, _a: (addr array va i <- increment loop } - print-grapheme screen, 0x5d # ']' + print-grapheme screen, 0x5d/] } fn render-screen screen: (addr screen), row: int, col: int, _target-screen: (addr screen) { @@ -183,57 +183,57 @@ fn print-screen-cell-of-fake-screen screen: (addr screen), _target: (addr screen { compare g, 0 break-if-!= - g <- copy 0x20 # space + g <- copy 0x20/space } print-grapheme screen, g reset-formatting screen } fn print-upper-border screen: (addr screen), width: int { - print-code-point screen, 0x250c # top-left corner + print-code-point screen, 0x250c/top-left-corner var i/eax: int <- copy 0 { compare i, width break-if->= - print-code-point screen, 0x2500 # horizontal line + print-code-point screen, 0x2500/horizontal-line i <- increment loop } - print-code-point screen, 0x2510 # top-right corner + print-code-point screen, 0x2510/top-right-corner } fn print-lower-border screen: (addr screen), width: int { - print-code-point screen, 0x2514 # bottom-left corner + print-code-point screen, 0x2514/bottom-left-corner var i/eax: int <- copy 0 { compare i, width break-if->= - print-code-point screen, 0x2500 # horizontal line + print-code-point screen, 0x2500/horizontal-line i <- increment loop } - print-code-point screen, 0x2518 # bottom-right corner + print-code-point screen, 0x2518/bottom-right-corner } fn value-width _v: (addr value), top-level: boolean -> _/eax: int { var v/esi: (addr value) <- copy _v var type/eax: (addr int) <- get v, type { - compare *type, 0 # int + compare *type, 0/int break-if-!= var v-num/edx: (addr float) <- get v, number-data var result/eax: int <- float-size *v-num, 3 return result } { - compare *type, 1 # string + compare *type, 1/string break-if-!= var s-ah/eax: (addr handle array byte) <- get v, text-data var s/eax: (addr array byte) <- lookup *s-ah compare s, 0 break-if-= var result/eax: int <- length s - compare result, 0xd # max string size + compare result, 0xd/max-string-size { break-if-<= result <- copy 0xd @@ -241,7 +241,7 @@ fn value-width _v: (addr value), top-level: boolean -> _/eax: int { # if it's a nested string, include space for quotes # we don't do this for the top-level, where the quotes will overflow # into surrounding padding. - compare top-level, 0 # false + compare top-level, 0/false { break-if-!= result <- add 2 @@ -249,7 +249,7 @@ fn value-width _v: (addr value), top-level: boolean -> _/eax: int { return result } { - compare *type, 2 # array + compare *type, 2/array break-if-!= var a-ah/eax: (addr handle array value) <- get v, array-data var a/eax: (addr array value) <- lookup *a-ah @@ -259,7 +259,7 @@ fn value-width _v: (addr value), top-level: boolean -> _/eax: int { return result } { - compare *type, 3 # file handle + compare *type, 3/file break-if-!= var f-ah/eax: (addr handle buffered-file) <- get v, file-data var f/eax: (addr buffered-file) <- lookup *f-ah @@ -269,7 +269,7 @@ fn value-width _v: (addr value), top-level: boolean -> _/eax: int { return 4 } { - compare *type, 4 # screen + compare *type, 4/screen break-if-!= var screen-ah/eax: (addr handle screen) <- get v, screen-data var screen/eax: (addr screen) <- lookup *screen-ah @@ -315,13 +315,13 @@ fn value-height _v: (addr value) -> _/eax: int { var v/esi: (addr value) <- copy _v var type/eax: (addr int) <- get v, type { - compare *type, 3 # file handle + compare *type, 3/file break-if-!= # TODO: visualizing file handles return 1 } { - compare *type, 4 # screen + compare *type, 4/screen break-if-!= var screen-ah/eax: (addr handle screen) <- get v, screen-data var screen/eax: (addr screen) <- lookup *screen-ah @@ -351,7 +351,7 @@ fn deep-copy-value _src: (addr value), _dest: (addr value) { copy-object src-n, dest-n return } - compare *type, 1 # string + compare *type, 1/string { break-if-!= #? print-string 0, "string value\n" @@ -361,7 +361,7 @@ fn deep-copy-value _src: (addr value), _dest: (addr value) { copy-array-object src, dest-ah return } - compare *type, 2 # array + compare *type, 2/array { break-if-!= #? print-string 0, "array value\n" @@ -389,7 +389,7 @@ fn deep-copy-value _src: (addr value), _dest: (addr value) { copy-array-object src, dest-ah return } - compare *type, 3 # file + compare *type, 3/file { break-if-!= #? print-string 0, "file value\n" @@ -404,7 +404,7 @@ fn deep-copy-value _src: (addr value), _dest: (addr value) { copy-file src-file, dest-file-ah, src-filename return } - compare *type, 4 # screen + compare *type, 4/screen { break-if-!= #? print-string 0, "screen value\n" diff --git a/apps/tile/word.mu b/apps/tile/word.mu index 2d776caf..224c876c 100644 --- a/apps/tile/word.mu +++ b/apps/tile/word.mu @@ -61,7 +61,7 @@ fn move-word-contents _src-ah: (addr handle word), _dest-ah: (addr handle word) var src-stack/ecx: (addr grapheme-stack) <- get src-data, right { var done?/eax: boolean <- grapheme-stack-empty? src-stack - compare done?, 0 # false + compare done?, 0/false break-if-!= var g/eax: grapheme <- pop-grapheme-stack src-stack #? print-grapheme 0, g @@ -520,7 +520,7 @@ fn word-exists? _haystack-ah: (addr handle word), _needle: (addr word) -> _/ebx: compare curr, 0 { break-if-!= - return 0 # false + return 0/false } # check curr var curr-name-storage: (handle array byte) @@ -531,7 +531,7 @@ fn word-exists? _haystack-ah: (addr handle word), _needle: (addr word) -> _/ebx: compare found?, 0 { break-if-= - return 1 # true + return 1/true } # recurse var curr/eax: (addr word) <- lookup *haystack-ah @@ -550,7 +550,7 @@ fn word-list-length words: (addr handle word) -> _/eax: int { { var word-len/eax: int <- word-length curr result <- add word-len - result <- add 1 # inter-word-margin + result <- add 1/inter-word-margin } curr-ah <- get curr, next loop @@ -566,12 +566,12 @@ fn parse-words in: (addr array byte), out-ah: (addr handle word) { var cursor-word-ah/ebx: (addr handle word) <- copy out-ah $parse-words:loop: { var done?/eax: boolean <- stream-empty? in-stream-a - compare done?, 0 # false + compare done?, 0/false break-if-!= var _g/eax: grapheme <- read-grapheme in-stream-a var g/ecx: grapheme <- copy _g # if not space, insert - compare g, 0x20 # space + compare g, 0x20/space { break-if-= var cursor-word/eax: (addr word) <- lookup *cursor-word-ah |