diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-11-03 15:42:58 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-11-03 15:42:58 -0800 |
commit | f21c96203eb3fbca5c389435f5ec927b4f621725 (patch) | |
tree | 20972664d78996ca9dfdd33c4b3c5d98c1a26f9c /apps/tile | |
parent | da791479a0bd7f1d34c0ba06309cc1fb48bbe7a5 (diff) | |
download | mu-f21c96203eb3fbca5c389435f5ec927b4f621725.tar.gz |
7166
Diffstat (limited to 'apps/tile')
-rw-r--r-- | apps/tile/main.mu | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/apps/tile/main.mu b/apps/tile/main.mu index c4010c4b..1ef1e268 100644 --- a/apps/tile/main.mu +++ b/apps/tile/main.mu @@ -1,51 +1,49 @@ fn main args-on-stack: (addr array addr array byte) -> _/ebx: int { var args/eax: (addr array addr array byte) <- copy args-on-stack var len/ecx: int <- length args - $main-body: { - compare len, 2 + compare len, 2 + { + break-if-!= + # 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 { - break-if-!= - # 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 - { - break-if-= - run-tests - return 0 # TODO: get at Num-test-failures somehow - } - # if single arg is 'screen', run in full-screen mode - tmp2 <- string-equal? *tmp, "screen" - compare tmp2, 0 # false - { - break-if-= - interactive - return 0 - } - # if single arg is 'type', run in typewriter mode - tmp2 <- string-equal? *tmp, "type" - compare tmp2, 0 # false - { - break-if-= - repl - return 0 - } - # if single arg is 'test' ... - tmp2 <- string-equal? *tmp, "test2" - compare tmp2, 0 # false - { - break-if-= - test - return 0 - } + break-if-= + run-tests + return 0 # TODO: get at Num-test-failures somehow + } + # if single arg is 'screen', run in full-screen mode + tmp2 <- string-equal? *tmp, "screen" + compare tmp2, 0 # false + { + break-if-= + interactive + return 0 + } + # if single arg is 'type', run in typewriter mode + tmp2 <- string-equal? *tmp, "type" + compare tmp2, 0 # false + { + break-if-= + repl + return 0 + } + # if single arg is 'test' ... + tmp2 <- string-equal? *tmp, "test2" + compare tmp2, 0 # false + { + break-if-= + test + return 0 } - # otherwise error message - print-string-to-real-screen "usage:\n" - print-string-to-real-screen " to run tests: tile test\n" - print-string-to-real-screen " full-screen mode: tile screen\n" - print-string-to-real-screen " regular REPL: tile type\n" - return 1 } + # otherwise error message + print-string-to-real-screen "usage:\n" + print-string-to-real-screen " to run tests: tile test\n" + print-string-to-real-screen " full-screen mode: tile screen\n" + print-string-to-real-screen " regular REPL: tile type\n" + return 1 } fn interactive { |