diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 00:31:55 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 00:31:55 -0700 |
commit | 08f4628e8b858120fe3547d8e5431d9abfe46bf8 (patch) | |
tree | 4d9f1bc0039baefa0e84d9cb3ea6634f4337d342 | |
parent | 58a9f7c34e21541f2db90b7fb66f4e92f04780ef (diff) | |
download | mu-08f4628e8b858120fe3547d8e5431d9abfe46bf8.tar.gz |
3379
Can't use type abbreviations inside 'memory-should-contain'.
-rw-r--r-- | 038new_text.cc | 6 | ||||
-rw-r--r-- | 051scenario_test.mu | 6 | ||||
-rw-r--r-- | 053recipe_header.cc | 4 | ||||
-rw-r--r-- | 054static_dispatch.cc | 10 | ||||
-rw-r--r-- | 055shape_shifting_container.cc | 2 | ||||
-rw-r--r-- | 056shape_shifting_recipe.cc | 6 | ||||
-rw-r--r-- | 059to_text.mu | 8 | ||||
-rw-r--r-- | 061text.mu | 134 | ||||
-rw-r--r-- | 063array.mu | 6 | ||||
-rw-r--r-- | 064list.mu | 68 | ||||
-rw-r--r-- | 065duplex_list.mu | 178 | ||||
-rw-r--r-- | 066stream.mu | 2 | ||||
-rw-r--r-- | 069hash.cc | 14 | ||||
-rw-r--r-- | 075channel.mu | 12 | ||||
-rw-r--r-- | 081print.mu | 52 | ||||
-rw-r--r-- | 082scenario_screen.cc | 36 | ||||
-rw-r--r-- | 083scenario_screen_test.mu | 4 | ||||
-rw-r--r-- | 084console.mu | 10 | ||||
-rw-r--r-- | 085scenario_console.cc | 8 | ||||
-rw-r--r-- | 086scenario_console_test.mu | 8 | ||||
-rw-r--r-- | 088file.mu | 26 | ||||
-rw-r--r-- | 089scenario_filesystem.cc | 16 | ||||
-rw-r--r-- | 090scenario_filesystem_test.mu | 20 | ||||
-rw-r--r-- | 101run_sandboxed.cc | 8 | ||||
-rw-r--r-- | 102persist.cc | 2 | ||||
-rw-r--r-- | channel.mu | 12 | ||||
-rw-r--r-- | chessboard.mu | 54 | ||||
-rw-r--r-- | filesystem.mu | 6 | ||||
-rw-r--r-- | lambda_to_mu.mu | 84 | ||||
-rw-r--r-- | real_files.mu | 2 | ||||
-rw-r--r-- | screen.mu | 8 | ||||
-rw-r--r-- | server-socket.mu | 2 |
32 files changed, 407 insertions, 407 deletions
diff --git a/038new_text.cc b/038new_text.cc index d9dbbf17..9a53a421 100644 --- a/038new_text.cc +++ b/038new_text.cc @@ -2,12 +2,12 @@ //: A Mu text is an address to an array of characters. :(before "End Mu Types Initialization") -put(Type_abbreviations, "text", new_type_tree("address:array:character")); +put(Type_abbreviations, "text", new_type_tree("address:array:char")); :(scenario new_string) def main [ 1:text <- new [abc def] - 2:character <- index *1:text, 5 + 2:char <- index *1:text, 5 ] # number code for 'e' +mem: storing 101 in location 2 @@ -16,7 +16,7 @@ def main [ def main [ 1:text <- new [a«c] 2:number <- length *1:text - 3:character <- index *1:text, 1 + 3:char <- index *1:text, 1 ] +mem: storing 3 in location 2 # unicode for '«' diff --git a/051scenario_test.mu b/051scenario_test.mu index c9f10d27..bab22e76 100644 --- a/051scenario_test.mu +++ b/051scenario_test.mu @@ -33,9 +33,9 @@ scenario scenario_with_multiple_comments_in_mu [ scenario check_text_in_memory [ run [ 10:number <- copy 3 - 11:character <- copy 97 # 'a' - 12:character <- copy 98 # 'b' - 13:character <- copy 99 # 'c' + 11:char <- copy 97 # 'a' + 12:char <- copy 98 # 'b' + 13:char <- copy 99 # 'c' ] memory-should-contain [ 10:array:character <- [abc] diff --git a/053recipe_header.cc b/053recipe_header.cc index 0bbba110..3afa2569 100644 --- a/053recipe_header.cc +++ b/053recipe_header.cc @@ -145,11 +145,11 @@ if (result.has_header) { //: Support type abbreviations in headers. :(scenario type_abbreviations_in_recipe_headers) -type string = address:array:character +type string = address:array:char def main [ local-scope a:string <- foo - 1:character/raw <- index *a, 0 + 1:char/raw <- index *a, 0 ] def foo -> a:string [ local-scope diff --git a/054static_dispatch.cc b/054static_dispatch.cc index 82fc1de3..46e1468c 100644 --- a/054static_dispatch.cc +++ b/054static_dispatch.cc @@ -496,7 +496,7 @@ def foo x:number -> y:number [ % Hide_errors = true; def main [ local-scope - x:character <- copy 10/newline + x:char <- copy 10/newline 1:number/raw <- foo x ] def foo x:number -> y:number [ @@ -510,7 +510,7 @@ def foo x:number -> y:number [ def main [ 1:number/raw <- foo 0 # valid literal for boolean ] -def foo x:character -> y:number [ +def foo x:char -> y:number [ local-scope load-ingredients return 34 @@ -527,7 +527,7 @@ def foo x:boolean -> y:number [ def main [ 1:number/raw <- foo 97 # not a valid literal for boolean ] -def foo x:character -> y:number [ +def foo x:char -> y:number [ local-scope load-ingredients return 34 @@ -544,7 +544,7 @@ def foo x:boolean -> y:number [ def main [ 1:number/raw <- foo 97 ] -def foo x:character -> y:number [ +def foo x:char -> y:number [ local-scope load-ingredients return 34 @@ -614,7 +614,7 @@ def foo a:boolean -> b:number [ +error: main: failed to find a matching call for 'y:number <- foo x' :(scenario override_methods_with_type_abbreviations) -type string = address:array:character +type string = address:array:char def main [ local-scope s:text <- new [abc] diff --git a/055shape_shifting_container.cc b/055shape_shifting_container.cc index 26bb7467..0457e43a 100644 --- a/055shape_shifting_container.cc +++ b/055shape_shifting_container.cc @@ -69,7 +69,7 @@ container bar:_a:_b [ ] def main [ 1:text <- new [abc] - 2:bar:number:array:character <- merge 34/x, 1:text/y + 2:bar:number:array:char <- merge 34/x, 1:text/y ] $error: 0 diff --git a/056shape_shifting_recipe.cc b/056shape_shifting_recipe.cc index d251db47..1f8fc27e 100644 --- a/056shape_shifting_recipe.cc +++ b/056shape_shifting_recipe.cc @@ -721,7 +721,7 @@ def foo x:_elem -> y:_elem [ def main [ local-scope # permit literal to map to character - 1:character/raw <- foo 3 + 1:char/raw <- foo 3 ] def foo x:_elem -> y:_elem [ local-scope @@ -734,7 +734,7 @@ def foo x:_elem -> y:_elem [ def main [ local-scope # permit '0' to map to address to shape-shifting type-ingredient - 1:address:character/raw <- foo 0 + 1:address:char/raw <- foo 0 ] def foo x:address:_elem -> y:address:_elem [ local-scope @@ -946,7 +946,7 @@ def foo x:_elem -> y:number [ load-ingredients return 34 ] -def foo x:character -> y:number [ +def foo x:char -> y:number [ local-scope load-ingredients return 35 diff --git a/059to_text.mu b/059to_text.mu index 30761eb9..a7186ebc 100644 --- a/059to_text.mu +++ b/059to_text.mu @@ -31,7 +31,7 @@ scenario array-to-text-line-early-warning-for-static-dispatch [ ] # finally, a specialization for single characters -def to-text c:character -> y:text [ +def to-text c:char -> y:text [ local-scope load-ingredients y <- new character:type, 1/capacity @@ -39,9 +39,9 @@ def to-text c:character -> y:text [ ] scenario character-to-text [ - 1:character <- copy 111/o - 2:text <- to-text 1:character - 3:array:character <- copy *2:text + 1:char <- copy 111/o + 2:text <- to-text 1:char + 3:array:char <- copy *2:text memory-should-contain [ 3:array:character <- [o] ] diff --git a/061text.mu b/061text.mu index 7215f31c..bac0bd3c 100644 --- a/061text.mu +++ b/061text.mu @@ -18,8 +18,8 @@ def equal a:text, b:text -> result:boolean [ { done?:boolean <- greater-or-equal i, a-len break-if done? - a2:character <- index *a, i - b2:character <- index *b, i + a2:char <- index *a, i + b2:char <- index *b, i { chars-match?:boolean <- equal a2, b2 break-if chars-match? @@ -131,7 +131,7 @@ def grow-buffer buf:address:buffer -> buf:address:buffer [ { done?:boolean <- greater-or-equal i, oldlen break-if done? - src:character <- index *olddata, i + src:char <- index *olddata, i *newdata <- put-index *newdata, i, src i <- add i, 1 loop @@ -157,14 +157,14 @@ def append buf:address:buffer, x:_elem -> buf:address:buffer [ { done?:boolean <- greater-or-equal i, len break-if done? - c:character <- index *text, i + c:char <- index *text, i buf <- append buf, c i <- add i, 1 loop } ] -def append buf:address:buffer, c:character -> buf:address:buffer [ +def append buf:address:buffer, c:char -> buf:address:buffer [ local-scope load-ingredients len:number <- get *buf, length:offset @@ -198,7 +198,7 @@ def append buf:address:buffer, t:text -> buf:address:buffer [ { done?:boolean <- greater-or-equal i, len break-if done? - c:character <- index *t, i + c:char <- index *t, i buf <- append buf, c i <- add i, 1 loop @@ -210,22 +210,22 @@ scenario buffer-append-works [ local-scope x:address:buffer <- new-buffer 3 s1:text <- get *x, data:offset - c:character <- copy 97/a + c:char <- copy 97/a x <- append x, c - c:character <- copy 98/b + c:char <- copy 98/b x <- append x, c - c:character <- copy 99/c + c:char <- copy 99/c x <- append x, c s2:text <- get *x, data:offset 10:boolean/raw <- equal s1, s2 - 11:array:character/raw <- copy *s2 + 11:array:char/raw <- copy *s2 +buffer-filled - c:character <- copy 100/d + c:char <- copy 100/d x <- append x, c s3:text <- get *x, data:offset 20:boolean/raw <- equal s1, s3 21:number/raw <- get *x, length:offset - 30:array:character/raw <- copy *s3 + 30:array:char/raw <- copy *s3 ] memory-should-contain [ # before +buffer-filled @@ -251,7 +251,7 @@ scenario buffer-append-to-empty [ run [ local-scope x:address:buffer <- new-buffer - c:character <- copy 97/a + c:char <- copy 97/a x <- append x, c ] ] @@ -260,14 +260,14 @@ scenario buffer-append-handles-backspace [ run [ local-scope x:address:buffer <- new-buffer 3 - c:character <- copy 97/a + c:char <- copy 97/a x <- append x, c - c:character <- copy 98/b + c:char <- copy 98/b x <- append x, c - c:character <- copy 8/backspace + c:char <- copy 8/backspace x <- append x, c s:text <- buffer-to-array x - 10:array:character/raw <- copy *s + 10:array:char/raw <- copy *s ] memory-should-contain [ 10 <- 1 # length @@ -292,7 +292,7 @@ def buffer-to-array in:address:buffer -> result:text [ { done?:boolean <- greater-or-equal i, len break-if done? - src:character <- index *s, i + src:char <- index *s, i *result <- put-index *result, i, src i <- add i, 1 loop @@ -333,7 +333,7 @@ scenario text-append-1 [ x:text <- new [hello,] y:text <- new [ world!] z:text <- append x, y - 10:array:character/raw <- copy *z + 10:array:char/raw <- copy *z ] memory-should-contain [ 10:array:character <- [hello, world!] @@ -346,7 +346,7 @@ scenario text-append-null [ x:text <- copy 0 y:text <- new [ world!] z:text <- append x, y - 10:array:character/raw <- copy *z + 10:array:char/raw <- copy *z ] memory-should-contain [ 10:array:character <- [ world!] @@ -359,7 +359,7 @@ scenario text-append-null-2 [ x:text <- new [hello,] y:text <- copy 0 z:text <- append x, y - 10:array:character/raw <- copy *z + 10:array:char/raw <- copy *z ] memory-should-contain [ 10:array:character <- [hello,] @@ -373,7 +373,7 @@ scenario text-append-multiary [ y:text <- new [world] z:text <- new [!] z:text <- append x, y, z - 10:array:character/raw <- copy *z + 10:array:char/raw <- copy *z ] memory-should-contain [ 10:array:character <- [hello, world!] @@ -385,14 +385,14 @@ scenario replace-character-in-text [ local-scope x:text <- new [abc] x <- replace x, 98/b, 122/z - 10:array:character/raw <- copy *x + 10:array:char/raw <- copy *x ] memory-should-contain [ 10:array:character <- [azc] ] ] -def replace s:text, oldc:character, newc:character, from:number/optional -> s:text [ +def replace s:text, oldc:char, newc:char, from:number/optional -> s:text [ local-scope load-ingredients len:number <- length *s @@ -409,7 +409,7 @@ scenario replace-character-at-start [ local-scope x:text <- new [abc] x <- replace x, 97/a, 122/z - 10:array:character/raw <- copy *x + 10:array:char/raw <- copy *x ] memory-should-contain [ 10:array:character <- [zbc] @@ -421,7 +421,7 @@ scenario replace-character-at-end [ local-scope x:text <- new [abc] x <- replace x, 99/c, 122/z - 10:array:character/raw <- copy *x + 10:array:char/raw <- copy *x ] memory-should-contain [ 10:array:character <- [abz] @@ -433,7 +433,7 @@ scenario replace-character-missing [ local-scope x:text <- new [abc] x <- replace x, 100/d, 122/z - 10:array:character/raw <- copy *x + 10:array:char/raw <- copy *x ] memory-should-contain [ 10:array:character <- [abc] @@ -445,7 +445,7 @@ scenario replace-all-characters [ local-scope x:text <- new [banana] x <- replace x, 97/a, 122/z - 10:array:character/raw <- copy *x + 10:array:char/raw <- copy *x ] memory-should-contain [ 10:array:character <- [bznznz] @@ -485,7 +485,7 @@ def interpolate template:text -> result:text [ tem-done?:boolean <- greater-or-equal i, tem-len break-if tem-done?, +done:label # while template[i] != '_' - in:character <- index *template, i + in:char <- index *template, i underscore?:boolean <- equal in, 95/_ break-if underscore? # result[result-idx] = template[i] @@ -501,7 +501,7 @@ def interpolate template:text -> result:text [ arg-done?:boolean <- greater-or-equal j, a-len break-if arg-done? # result[result-idx] = a[j] - in:character <- index *a, j + in:char <- index *a, j *result <- put-index *result, result-idx, in j <- add j, 1 result-idx <- add result-idx, 1 @@ -518,7 +518,7 @@ def interpolate template:text -> result:text [ tem-done?:boolean <- greater-or-equal i, tem-len break-if tem-done? # result[result-idx] = template[i] - in:character <- index *template, i + in:char <- index *template, i *result <- put-index *result, result-idx, in i <- add i, 1 result-idx <- add result-idx, 1 @@ -532,7 +532,7 @@ scenario interpolate-works [ x:text <- new [abc_ghi] y:text <- new [def] z:text <- interpolate x, y - 10:array:character/raw <- copy *z + 10:array:char/raw <- copy *z ] memory-should-contain [ 10:array:character <- [abcdefghi] @@ -545,7 +545,7 @@ scenario interpolate-at-start [ x:text <- new [_, hello!] y:text <- new [abc] z:text <- interpolate x, y - 10:array:character/raw <- copy *z + 10:array:char/raw <- copy *z ] memory-should-contain [ 10:array:character <- [abc, hello!] @@ -558,15 +558,15 @@ scenario interpolate-at-end [ x:text <- new [hello, _] y:text <- new [abc] z:text <- interpolate x, y - 10:array:character/raw <- copy *z + 10:array:char/raw <- copy *z ] memory-should-contain [ 10:array:character <- [hello, abc] ] ] -# result:boolean <- space? c:character -def space? c:character -> result:boolean [ +# result:boolean <- space? c:char +def space? c:char -> result:boolean [ local-scope load-ingredients # most common case first @@ -640,7 +640,7 @@ def trim s:text -> result:text [ result <- new character:type, 0 return } - curr:character <- index *s, start + curr:char <- index *s, start whitespace?:boolean <- space? curr break-unless whitespace? start <- add start, 1 @@ -651,7 +651,7 @@ def trim s:text -> result:text [ { not-at-start?:boolean <- greater-than end, start assert not-at-start?, [end ran up against start] - curr:character <- index *s, end + curr:char <- index *s, end whitespace?:boolean <- space? curr break-unless whitespace? end <- subtract end, 1 @@ -668,7 +668,7 @@ def trim s:text -> result:text [ done?:boolean <- greater-than i, end break-if done? # result[j] = s[i] - src:character <- index *s, i + src:char <- index *s, i *result <- put-index *result, j, src i <- add i, 1 j <- add j, 1 @@ -681,7 +681,7 @@ scenario trim-unmodified [ local-scope x:text <- new [abc] y:text <- trim x - 1:array:character/raw <- copy *y + 1:array:char/raw <- copy *y ] memory-should-contain [ 1:array:character <- [abc] @@ -693,7 +693,7 @@ scenario trim-left [ local-scope x:text <- new [ abc] y:text <- trim x - 1:array:character/raw <- copy *y + 1:array:char/raw <- copy *y ] memory-should-contain [ 1:array:character <- [abc] @@ -705,7 +705,7 @@ scenario trim-right [ local-scope x:text <- new [abc ] y:text <- trim x - 1:array:character/raw <- copy *y + 1:array:char/raw <- copy *y ] memory-should-contain [ 1:array:character <- [abc] @@ -717,7 +717,7 @@ scenario trim-left-right [ local-scope x:text <- new [ abc ] y:text <- trim x - 1:array:character/raw <- copy *y + 1:array:char/raw <- copy *y ] memory-should-contain [ 1:array:character <- [abc] @@ -730,21 +730,21 @@ scenario trim-newline-tab [ x:text <- new [ abc ] y:text <- trim x - 1:array:character/raw <- copy *y + 1:array:char/raw <- copy *y ] memory-should-contain [ 1:array:character <- [abc] ] ] -def find-next text:text, pattern:character, idx:number -> next-index:number [ +def find-next text:text, pattern:char, idx:number -> next-index:number [ local-scope load-ingredients len:number <- length *text { eof?:boolean <- greater-or-equal idx, len break-if eof? - curr:character <- index *text, idx + curr:char <- index *text, idx found?:boolean <- equal curr, pattern break-if found? idx <- add idx, 1 @@ -846,7 +846,7 @@ scenario text-find-next-second [ def find-next text:text, pattern:text, idx:number -> next-index:number [ local-scope load-ingredients - first:character <- index *pattern, 0 + first:char <- index *pattern, 0 # repeatedly check for match at current idx len:number <- length *text { @@ -941,8 +941,8 @@ def match-at text:text, pattern:text, idx:number -> result:boolean [ { done?:boolean <- greater-or-equal pattern-idx, pattern-len break-if done? - c:character <- index *text, idx - exp:character <- index *pattern, pattern-idx + c:char <- index *text, idx + exp:char <- index *pattern, pattern-idx { match?:boolean <- equal c, exp break-if match? @@ -1061,7 +1061,7 @@ scenario match-at-inside-bounds-2 [ ] ] -def split s:text, delim:character -> result:address:array:text [ +def split s:text, delim:char -> result:address:array:text [ local-scope load-ingredients # empty text? return empty array @@ -1111,8 +1111,8 @@ scenario text-split-1 [ 10:number/raw <- length *y a:text <- index *y, 0 b:text <- index *y, 1 - 20:array:character/raw <- copy *a - 30:array:character/raw <- copy *b + 20:array:char/raw <- copy *a + 30:array:char/raw <- copy *b ] memory-should-contain [ 10 <- 2 # length of result @@ -1130,9 +1130,9 @@ scenario text-split-2 [ a:text <- index *y, 0 b:text <- index *y, 1 c:text <- index *y, 2 - 20:array:character/raw <- copy *a - 30:array:character/raw <- copy *b - 40:array:character/raw <- copy *c + 20:array:char/raw <- copy *a + 30:array:char/raw <- copy *b + 40:array:char/raw <- copy *c ] memory-should-contain [ 10 <- 3 # length of result @@ -1149,7 +1149,7 @@ scenario text-split-missing [ y:address:array:text <- split x, 47/slash 10:number/raw <- length *y a:text <- index *y, 0 - 20:array:character/raw <- copy *a + 20:array:char/raw <- copy *a ] memory-should-contain [ 10 <- 1 # length of result @@ -1179,10 +1179,10 @@ scenario text-split-empty-piece [ b:text <- index *y, 1 c:text <- index *y, 2 d:text <- index *y, 3 - 20:array:character/raw <- copy *a - 30:array:character/raw <- copy *b - 40:array:character/raw <- copy *c - 50:array:character/raw <- copy *d + 20:array:char/raw <- copy *a + 30:array:char/raw <- copy *b + 40:array:char/raw <- copy *c + 50:array:char/raw <- copy *d ] memory-should-contain [ 10 <- 4 # length of result @@ -1193,7 +1193,7 @@ scenario text-split-empty-piece [ ] ] -def split-first text:text, delim:character -> x:text, y:text [ +def split-first text:text, delim:char -> x:text, y:text [ local-scope load-ingredients # empty text? return empty texts @@ -1216,8 +1216,8 @@ scenario text-split-first [ local-scope x:text <- new [a/b] y:text, z:text <- split-first x, 47/slash - 10:array:character/raw <- copy *y - 20:array:character/raw <- copy *z + 10:array:char/raw <- copy *y + 20:array:char/raw <- copy *z ] memory-should-contain [ 10:array:character <- [a] @@ -1240,7 +1240,7 @@ def copy-range buf:text, start:number, end:number -> result:text [ { done?:boolean <- greater-or-equal src-idx, end break-if done? - src:character <- index *buf, src-idx + src:char <- index *buf, src-idx *result <- put-index *result, dest-idx, src src-idx <- add src-idx, 1 dest-idx <- add dest-idx, 1 @@ -1253,7 +1253,7 @@ scenario text-copy-copies-partial-text [ local-scope x:text <- new [abc] y:text <- copy-range x, 1, 3 - 1:array:character/raw <- copy *y + 1:array:char/raw <- copy *y ] memory-should-contain [ 1:array:character <- [bc] @@ -1265,7 +1265,7 @@ scenario text-copy-out-of-bounds [ local-scope x:text <- new [abc] y:text <- copy-range x, 2, 4 - 1:array:character/raw <- copy *y + 1:array:char/raw <- copy *y ] memory-should-contain [ 1:array:character <- [c] @@ -1277,7 +1277,7 @@ scenario text-copy-out-of-bounds-2 [ local-scope x:text <- new [abc] y:text <- copy-range x, 3, 3 - 1:array:character/raw <- copy *y + 1:array:char/raw <- copy *y ] memory-should-contain [ 1:array:character <- [] diff --git a/063array.mu b/063array.mu index fcc1c153..0d32ecc9 100644 --- a/063array.mu +++ b/063array.mu @@ -2,7 +2,7 @@ scenario array-from-args [ run [ local-scope x:text <- new-array 0, 1, 2 - 10:array:character/raw <- copy *x + 10:array:char/raw <- copy *x ] memory-should-contain [ 10 <- 3 # array length @@ -18,7 +18,7 @@ def new-array -> result:text [ capacity:number <- copy 0 { # while read curr-value - curr-value:character, exists?:boolean <- next-ingredient + curr-value:char, exists?:boolean <- next-ingredient break-unless exists? capacity <- add capacity, 1 loop @@ -30,7 +30,7 @@ def new-array -> result:text [ # while read curr-value done?:boolean <- greater-or-equal i, capacity break-if done? - curr-value:character, exists?:boolean <- next-ingredient + curr-value:char, exists?:boolean <- next-ingredient assert exists?, [error in rewinding ingredients to new-array] *result <- put-index *result, i, curr-value i <- add i, 1 diff --git a/064list.mu b/064list.mu index 408bd0e3..3cced1c1 100644 --- a/064list.mu +++ b/064list.mu @@ -71,20 +71,20 @@ def insert x:_elem, in:address:list:_elem -> in:address:list:_elem [ scenario inserting-into-list [ run [ local-scope - list:address:list:character <- push 3, 0 + list:address:list:char <- push 3, 0 list <- push 4, list list <- push 5, list - list2:address:list:character <- rest list # inside list + list2:address:list:char <- rest list # inside list list2 <- insert 6, list2 # check structure list2 <- copy list - 10:character/raw <- first list2 + 10:char/raw <- first list2 list2 <- rest list2 - 11:character/raw <- first list2 + 11:char/raw <- first list2 list2 <- rest list2 - 12:character/raw <- first list2 + 12:char/raw <- first list2 list2 <- rest list2 - 13:character/raw <- first list2 + 13:char/raw <- first list2 ] memory-should-contain [ 10 <- 5 # scanning next @@ -97,21 +97,21 @@ scenario inserting-into-list [ scenario inserting-at-end-of-list [ run [ local-scope - list:address:list:character <- push 3, 0 + list:address:list:char <- push 3, 0 list <- push 4, list list <- push 5, list - list2:address:list:character <- rest list # inside list + list2:address:list:char <- rest list # inside list list2 <- rest list2 # now at end of list list2 <- insert 6, list2 # check structure like before list2 <- copy list - 10:character/raw <- first list2 + 10:char/raw <- first list2 list2 <- rest list2 - 11:character/raw <- first list2 + 11:char/raw <- first list2 list2 <- rest list2 - 12:character/raw <- first list2 + 12:char/raw <- first list2 list2 <- rest list2 - 13:character/raw <- first list2 + 13:char/raw <- first list2 ] memory-should-contain [ 10 <- 5 # scanning next @@ -124,19 +124,19 @@ scenario inserting-at-end-of-list [ scenario inserting-after-start-of-list [ run [ local-scope - list:address:list:character <- push 3, 0 + list:address:list:char <- push 3, 0 list <- push 4, list list <- push 5, list list <- insert 6, list # check structure like before - list2:address:list:character <- copy list - 10:character/raw <- first list2 + list2:address:list:char <- copy list + 10:char/raw <- first list2 list2 <- rest list2 - 11:character/raw <- first list2 + 11:char/raw <- first list2 list2 <- rest list2 - 12:character/raw <- first list2 + 12:char/raw <- first list2 list2 <- rest list2 - 13:character/raw <- first list2 + 13:char/raw <- first list2 ] memory-should-contain [ 10 <- 5 # scanning next @@ -178,18 +178,18 @@ def remove x:address:list:_elem/contained-in:in, in:address:list:_elem -> in:add scenario removing-from-list [ run [ local-scope - list:address:list:character <- push 3, 0 + list:address:list:char <- push 3, 0 list <- push 4, list list <- push 5, list - list2:address:list:character <- rest list # second element + list2:address:list:char <- rest list # second element list <- remove list2, list 10:boolean/raw <- equal list2, 0 # check structure like before list2 <- copy list - 11:character/raw <- first list2 + 11:char/raw <- first list2 list2 <- rest list2 - 12:character/raw <- first list2 - 20:address:list:character/raw <- rest list2 + 12:char/raw <- first list2 + 20:address:list:char/raw <- rest list2 ] memory-should-contain [ 10 <- 0 # remove returned non-null @@ -202,16 +202,16 @@ scenario removing-from-list [ scenario removing-from-start-of-list [ run [ local-scope - list:address:list:character <- push 3, 0 + list:address:list:char <- push 3, 0 list <- push 4, list list <- push 5, list list <- remove list, list # check structure like before - list2:address:list:character <- copy list - 10:character/raw <- first list2 + list2:address:list:char <- copy list + 10:char/raw <- first list2 list2 <- rest list2 - 11:character/raw <- first list2 - 20:address:list:character/raw <- rest list2 + 11:char/raw <- first list2 + 20:address:list:char/raw <- rest list2 ] memory-should-contain [ 10 <- 4 # scanning next, skipping deleted element @@ -223,20 +223,20 @@ scenario removing-from-start-of-list [ scenario removing-from-end-of-list [ run [ local-scope - list:address:list:character <- push 3, 0 + list:address:list:char <- push 3, 0 list <- push 4, list list <- push 5, list # delete last element - list2:address:list:character <- rest list + list2:address:list:char <- rest list list2 <- rest list2 list <- remove list2, list 10:boolean/raw <- equal list2, 0 # check structure like before list2 <- copy list - 11:character/raw <- first list2 + 11:char/raw <- first list2 list2 <- rest list2 - 12:character/raw <- first list2 - 20:address:list:character/raw <- rest list2 + 12:char/raw <- first list2 + 20:address:list:char/raw <- rest list2 ] memory-should-contain [ 10 <- 0 # remove returned non-null @@ -249,7 +249,7 @@ scenario removing-from-end-of-list [ scenario removing-from-singleton-list [ run [ local-scope - list:address:list:character <- push 3, 0 + list:address:list:char <- push 3, 0 list <- remove list, list 1:number/raw <- copy list ] diff --git a/065duplex_list.mu b/065duplex_list.mu index cefab1f8..5bac5424 100644 --- a/065duplex_list.mu +++ b/065duplex_list.mu @@ -47,23 +47,23 @@ scenario duplex-list-handling [ # reserve locations 0-9 to check for missing null check 10:number/raw <- copy 34 11:number/raw <- copy 35 - list:address:duplex-list:character <- push 3, 0 + list:address:duplex-list:char <- push 3, 0 list <- push 4, list list <- push 5, list - list2:address:duplex-list:character <- copy list - 20:character/raw <- first list2 + list2:address:duplex-list:char <- copy list + 20:char/raw <- first list2 list2 <- next list2 - 21:character/raw <- first list2 + 21:char/raw <- first list2 list2 <- next list2 - 22:character/raw <- first list2 - 30:address:duplex-list:character/raw <- next list2 - 31:character/raw <- first 30:address:duplex-list:character/raw - 32:address:duplex-list:character/raw <- next 30:address:duplex-list:character/raw - 33:address:duplex-list:character/raw <- prev 30:address:duplex-list:character/raw + 22:char/raw <- first list2 + 30:address:duplex-list:char/raw <- next list2 + 31:char/raw <- first 30:address:duplex-list:char/raw + 32:address:duplex-list:char/raw <- next 30:address:duplex-list:char/raw + 33:address:duplex-list:char/raw <- prev 30:address:duplex-list:char/raw list2 <- prev list2 - 40:character/raw <- first list2 + 40:char/raw <- first list2 list2 <- prev list2 - 41:character/raw <- first list2 + 41:char/raw <- first list2 50:boolean/raw <- equal list, list2 ] memory-should-contain [ @@ -101,26 +101,26 @@ def insert x:_elem, in:address:duplex-list:_elem -> in:address:duplex-list:_elem scenario inserting-into-duplex-list [ run [ local-scope - list:address:duplex-list:character <- push 3, 0 + list:address:duplex-list:char <- push 3, 0 list <- push 4, list list <- push 5, list - list2:address:duplex-list:character <- next list # inside list + list2:address:duplex-list:char <- next list # inside list list2 <- insert 6, list2 # check structure like before list2 <- copy list - 10:character/raw <- first list2 + 10:char/raw <- first list2 list2 <- next list2 - 11:character/raw <- first list2 + 11:char/raw <- first list2 list2 <- next list2 - 12:character/raw <- first list2 + 12:char/raw <- first list2 list2 <- next list2 - 13:character/raw <- first list2 + 13:char/raw <- first list2 list2 <- prev list2 - 20:character/raw <- first list2 + 20:char/raw <- first list2 list2 <- prev list2 - 21:character/raw <- first list2 + 21:char/raw <- first list2 list2 <- prev list2 - 22:character/raw <- first list2 + 22:char/raw <- first list2 30:boolean/raw <- equal list, list2 ] memory-should-contain [ @@ -138,27 +138,27 @@ scenario inserting-into-duplex-list [ scenario inserting-at-end-of-duplex-list [ run [ local-scope - list:address:duplex-list:character <- push 3, 0 + list:address:duplex-list:char <- push 3, 0 list <- push 4, list list <- push 5, list - list2:address:duplex-list:character <- next list # inside list + list2:address:duplex-list:char <- next list # inside list list2 <- next list2 # now at end of list list2 <- insert 6, list2 # check structure like before list2 <- copy list - 10:character/raw <- first list2 + 10:char/raw <- first list2 list2 <- next list2 - 11:character/raw <- first list2 + 11:char/raw <- first list2 list2 <- next list2 - 12:character/raw <- first list2 + 12:char/raw <- first list2 list2 <- next list2 - 13:character/raw <- first list2 + 13:char/raw <- first list2 list2 <- prev list2 - 20:character/raw <- first list2 + 20:char/raw <- first list2 list2 <- prev list2 - 21:character/raw <- first list2 + 21:char/raw <- first list2 list2 <- prev list2 - 22:character/raw <- first list2 + 22:char/raw <- first list2 30:boolean/raw <- equal list, list2 ] memory-should-contain [ @@ -176,25 +176,25 @@ scenario inserting-at-end-of-duplex-list [ scenario inserting-after-start-of-duplex-list [ run [ local-scope - list:address:duplex-list:character <- push 3, 0 + list:address:duplex-list:char <- push 3, 0 list <- push 4, list list <- push 5, list list <- insert 6, list # check structure like before - list2:address:duplex-list:character <- copy list - 10:character/raw <- first list2 + list2:address:duplex-list:char <- copy list + 10:char/raw <- first list2 list2 <- next list2 - 11:character/raw <- first list2 + 11:char/raw <- first list2 list2 <- next list2 - 12:character/raw <- first list2 + 12:char/raw <- first list2 list2 <- next list2 - 13:character/raw <- first list2 + 13:char/raw <- first list2 list2 <- prev list2 - 20:character/raw <- first list2 + 20:char/raw <- first list2 list2 <- prev list2 - 21:character/raw <- first list2 + 21:char/raw <- first list2 list2 <- prev list2 - 22:character/raw <- first list2 + 22:char/raw <- first list2 30:boolean/raw <- equal list, list2 ] memory-should-contain [ @@ -242,20 +242,20 @@ def remove x:address:duplex-list:_elem/contained-in:in, in:address:duplex-list:_ scenario removing-from-duplex-list [ run [ local-scope - list:address:duplex-list:character <- push 3, 0 + list:address:duplex-list:char <- push 3, 0 list <- push 4, list list <- push 5, list - list2:address:duplex-list:character <- next list # second element + list2:address:duplex-list:char <- next list # second element list <- remove list2, list 10:boolean/raw <- equal list2, 0 # check structure like before list2 <- copy list - 11:character/raw <- first list2 + 11:char/raw <- first list2 list2 <- next list2 - 12:character/raw <- first list2 - 20:address:duplex-list:character/raw <- next list2 + 12:char/raw <- first list2 + 20:address:duplex-list:char/raw <- next list2 list2 <- prev list2 - 30:character/raw <- first list2 + 30:char/raw <- first list2 40:boolean/raw <- equal list, list2 ] memory-should-contain [ @@ -271,18 +271,18 @@ scenario removing-from-duplex-list [ scenario removing-from-start-of-duplex-list [ run [ local-scope - list:address:duplex-list:character <- push 3, 0 + list:address:duplex-list:char <- push 3, 0 list <- push 4, list list <- push 5, list list <- remove list, list # check structure like before - list2:address:duplex-list:character <- copy list - 10:character/raw <- first list2 + list2:address:duplex-list:char <- copy list + 10:char/raw <- first list2 list2 <- next list2 - 11:character/raw <- first list2 - 20:address:duplex-list:character/raw <- next list2 + 11:char/raw <- first list2 + 20:address:duplex-list:char/raw <- next list2 list2 <- prev list2 - 30:character/raw <- first list2 + 30:char/raw <- first list2 40:boolean/raw <- equal list, list2 ] memory-should-contain [ @@ -297,22 +297,22 @@ scenario removing-from-start-of-duplex-list [ scenario removing-from-end-of-duplex-list [ run [ local-scope - list:address:duplex-list:character <- push 3, 0 + list:address:duplex-list:char <- push 3, 0 list <- push 4, list list <- push 5, list # delete last element - list2:address:duplex-list:character <- next list + list2:address:duplex-list:char <- next list list2 <- next list2 list <- remove list2, list 10:boolean/raw <- equal list2, 0 # check structure like before list2 <- copy list - 11:character/raw <- first list2 + 11:char/raw <- first list2 list2 <- next list2 - 12:character/raw <- first list2 - 20:address:duplex-list:character/raw <- next list2 + 12:char/raw <- first list2 + 20:address:duplex-list:char/raw <- next list2 list2 <- prev list2 - 30:character/raw <- first list2 + 30:char/raw <- first list2 40:boolean/raw <- equal list, list2 ] memory-should-contain [ @@ -328,7 +328,7 @@ scenario removing-from-end-of-duplex-list [ scenario removing-from-singleton-duplex-list [ run [ local-scope - list:address:duplex-list:character <- push 3, 0 + list:address:duplex-list:char <- push 3, 0 list <- remove list, list 1:number/raw <- copy list ] @@ -365,28 +365,28 @@ def remove-between start:address:duplex-list:_elem, end:address:duplex-list:_ele scenario remove-range [ # construct a duplex list with six elements [13, 14, 15, 16, 17, 18] local-scope - list:address:duplex-list:character <- push 18, 0 + list:address:duplex-list:char <- push 18, 0 list <- push 17, list list <- push 16, list list <- push 15, list list <- push 14, list list <- push 13, list - 1:address:duplex-list:character/raw <- copy list # save list + 1:address:duplex-list:char/raw <- copy list # save list run [ local-scope - list:address:duplex-list:character <- copy 1:address:duplex-list:character/raw # restore list + list:address:duplex-list:char <- copy 1:address:duplex-list:char/raw # restore list # delete 16 onwards # first pointer: to the third element - list2:address:duplex-list:character <- next list + list2:address:duplex-list:char <- next list list2 <- next list2 list2 <- remove-between list2, 0 # now check the list - 10:character/raw <- get *list, value:offset + 10:char/raw <- get *list, value:offset list <- next list - 11:character/raw <- get *list, value:offset + 11:char/raw <- get *list, value:offset list <- next list - 12:character/raw <- get *list, value:offset - 20:address:duplex-list:character/raw <- next list + 12:char/raw <- get *list, value:offset + 20:address:duplex-list:char/raw <- next list ] memory-should-contain [ 10 <- 13 @@ -399,32 +399,32 @@ scenario remove-range [ scenario remove-range-to-final [ local-scope # construct a duplex list with six elements [13, 14, 15, 16, 17, 18] - list:address:duplex-list:character <- push 18, 0 + list:address:duplex-list:char <- push 18, 0 list <- push 17, list list <- push 16, list list <- push 15, list list <- push 14, list list <- push 13, list - 1:address:duplex-list:character/raw <- copy list # save list + 1:address:duplex-list:char/raw <- copy list # save list run [ local-scope - list:address:duplex-list:character <- copy 1:address:duplex-list:character/raw # restore list + list:address:duplex-list:char <- copy 1:address:duplex-list:char/raw # restore list # delete 15, 16 and 17 # start pointer: to the second element - list2:address:duplex-list:character <- next list + list2:address:duplex-list:char <- next list # end pointer: to the last (sixth) element - end:address:duplex-list:character <- next list2 + end:address:duplex-list:char <- next list2 end <- next end end <- next end end <- next end remove-between list2, end # now check the list - 10:character/raw <- get *list, value:offset + 10:char/raw <- get *list, value:offset list <- next list - 11:character/raw <- get *list, value:offset + 11:char/raw <- get *list, value:offset list <- next list - 12:character/raw <- get *list, value:offset - 20:address:duplex-list:character/raw <- next list + 12:char/raw <- get *list, value:offset + 20:address:duplex-list:char/raw <- next list ] memory-should-contain [ 10 <- 13 @@ -437,23 +437,23 @@ scenario remove-range-to-final [ scenario remove-range-empty [ local-scope # construct a duplex list with three elements [13, 14, 15] - list:address:duplex-list:character <- push 15, 0 + list:address:duplex-list:char <- push 15, 0 list <- push 14, list list <- push 13, list - 1:address:duplex-list:character/raw <- copy list # save list + 1:address:duplex-list:char/raw <- copy list # save list run [ local-scope - list:address:duplex-list:character <- copy 1:address:duplex-list:character/raw # restore list + list:address:duplex-list:char <- copy 1:address:duplex-list:char/raw # restore list # delete between first and second element (i.e. nothing) - list2:address:duplex-list:character <- next list + list2:address:duplex-list:char <- next list remove-between list, list2 # now check the list - 10:character/raw <- get *list, value:offset + 10:char/raw <- get *list, value:offset list <- next list - 11:character/raw <- get *list, value:offset + 11:char/raw <- get *list, value:offset list <- next list - 12:character/raw <- get *list, value:offset - 20:address:duplex-list:character/raw <- next list + 12:char/raw <- get *list, value:offset + 20:address:duplex-list:char/raw <- next list ] # no change memory-should-contain [ @@ -467,24 +467,24 @@ scenario remove-range-empty [ scenario remove-range-to-end [ local-scope # construct a duplex list with six elements [13, 14, 15, 16, 17, 18] - list:address:duplex-list:character <- push 18, 0 + list:address:duplex-list:char <- push 18, 0 list <- push 17, list list <- push 16, list list <- push 15, list list <- push 14, list list <- push 13, list - 1:address:duplex-list:character/raw <- copy list # save list + 1:address:duplex-list:char/raw <- copy list # save list run [ local-scope - list:address:duplex-list:character <- copy 1:address:duplex-list:character/raw # restore list + list:address:duplex-list:char <- copy 1:address:duplex-list:char/raw # restore list # remove the third element and beyond - list2:address:duplex-list:character <- next list + list2:address:duplex-list:char <- next list remove-between list2, 0 # now check the list - 10:character/raw <- get *list, value:offset + 10:char/raw <- get *list, value:offset list <- next list - 11:character/raw <- get *list, value:offset - 20:address:duplex-list:character/raw <- next list + 11:char/raw <- get *list, value:offset + 20:address:duplex-list:char/raw <- next list ] memory-should-contain [ 10 <- 13 diff --git a/066stream.mu b/066stream.mu index d3a16b0c..0357f47d 100644 --- a/066stream.mu +++ b/066stream.mu @@ -52,7 +52,7 @@ def peek in:address:stream:_elem -> result:_elem, empty?:boolean [ result <- index *s, idx ] -def read-line in:address:stream:character -> result:text, in:address:stream:character [ +def read-line in:address:stream:char -> result:text, in:address:stream:char [ local-scope load-ingredients idx:number <- get *in, index:offset diff --git a/069hash.cc b/069hash.cc index 0b7f4386..bbaaa924 100644 --- a/069hash.cc +++ b/069hash.cc @@ -130,7 +130,7 @@ size_t hash_iter(size_t h, size_t input) { :(scenario hash_container_checks_all_elements) container foo [ x:number - y:character + y:char ] def main [ 1:foo <- merge 34, 97/a @@ -168,7 +168,7 @@ def main [ :(scenario hash_can_ignore_container_elements) container foo [ x:number - y:character/ignore-for-hash + y:char/ignore-for-hash ] def main [ 1:foo <- merge 34, 97/a @@ -248,11 +248,11 @@ def main [ :(scenario hash_container_depends_only_on_elements) container foo [ x:number - y:character + y:char ] container bar [ x:number - y:character + y:char ] def main [ 1:foo <- merge 34, 97/a @@ -269,7 +269,7 @@ def main [ :(scenario hash_container_depends_only_on_elements_2) container foo [ x:number - y:character + y:char z:address:number ] def main [ @@ -291,7 +291,7 @@ def main [ :(scenario hash_container_depends_only_on_elements_3) container foo [ x:number - y:character + y:char z:bar ] container bar [ @@ -355,7 +355,7 @@ case HASH_OLD: { break; } if (!is_mu_text(inst.ingredients.at(0))) { - raise << maybe(get(Recipe, r).name) << "'hash_old' currently only supports strings (address:array:character), but got '" << inst.ingredients.at(0).original_string << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "'hash_old' currently only supports strings (address:array:char), but got '" << inst.ingredients.at(0).original_string << "'\n" << end(); break; } break; diff --git a/075channel.mu b/075channel.mu index 49ebad87..d97ba760 100644 --- a/075channel.mu +++ b/075channel.mu @@ -376,7 +376,7 @@ def capacity chan:address:channel:_elem -> result:number [ ] # helper for channels of characters in particular -def buffer-lines in:address:source:character, buffered-out:address:sink:character -> buffered-out:address:sink:character, in:address:source:character [ +def buffer-lines in:address:source:char, buffered-out:address:sink:char -> buffered-out:address:sink:char, in:address:source:char [ local-scope load-ingredients # repeat forever @@ -386,7 +386,7 @@ def buffer-lines in:address:source:character, buffered-out:address:sink:characte # read characters from 'in' until newline, copy into line { +next-character - c:character, eof?:boolean, in <- read in + c:char, eof?:boolean, in <- read in break-if eof? # drop a character on backspace { @@ -417,7 +417,7 @@ def buffer-lines in:address:source:character, buffered-out:address:sink:characte { done?:boolean <- greater-or-equal i, max break-if done? - c:character <- index *line-contents, i + c:char <- index *line-contents, i buffered-out <- write buffered-out, c i <- add i, 1 loop @@ -434,9 +434,9 @@ def buffer-lines in:address:source:character, buffered-out:address:sink:characte scenario buffer-lines-blocks-until-newline [ run [ local-scope - source:address:source:character, sink:address:sink:character <- new-channel 10/capacity - _, buffered-stdin:address:sink:character/buffered-stdin <- new-channel 10/capacity - buffered-chan:address:channel:character <- get *buffered-stdin, chan:offset + source:address:source:char, sink:address:sink:char <- new-channel 10/capacity + _, buffered-stdin:address:sink:char/buffered-stdin <- new-channel 10/capacity + buffered-chan:address:channel:char <- get *buffered-stdin, chan:offset empty?:boolean <- channel-empty? buffered-chan assert empty?, [ F buffer-lines-blocks-until-newline: channel should be empty after init] diff --git a/081print.mu b/081print.mu index 15fae22f..d7389d71 100644 --- a/081print.mu +++ b/081print.mu @@ -10,7 +10,7 @@ container screen [ ] container screen-cell [ - contents:character + contents:char color:number ] @@ -72,7 +72,7 @@ def fake-screen-is-empty? screen:address:screen -> result:boolean [ done?:boolean <- greater-or-equal i, len break-if done? curr:screen-cell <- index *buf, i - curr-contents:character <- get curr, contents:offset + curr-contents:char <- get curr, contents:offset i <- add i, 1 loop-unless curr-contents # not 0 @@ -81,7 +81,7 @@ def fake-screen-is-empty? screen:address:screen -> result:boolean [ return 1/true ] -def print screen:address:screen, c:character -> screen:address:screen [ +def print screen:address:screen, c:char -> screen:address:screen [ local-scope load-ingredients color:number, color-found?:boolean <- next-ingredient @@ -175,8 +175,8 @@ scenario print-character-at-top-left [ run [ local-scope fake-screen:address:screen <- new-fake-screen 3/width, 2/height - a:character <- copy 97/a - fake-screen <- print fake-screen, a:character + a:char <- copy 97/a + fake-screen <- print fake-screen, a:char cell:address:array:screen-cell <- get *fake-screen, data:offset 1:array:screen-cell/raw <- copy *cell ] @@ -193,8 +193,8 @@ scenario print-character-in-color [ run [ local-scope fake-screen:address:screen <- new-fake-screen 3/width, 2/height - a:character <- copy 97/a - fake-screen <- print fake-screen, a:character, 1/red + a:char <- copy 97/a + fake-screen <- print fake-screen, a:char, 1/red cell:address:array:screen-cell <- get *fake-screen, data:offset 1:array:screen-cell/raw <- copy *cell ] @@ -211,9 +211,9 @@ scenario print-backspace-character [ run [ local-scope fake-screen:address:screen <- new-fake-screen 3/width, 2/height - a:character <- copy 97/a + a:char <- copy 97/a fake-screen <- print fake-screen, a - backspace:character <- copy 8/backspace + backspace:char <- copy 8/backspace fake-screen <- print fake-screen, backspace 10:number/raw <- get *fake-screen, cursor-column:offset cell:address:array:screen-cell <- get *fake-screen, data:offset @@ -233,9 +233,9 @@ scenario print-extra-backspace-character [ run [ local-scope fake-screen:address:screen <- new-fake-screen 3/width, 2/height - a:character <- copy 97/a + a:char <- copy 97/a fake-screen <- print fake-screen, a - backspace:character <- copy 8/backspace + backspace:char <- copy 8/backspace fake-screen <- print fake-screen, backspace fake-screen <- print fake-screen, backspace 1:number/raw <- get *fake-screen, cursor-column:offset @@ -256,11 +256,11 @@ scenario print-character-at-right-margin [ run [ local-scope fake-screen:address:screen <- new-fake-screen 2/width, 2/height - a:character <- copy 97/a + a:char <- copy 97/a fake-screen <- print fake-screen, a - b:character <- copy 98/b + b:char <- copy 98/b fake-screen <- print fake-screen, b - c:character <- copy 99/c + c:char <- copy 99/c fake-screen <- print fake-screen, c 10:number/raw <- get *fake-screen, cursor-column:offset cell:address:array:screen-cell <- get *fake-screen, data:offset @@ -282,8 +282,8 @@ scenario print-newline-character [ run [ local-scope fake-screen:address:screen <- new-fake-screen 3/width, 2/height - newline:character <- copy 10/newline - a:character <- copy 97/a + newline:char <- copy 10/newline + a:char <- copy 97/a fake-screen <- print fake-screen, a fake-screen <- print fake-screen, newline 10:number/raw <- get *fake-screen, cursor-row:offset @@ -306,7 +306,7 @@ scenario print-newline-at-bottom-line [ run [ local-scope fake-screen:address:screen <- new-fake-screen 3/width, 2/height - newline:character <- copy 10/newline + newline:char <- copy 10/newline fake-screen <- print fake-screen, newline fake-screen <- print fake-screen, newline fake-screen <- print fake-screen, newline @@ -323,16 +323,16 @@ scenario print-character-at-bottom-right [ run [ local-scope fake-screen:address:screen <- new-fake-screen 2/width, 2/height - newline:character <- copy 10/newline + newline:char <- copy 10/newline fake-screen <- print fake-screen, newline - a:character <- copy 97/a + a:char <- copy 97/a fake-screen <- print fake-screen, a - b:character <- copy 98/b + b:char <- copy 98/b fake-screen <- print fake-screen, b - c:character <- copy 99/c + c:char <- copy 99/c fake-screen <- print fake-screen, c fake-screen <- print fake-screen, newline - d:character <- copy 100/d + d:char <- copy 100/d fake-screen <- print fake-screen, d 10:number/raw <- get *fake-screen, cursor-row:offset 11:number/raw <- get *fake-screen, cursor-column:offset @@ -359,7 +359,7 @@ scenario print-character-at-bottom-right [ def clear-line screen:address:screen -> screen:address:screen [ local-scope load-ingredients - space:character <- copy 0/nul + space:char <- copy 0/nul # if x exists, clear line in fake screen { break-unless screen @@ -387,7 +387,7 @@ def clear-line-until screen:address:screen, right:number/inclusive -> screen:add local-scope load-ingredients _, column:number <- cursor-position screen - space:character <- copy 32/space + space:char <- copy 32/space bg-color:number, bg-color-found?:boolean <- next-ingredient { # default bg-color to black @@ -435,7 +435,7 @@ scenario clear-line-erases-printed-characters [ local-scope fake-screen:address:screen <- new-fake-screen 3/width, 2/height # print a character - a:character <- copy 97/a + a:char <- copy 97/a fake-screen <- print fake-screen, a # move cursor to start of line fake-screen <- move-cursor fake-screen, 0/row, 0/column @@ -664,7 +664,7 @@ def print screen:address:screen, s:text -> screen:address:screen [ { done?:boolean <- greater-or-equal i, len break-if done? - c:character <- index *s, i + c:char <- index *s, i print screen, c, color, bg-color i <- add i, 1 loop diff --git a/082scenario_screen.cc b/082scenario_screen.cc index 509043cc..822dd951 100644 --- a/082scenario_screen.cc +++ b/082scenario_screen.cc @@ -14,8 +14,8 @@ recipes_taking_literal_strings.insert("screen-should-contain-in-color"); scenario screen-in-scenario [ assume-screen 5/width, 3/height run [ - 1:character <- copy 97/a - screen:address:screen <- print screen:address:screen, 1:character/a + 1:char <- copy 97/a + screen:address:screen <- print screen:address:screen, 1:char/a ] screen-should-contain [ # 01234 @@ -30,10 +30,10 @@ scenario screen-in-scenario [ scenario screen-in-scenario-unicode-color [ assume-screen 5/width, 3/height run [ - 1:character <- copy 955/greek-small-lambda - screen:address:screen <- print screen:address:screen, 1:character/lambda, 1/red - 2:character <- copy 97/a - screen:address:screen <- print screen:address:screen, 2:character/a + 1:char <- copy 955/greek-small-lambda + screen:address:screen <- print screen:address:screen, 1:char/lambda, 1/red + 2:char <- copy 97/a + screen:address:screen <- print screen:address:screen, 2:char/a ] screen-should-contain [ # 01234 @@ -49,10 +49,10 @@ scenario screen-in-scenario-unicode-color [ scenario screen-in-scenario-color [ assume-screen 5/width, 3/height run [ - 1:character <- copy 955/greek-small-lambda - screen:address:screen <- print screen:address:screen, 1:character/lambda, 1/red - 2:character <- copy 97/a - screen:address:screen <- print screen:address:screen, 2:character/a, 7/white + 1:char <- copy 955/greek-small-lambda + screen:address:screen <- print screen:address:screen, 1:char/lambda, 1/red + 2:char <- copy 97/a + screen:address:screen <- print screen:address:screen, 2:char/a, 7/white ] # screen-should-contain shows everything screen-should-contain [ @@ -85,8 +85,8 @@ scenario screen-in-scenario-color [ scenario screen-in-scenario-error [ assume-screen 5/width, 3/height run [ - 1:character <- copy 97/a - screen:address:screen <- print screen:address:screen, 1:character/a + 1:char <- copy 97/a + screen:address:screen <- print screen:address:screen, 1:char/a ] screen-should-contain [ # 01234 @@ -104,8 +104,8 @@ scenario screen-in-scenario-error [ scenario screen-in-scenario-color [ assume-screen 5/width, 3/height run [ - 1:character <- copy 97/a - screen:address:screen <- print screen:address:screen, 1:character/a, 1/red + 1:char <- copy 97/a + screen:address:screen <- print screen:address:screen, 1:char/a, 1/red ] screen-should-contain-in-color 2/green, [ # 01234 @@ -253,8 +253,8 @@ void check_screen(const string& expected_contents, const int color) { int screen_location = get_or_insert(Memory, SCREEN)+/*skip refcount*/1; int data_offset = find_element_name(get(Type_ordinal, "screen"), "data", ""); assert(data_offset >= 0); - int screen_data_location = screen_location+data_offset; // type: address:array:character - int screen_data_start = get_or_insert(Memory, screen_data_location) + /*skip refcount*/1; // type: array:character + int screen_data_location = screen_location+data_offset; // type: address:array:char + int screen_data_start = get_or_insert(Memory, screen_data_location) + /*skip refcount*/1; // type: array:char int width_offset = find_element_name(get(Type_ordinal, "screen"), "num-columns", ""); int screen_width = get_or_insert(Memory, screen_location+width_offset); int height_offset = find_element_name(get(Type_ordinal, "screen"), "num-rows", ""); @@ -397,8 +397,8 @@ void dump_screen() { int screen_height = get_or_insert(Memory, screen_location+height_offset); int data_offset = find_element_name(get(Type_ordinal, "screen"), "data", ""); assert(data_offset >= 0); - int screen_data_location = screen_location+data_offset; // type: address:array:character - int screen_data_start = get_or_insert(Memory, screen_data_location) + /*skip refcount*/1; // type: array:character + int screen_data_location = screen_location+data_offset; // type: address:array:char + int screen_data_start = get_or_insert(Memory, screen_data_location) + /*skip refcount*/1; // type: array:char assert(get_or_insert(Memory, screen_data_start) == screen_width*screen_height); int curr = screen_data_start+1; // skip length for (int row = 0; row < screen_height; ++row) { diff --git a/083scenario_screen_test.mu b/083scenario_screen_test.mu index c96b6e56..04fb364f 100644 --- a/083scenario_screen_test.mu +++ b/083scenario_screen_test.mu @@ -4,7 +4,7 @@ scenario print-character-at-top-left-2 [ assume-screen 3/width, 2/height run [ local-scope - a:character <- copy 97/a + a:char <- copy 97/a screen:address:screen <- print screen:address:screen, a ] screen-should-contain [ @@ -18,7 +18,7 @@ scenario clear-line-erases-printed-characters-2 [ run [ local-scope # print a character - a:character <- copy 97/a + a:char <- copy 97/a screen:address:screen <- print screen:address:screen, a # move cursor to start of line screen:address:screen <- move-cursor screen:address:screen, 0/row, 0/column diff --git a/084console.mu b/084console.mu index e736642f..8d7633e7 100644 --- a/084console.mu +++ b/084console.mu @@ -2,7 +2,7 @@ # and are thus easier to test. exclusive-container event [ - text:character + text:char keycode:number # keys on keyboard without a unicode representation touch:touch-event # mouse, track ball, etc. resize:resize-event @@ -59,22 +59,22 @@ def read-event console:address:console -> result:event, console:address:console, # variant of read-event for just keyboard events. Discards everything that # isn't unicode, so no arrow keys, page-up/page-down, etc. But you still get # newlines, tabs, ctrl-d.. -def read-key console:address:console -> result:character, console:address:console, found?:boolean, quit?:boolean [ +def read-key console:address:console -> result:char, console:address:console, found?:boolean, quit?:boolean [ local-scope load-ingredients x:event, console, found?:boolean, quit?:boolean <- read-event console return-if quit?, 0, console/same-as-ingredient:0, found?, quit? return-unless found?, 0, console/same-as-ingredient:0, found?, quit? - c:character, converted?:boolean <- maybe-convert x, text:variant + c:char, converted?:boolean <- maybe-convert x, text:variant return-unless converted?, 0, console/same-as-ingredient:0, 0/found, 0/quit return c, console/same-as-ingredient:0, 1/found, 0/quit ] -def send-keys-to-channel console:address:console, chan:address:sink:character, screen:address:screen -> console:address:console, chan:address:sink:character, screen:address:screen [ +def send-keys-to-channel console:address:console, chan:address:sink:char, screen:address:screen -> console:address:console, chan:address:sink:char, screen:address:screen [ local-scope load-ingredients { - c:character, console, found?:boolean, quit?:boolean <- read-key console + c:char, console, found?:boolean, quit?:boolean <- read-key console loop-unless found? break-if quit? assert c, [invalid event, expected text] diff --git a/085scenario_console.cc b/085scenario_console.cc index b4e41699..dbad4103 100644 --- a/085scenario_console.cc +++ b/085scenario_console.cc @@ -15,10 +15,10 @@ scenario keyboard-in-scenario [ type [abc] ] run [ - 1:character, console:address:console, 2:boolean <- read-key console:address:console - 3:character, console:address:console, 4:boolean <- read-key console:address:console - 5:character, console:address:console, 6:boolean <- read-key console:address:console - 7:character, console:address:console, 8:boolean, 9:boolean <- read-key console:address:console + 1:char, console:address:console, 2:boolean <- read-key console:address:console + 3:char, console:address:console, 4:boolean <- read-key console:address:console + 5:char, console:address:console, 6:boolean <- read-key console:address:console + 7:char, console:address:console, 8:boolean, 9:boolean <- read-key console:address:console ] memory-should-contain [ 1 <- 97 # 'a' diff --git a/086scenario_console_test.mu b/086scenario_console_test.mu index 754f1166..3a598322 100644 --- a/086scenario_console_test.mu +++ b/086scenario_console_test.mu @@ -7,10 +7,10 @@ scenario read-key-in-mu [ type [abc] ] run [ - 1:character, console:address:console, 2:boolean <- read-key console:address:console - 3:character, console:address:console, 4:boolean <- read-key console:address:console - 5:character, console:address:console, 6:boolean <- read-key console:address:console - 7:character, console:address:console, 8:boolean <- read-key console:address:console + 1:char, console:address:console, 2:boolean <- read-key console:address:console + 3:char, console:address:console, 4:boolean <- read-key console:address:console + 5:char, console:address:console, 6:boolean <- read-key console:address:console + 7:char, console:address:console, 8:boolean <- read-key console:address:console ] memory-should-contain [ 1 <- 97 # 'a' diff --git a/088file.mu b/088file.mu index 2b8e02aa..4b1a5e23 100644 --- a/088file.mu +++ b/088file.mu @@ -10,7 +10,7 @@ container file-mapping [ contents:text ] -def start-reading fs:address:filesystem, filename:text -> contents:address:source:character [ +def start-reading fs:address:filesystem, filename:text -> contents:address:source:char [ local-scope load-ingredients { @@ -18,7 +18,7 @@ def start-reading fs:address:filesystem, filename:text -> contents:address:sourc # real file system file:number <- $open-file-for-reading filename assert file, [file not found] - contents:address:source:character, sink:address:sink:character <- new-channel 30 + contents:address:source:char, sink:address:sink:char <- new-channel 30 start-running transmit-from-file file, sink return } @@ -34,7 +34,7 @@ def start-reading fs:address:filesystem, filename:text -> contents:address:sourc curr-filename:text <- get tmp, name:offset found?:boolean <- equal filename, curr-filename loop-unless found? - contents:address:source:character, sink:address:sink:character <- new-channel 30 + contents:address:source:char, sink:address:sink:char <- new-channel 30 curr-contents:text <- get tmp, contents:offset start-running transmit-from-text curr-contents, sink return @@ -42,11 +42,11 @@ def start-reading fs:address:filesystem, filename:text -> contents:address:sourc return 0/not-found ] -def transmit-from-file file:number, sink:address:sink:character -> sink:address:sink:character [ +def transmit-from-file file:number, sink:address:sink:char -> sink:address:sink:char [ local-scope load-ingredients { - c:character, eof?:boolean <- $read-from-file file + c:char, eof?:boolean <- $read-from-file file break-if eof? sink <- write sink, c loop @@ -55,7 +55,7 @@ def transmit-from-file file:number, sink:address:sink:character -> sink:address: file <- $close-file file ] -def transmit-from-text contents:text, sink:address:sink:character -> sink:address:sink:character [ +def transmit-from-text contents:text, sink:address:sink:char -> sink:address:sink:char [ local-scope load-ingredients i:number <- copy 0 @@ -63,7 +63,7 @@ def transmit-from-text contents:text, sink:address:sink:character -> sink:addres { done?:boolean <- greater-or-equal i, len break-if done? - c:character <- index *contents, i + c:char <- index *contents, i sink <- write sink, c i <- add i, 1 loop @@ -71,10 +71,10 @@ def transmit-from-text contents:text, sink:address:sink:character -> sink:addres sink <- close sink ] -def start-writing fs:address:filesystem, filename:text -> sink:address:sink:character, routine-id:number [ +def start-writing fs:address:filesystem, filename:text -> sink:address:sink:char, routine-id:number [ local-scope load-ingredients - source:address:source:character, sink:address:sink:character <- new-channel 30 + source:address:source:char, sink:address:sink:char <- new-channel 30 { break-if fs # real file system @@ -88,11 +88,11 @@ def start-writing fs:address:filesystem, filename:text -> sink:address:sink:char routine-id <- start-running transmit-to-fake-file fs, filename, source ] -def transmit-to-file file:number, source:address:source:character -> source:address:source:character [ +def transmit-to-file file:number, source:address:source:char -> source:address:source:char [ local-scope load-ingredients { - c:character, done?:boolean, source <- read source + c:char, done?:boolean, source <- read source break-if done? $write-to-file file, c loop @@ -100,13 +100,13 @@ def transmit-to-file file:number, source:address:source:character -> source:addr file <- $close-file file ] -def transmit-to-fake-file fs:address:filesystem, filename:text, source:address:source:character -> fs:address:filesystem, source:address:source:character [ +def transmit-to-fake-file fs:address:filesystem, filename:text, source:address:source:char -> fs:address:filesystem, source:address:source:char [ local-scope load-ingredients # compute new file contents buf:address:buffer <- new-buffer 30 { - c:character, done?:boolean, source <- read source + c:char, done?:boolean, source <- read source break-if done? buf <- append buf, c loop diff --git a/089scenario_filesystem.cc b/089scenario_filesystem.cc index 2b6f82a5..e45264d3 100644 --- a/089scenario_filesystem.cc +++ b/089scenario_filesystem.cc @@ -23,19 +23,19 @@ scenario assume-filesystem [ data:address:array:file-mapping <- get *filesystem:address:filesystem, data:offset file1:file-mapping <- index *data, 0 file1-name:text <- get file1, name:offset - 10:array:character/raw <- copy *file1-name + 10:array:char/raw <- copy *file1-name file1-contents:text <- get file1, contents:offset - 100:array:character/raw <- copy *file1-contents + 100:array:char/raw <- copy *file1-contents file2:file-mapping <- index *data, 1 file2-name:text <- get file2, name:offset - 30:array:character/raw <- copy *file2-name + 30:array:char/raw <- copy *file2-name file2-contents:text <- get file2, contents:offset - 40:array:character/raw <- copy *file2-contents + 40:array:char/raw <- copy *file2-contents file3:file-mapping <- index *data, 2 file3-name:text <- get file3, name:offset - 50:array:character/raw <- copy *file3-name + 50:array:char/raw <- copy *file3-name file3-contents:text <- get file3, contents:offset - 60:array:character/raw <- copy *file3-contents + 60:array:char/raw <- copy *file3-contents memory-should-contain [ 10:array:character <- [a] 100:array:character <- [a bc @@ -62,9 +62,9 @@ scenario assume-filesystem [ data:address:array:file-mapping <- get *filesystem:address:filesystem, data:offset file1:file-mapping <- index *data, 0 file1-name:text <- get file1, name:offset - 10:array:character/raw <- copy *file1-name + 10:array:char/raw <- copy *file1-name file1-contents:text <- get file1, contents:offset - 20:array:character/raw <- copy *file1-contents + 20:array:char/raw <- copy *file1-contents memory-should-contain [ 10:array:character <- [a] 20:array:character <- [x|yz diff --git a/090scenario_filesystem_test.mu b/090scenario_filesystem_test.mu index 820c075e..7953dcf8 100644 --- a/090scenario_filesystem_test.mu +++ b/090scenario_filesystem_test.mu @@ -7,11 +7,11 @@ scenario read-from-fake-file [ |xyz| ] ] - contents:address:source:character <- start-reading filesystem:address:filesystem, [a] - 1:character/raw <- read contents - 2:character/raw <- read contents - 3:character/raw <- read contents - 4:character/raw <- read contents + contents:address:source:char <- start-reading filesystem:address:filesystem, [a] + 1:char/raw <- read contents + 2:char/raw <- read contents + 3:char/raw <- read contents + 4:char/raw <- read contents _, 5:boolean/raw <- read contents memory-should-contain [ 1 <- 120 # x @@ -26,7 +26,7 @@ scenario write-to-fake-file [ local-scope assume-filesystem [ ] - sink:address:sink:character, writer:number/routine <- start-writing filesystem:address:filesystem, [a] + sink:address:sink:char, writer:number/routine <- start-writing filesystem:address:filesystem, [a] sink <- write sink, 120/x sink <- write sink, 121/y close sink @@ -43,7 +43,7 @@ scenario write-to-fake-file-that-exists [ assume-filesystem [ [a] <- [] ] - sink:address:sink:character, writer:number/routine <- start-writing filesystem:address:filesystem, [a] + sink:address:sink:char, writer:number/routine <- start-writing filesystem:address:filesystem, [a] sink <- write sink, 120/x sink <- write sink, 121/y close sink @@ -63,7 +63,7 @@ scenario write-to-existing-file-preserves-other-files [ |bcd| ] ] - sink:address:sink:character, writer:number/routine <- start-writing filesystem:address:filesystem, [a] + sink:address:sink:char, writer:number/routine <- start-writing filesystem:address:filesystem, [a] sink <- write sink, 120/x sink <- write sink, 121/y close sink @@ -82,10 +82,10 @@ scenario write-to-existing-file-preserves-other-files [ def slurp fs:address:filesystem, filename:text -> contents:text [ local-scope load-ingredients - source:address:source:character <- start-reading fs, filename + source:address:source:char <- start-reading fs, filename buf:address:buffer <- new-buffer 30/capacity { - c:character, done?:boolean, source <- read source + c:char, done?:boolean, source <- read source break-if done? buf <- append buf, c loop diff --git a/101run_sandboxed.cc b/101run_sandboxed.cc index 3564218a..3fcad59e 100644 --- a/101run_sandboxed.cc +++ b/101run_sandboxed.cc @@ -218,7 +218,7 @@ def main [ 1:text <- new [# ab add 2, 2] 2:text <- run-sandboxed 1:text - 3:array:character <- copy *2:text + 3:array:char <- copy *2:text ] +mem: storing 52 in location 4 @@ -314,7 +314,7 @@ def main [ # try to interactively add 2 and 2 1:text <- new [add 2, 2] 2:text <- run-sandboxed 1:text - 10:array:character <- copy 2:text/lookup + 10:array:char <- copy 2:text/lookup ] # first letter in the output should be '4' in unicode +mem: storing 52 in location 11 @@ -328,7 +328,7 @@ def main [ z:text <- append x:text, y:text ] 2:text <- run-sandboxed 1:text - 10:array:character <- copy 2:text/lookup + 10:array:char <- copy 2:text/lookup ] # output contains "ab" +mem: storing 97 in location 11 @@ -340,7 +340,7 @@ def main [ 1:text <- new [x:number <- copy 34 get x:number, foo:offset] 2:text, 3:text <- run-sandboxed 1:text - 10:array:character <- copy 3:text/lookup + 10:array:char <- copy 3:text/lookup ] # error should be "unknown element foo in container number" +mem: storing 117 in location 11 diff --git a/102persist.cc b/102persist.cc index 09bbc482..b1097d34 100644 --- a/102persist.cc +++ b/102persist.cc @@ -82,7 +82,7 @@ case SAVE: { break; } if (!is_mu_text(inst.ingredients.at(1))) { - raise << maybe(get(Recipe, r).name) << "second ingredient of 'save' should be an address:array:character, but got '" << to_string(inst.ingredients.at(1)) << "'\n" << end(); + raise << maybe(get(Recipe, r).name) << "second ingredient of 'save' should be an address:array:char, but got '" << to_string(inst.ingredients.at(1)) << "'\n" << end(); break; } break; diff --git a/channel.mu b/channel.mu index e2e1e758..b9054b56 100644 --- a/channel.mu +++ b/channel.mu @@ -1,11 +1,11 @@ # example program: communicating between routines using channels -def producer sink:address:sink:character -> sink:address:sink:character [ +def producer sink:address:sink:char -> sink:address:sink:char [ # produce characters 1 to 5 on a channel local-scope load-ingredients # n = 0 - n:character <- copy 0 + n:char <- copy 0 { done?:boolean <- lesser-than n, 5 break-unless done? @@ -19,16 +19,16 @@ def producer sink:address:sink:character -> sink:address:sink:character [ close sink ] -def consumer source:address:source:character -> source:address:source:character [ +def consumer source:address:source:char -> source:address:source:char [ # consume and print integers from a channel local-scope load-ingredients { # read an integer from the channel - n:character, eof?:boolean, source <- read source + n:char, eof?:boolean, source <- read source break-if eof? # other threads might get between these prints - $print [consume: ], n:character, [ + $print [consume: ], n:char, [ ] loop } @@ -36,7 +36,7 @@ def consumer source:address:source:character -> source:address:source:character def main [ local-scope - source:address:source:character, sink:address:sink:character <- new-channel 3/capacity + source:address:source:char, sink:address:sink:char <- new-channel 3/capacity # create two background 'routines' that communicate by a channel routine1:number <- start-running producer, sink routine2:number <- start-running consumer, source diff --git a/chessboard.mu b/chessboard.mu index f01f539f..bfd49d45 100644 --- a/chessboard.mu +++ b/chessboard.mu @@ -31,7 +31,7 @@ scenario print-board-and-read-move [ local-scope screen:address:screen, console:address:console <- chessboard screen:address:screen, console:address:console # icon for the cursor - cursor-icon:character <- copy 9251/␣ + cursor-icon:char <- copy 9251/␣ screen <- print screen, cursor-icon ] screen-should-contain [ @@ -62,17 +62,17 @@ scenario print-board-and-read-move [ ## Here's how 'chessboard' is implemented. -type board = address:array:address:array:character +type board = address:array:address:array:char def chessboard screen:address:screen, console:address:console -> screen:address:screen, console:address:console [ local-scope load-ingredients board:board <- initial-position # hook up stdin - stdin-in:address:source:character, stdin-out:address:sink:character <- new-channel 10/capacity + stdin-in:address:source:char, stdin-out:address:sink:char <- new-channel 10/capacity start-running send-keys-to-channel, console, stdin-out, screen # buffer lines in stdin - buffered-stdin-in:address:source:character, buffered-stdin-out:address:sink:character <- new-channel 10/capacity + buffered-stdin-in:address:source:char, buffered-stdin-out:address:sink:char <- new-channel 10/capacity start-running buffer-lines, stdin-in, buffered-stdin-out { print screen, [Stupid text-mode chessboard. White pieces in uppercase; black pieces in lowercase. No checking for legal moves. @@ -102,7 +102,7 @@ def chessboard screen:address:screen, console:address:console -> screen:address: ## a board is an array of files, a file is an array of characters (squares) -def new-board initial-position:address:array:character -> board:board [ +def new-board initial-position:address:array:char -> board:board [ local-scope load-ingredients # assert(length(initial-position) == 64) @@ -115,14 +115,14 @@ def new-board initial-position:address:array:character -> board:board [ { done?:boolean <- equal col, 8 break-if done? - file:address:array:character <- new-file initial-position, col + file:address:array:char <- new-file initial-position, col *board <- put-index *board, col, file col <- add col, 1 loop } ] -def new-file position:address:array:character, index:number -> result:address:array:character [ +def new-file position:address:array:char, index:number -> result:address:array:char [ local-scope load-ingredients index <- multiply index, 8 @@ -131,7 +131,7 @@ def new-file position:address:array:character, index:number -> result:address:ar { done?:boolean <- equal row, 8 break-if done? - square:character <- index *position, index + square:char <- index *position, index *result <- put-index *result, row, square row <- add row, 1 index <- add index, 1 @@ -143,7 +143,7 @@ def print-board screen:address:screen, board:board -> screen:address:screen [ local-scope load-ingredients row:number <- copy 7 # start printing from the top of the board - space:character <- copy 32/space + space:char <- copy 32/space # print each row { done?:boolean <- lesser-than row, 0 @@ -157,8 +157,8 @@ def print-board screen:address:screen, board:board -> screen:address:screen [ { done?:boolean <- equal col:number, 8 break-if done?:boolean - f:address:array:character <- index *board, col - c:character <- index *f, row + f:address:array:char <- index *board, col + c:char <- index *f, row print screen, c print screen, space col <- add col, 1 @@ -186,7 +186,7 @@ def initial-position -> board:board [ # B P _ _ _ _ p B # N P _ _ _ _ p n # R P _ _ _ _ p r - initial-position:address:array:character <- new-array 82/R, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 114/r, 78/N, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 110/n, 66/B, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 98/b, 81/Q, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 113/q, 75/K, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 107/k, 66/B, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 98/b, 78/N, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 110/n, 82/R, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 114/r + initial-position:address:array:char <- new-array 82/R, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 114/r, 78/N, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 110/n, 66/B, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 98/b, 81/Q, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 113/q, 75/K, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 107/k, 66/B, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 98/b, 78/N, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 110/n, 82/R, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 114/r #? 82/R, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 114/r, #? 78/N, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 110/n, #? 66/B, 80/P, 32/blank, 32/blank, 32/blank, 32/blank, 112/p, 98/b, @@ -233,7 +233,7 @@ container move [ ] # prints only error messages to screen -def read-move stdin:address:source:character, screen:address:screen -> result:address:move, quit?:boolean, error?:boolean, stdin:address:source:character, screen:address:screen [ +def read-move stdin:address:source:char, screen:address:screen -> result:address:move, quit?:boolean, error?:boolean, stdin:address:source:char, screen:address:screen [ local-scope load-ingredients from-file:number, quit?:boolean, error?:boolean <- read-file stdin, screen @@ -261,10 +261,10 @@ def read-move stdin:address:source:character, screen:address:screen -> result:ad ] # valid values for file: 0-7 -def read-file stdin:address:source:character, screen:address:screen -> file:number, quit:boolean, error:boolean, stdin:address:source:character, screen:address:screen [ +def read-file stdin:address:source:char, screen:address:screen -> file:number, quit:boolean, error:boolean, stdin:address:source:char, screen:address:screen [ local-scope load-ingredients - c:character, eof?:boolean, stdin <- read stdin + c:char, eof?:boolean, stdin <- read stdin return-if eof?, 0/dummy, 1/quit, 0/error { q-pressed?:boolean <- equal c, 81/Q @@ -308,10 +308,10 @@ def read-file stdin:address:source:character, screen:address:screen -> file:numb ] # valid values for rank: 0-7 -def read-rank stdin:address:source:character, screen:address:screen -> rank:number, quit?:boolean, error?:boolean, stdin:address:source:character, screen:address:screen [ +def read-rank stdin:address:source:char, screen:address:screen -> rank:number, quit?:boolean, error?:boolean, stdin:address:source:char, screen:address:screen [ local-scope load-ingredients - c:character, eof?:boolean, stdin <- read stdin + c:char, eof?:boolean, stdin <- read stdin return-if eof?, 0/dummy, 1/quit, 0/error { q-pressed?:boolean <- equal c, 8/Q @@ -350,10 +350,10 @@ def read-rank stdin:address:source:character, screen:address:screen -> rank:numb # read a character from the given channel and check that it's what we expect # return true on error -def expect-from-channel stdin:address:source:character, expected:character, screen:address:screen -> result:boolean, stdin:address:source:character, screen:address:screen [ +def expect-from-channel stdin:address:source:char, expected:char, screen:address:screen -> result:boolean, stdin:address:source:char, screen:address:screen [ local-scope load-ingredients - c:character, eof?:boolean, stdin <- read stdin + c:char, eof?:boolean, stdin <- read stdin return-if eof? 1/true { match?:boolean <- equal c, expected @@ -367,7 +367,7 @@ scenario read-move-blocking [ assume-screen 20/width, 2/height run [ local-scope - source:address:source:character, sink:address:sink:character <- new-channel 2/capacity + source:address:source:char, sink:address:sink:char <- new-channel 2/capacity read-move-routine:number/routine <- start-running read-move, source, screen:address:screen # 'read-move' is waiting for input wait-for-routine-to-block read-move-routine @@ -440,7 +440,7 @@ scenario read-move-quit [ assume-screen 20/width, 2/height run [ local-scope - source:address:source:character, sink:address:sink:character <- new-channel 2/capacity + source:address:source:char, sink:address:sink:char <- new-channel 2/capacity read-move-routine:number <- start-running read-move, source, screen:address:screen # 'read-move' is waiting for input wait-for-routine-to-block read-move-routine @@ -468,7 +468,7 @@ scenario read-move-illegal-file [ assume-screen 20/width, 2/height run [ local-scope - source:address:source:character, sink:address:sink:character <- new-channel 2/capacity + source:address:source:char, sink:address:sink:char <- new-channel 2/capacity read-move-routine:number <- start-running read-move, source, screen:address:screen # 'read-move' is waiting for input wait-for-routine-to-block read-move-routine @@ -490,7 +490,7 @@ scenario read-move-illegal-rank [ assume-screen 20/width, 2/height run [ local-scope - source:address:source:character, sink:address:sink:character <- new-channel 2/capacity + source:address:source:char, sink:address:sink:char <- new-channel 2/capacity read-move-routine:number <- start-running read-move, source, screen:address:screen # 'read-move' is waiting for input wait-for-routine-to-block read-move-routine @@ -513,7 +513,7 @@ scenario read-move-empty [ assume-screen 20/width, 2/height run [ local-scope - source:address:source:character, sink:address:sink:character <- new-channel 2/capacity + source:address:source:char, sink:address:sink:char <- new-channel 2/capacity read-move-routine:number <- start-running read-move, source, screen:address:screen # 'read-move' is waiting for input wait-for-routine-to-block read-move-routine @@ -539,9 +539,9 @@ def make-move board:board, m:address:move -> board:board [ from-rank:number <- get *m, from-rank:offset to-file:number <- get *m, to-file:offset to-rank:number <- get *m, to-rank:offset - from-f:address:array:character <- index *board, from-file - to-f:address:array:character <- index *board, to-file - src:character/square <- index *from-f, from-rank + from-f:address:array:char <- index *board, from-file + to-f:address:array:char <- index *board, to-file + src:char/square <- index *from-f, from-rank *to-f <- put-index *to-f, to-rank, src *from-f <- put-index *from-f, from-rank, 32/space ] diff --git a/filesystem.mu b/filesystem.mu index c6374b90..e3e481b9 100644 --- a/filesystem.mu +++ b/filesystem.mu @@ -5,10 +5,10 @@ def main [ local-scope - source-file:address:source:character <- start-reading 0/real-filesystem, [/tmp/mu-x] - sink-file:address:sink:character, write-routine:number <- start-writing 0/real-filesystem, [/tmp/mu-y] + source-file:address:source:char <- start-reading 0/real-filesystem, [/tmp/mu-x] + sink-file:address:sink:char, write-routine:number <- start-writing 0/real-filesystem, [/tmp/mu-y] { - c:character, done?:boolean, source-file <- read source-file + c:char, done?:boolean, source-file <- read source-file break-if done? sink-file <- write sink-file, c loop diff --git a/lambda_to_mu.mu b/lambda_to_mu.mu index 19fa7a1d..654bdb05 100644 --- a/lambda_to_mu.mu +++ b/lambda_to_mu.mu @@ -5,10 +5,10 @@ scenario convert-lambda [ run [ local-scope 1:text/raw <- lambda-to-mu [(add a (multiply b c))] - 2:array:character/raw <- copy *1:text/raw + 2:array:char/raw <- copy *1:text/raw ] memory-should-contain [ - 2:array:character <- [t1 <- multiply b c + 2:array:char <- [t1 <- multiply b c result <- add a t1] ] ] @@ -170,17 +170,17 @@ scenario cell-operations-on-pair [ def parse in:text -> out:address:cell [ local-scope load-ingredients - s:address:stream:character <- new-stream in + s:address:stream:char <- new-stream in out, s <- parse s trace 2, [app/parse], out ] -def parse in:address:stream:character -> out:address:cell, in:address:stream:character [ +def parse in:address:stream:char -> out:address:cell, in:address:stream:char [ local-scope load-ingredients # skip whitespace in <- skip-whitespace in - c:character, eof?:boolean <- peek in + c:char, eof?:boolean <- peek in reply-if eof?, 0/nil pair?:boolean <- equal c, 40/open-paren { @@ -191,7 +191,7 @@ def parse in:address:stream:character -> out:address:cell, in:address:stream:cha done?:boolean <- end-of-stream? in break-if done? # stop before close paren or space - c:character <- peek in + c:char <- peek in done? <- equal c, 41/close-paren break-if done? done? <- space? c @@ -265,13 +265,13 @@ def parse in:address:stream:character -> out:address:cell, in:address:stream:cha } ] -def skip-whitespace in:address:stream:character -> in:address:stream:character [ +def skip-whitespace in:address:stream:char -> in:address:stream:char [ local-scope load-ingredients { done?:boolean <- end-of-stream? in reply-if done?, 0/null - c:character <- peek in + c:char <- peek in space?:boolean <- space? c break-unless space? read in # skip @@ -318,10 +318,10 @@ scenario parse-single-letter-atom [ s:text <- new [a] x:address:cell <- parse s s2:text, 10:boolean/raw <- maybe-convert *x, atom:variant - 11:array:character/raw <- copy *s2 + 11:array:char/raw <- copy *s2 memory-should-contain [ 10 <- 1 # parse result is an atom - 11:array:character <- [a] + 11:array:char <- [a] ] ] @@ -330,10 +330,10 @@ scenario parse-atom [ s:text <- new [abc] x:address:cell <- parse s s2:text, 10:boolean/raw <- maybe-convert *x, atom:variant - 11:array:character/raw <- copy *s2 + 11:array:char/raw <- copy *s2 memory-should-contain [ 10 <- 1 # parse result is an atom - 11:array:character <- [abc] + 11:array:char <- [abc] ] ] @@ -352,16 +352,16 @@ scenario parse-list-of-two-atoms [ x3:address:cell <- first x2 s2:text, 13:boolean/raw <- maybe-convert *x3, atom:variant 14:address:cell/raw <- rest x2 - 20:array:character/raw <- copy *s1 - 30:array:character/raw <- copy *s2 + 20:array:char/raw <- copy *s1 + 30:array:char/raw <- copy *s2 memory-should-contain [ 10 <- 1 # parse result is a pair 11 <- 1 # result.first is an atom 12 <- 1 # result.rest is a pair 13 <- 1 # result.rest.first is an atom 14 <- 0 # result.rest.rest is nil - 20:array:character <- [abc] # result.first - 30:array:character <- [def] # result.rest.first + 20:array:char <- [abc] # result.first + 30:array:char <- [def] # result.rest.first ] ] @@ -380,16 +380,16 @@ scenario parse-list-with-extra-spaces [ x3:address:cell <- first x2 s2:text, 13:boolean/raw <- maybe-convert *x3, atom:variant 14:address:cell/raw <- rest x2 - 20:array:character/raw <- copy *s1 - 30:array:character/raw <- copy *s2 + 20:array:char/raw <- copy *s1 + 30:array:char/raw <- copy *s2 memory-should-contain [ 10 <- 1 # parse result is a pair 11 <- 1 # result.first is an atom 12 <- 1 # result.rest is a pair 13 <- 1 # result.rest.first is an atom 14 <- 0 # result.rest.rest is nil - 20:array:character <- [abc] # result.first - 30:array:character <- [def] # result.rest.first + 20:array:char <- [abc] # result.first + 30:array:char <- [def] # result.rest.first ] ] @@ -412,9 +412,9 @@ scenario parse-list-of-more-than-two-atoms [ x5:address:cell <- first x4 s3:text, 15:boolean/raw <- maybe-convert *x5, atom:variant 16:address:cell/raw <- rest x4 - 20:array:character/raw <- copy *s1 - 30:array:character/raw <- copy *s2 - 40:array:character/raw <- copy *s3 + 20:array:char/raw <- copy *s1 + 30:array:char/raw <- copy *s2 + 40:array:char/raw <- copy *s3 memory-should-contain [ 10 <- 1 # parse result is a pair 11 <- 1 # result.first is an atom @@ -423,9 +423,9 @@ scenario parse-list-of-more-than-two-atoms [ 14 <- 1 # result.rest.rest is a pair 15 <- 1 # result.rest.rest.first is an atom 16 <- 0 # result.rest.rest.rest is nil - 20:array:character <- [abc] # result.first - 30:array:character <- [def] # result.rest.first - 40:array:character <- [ghi] # result.rest.rest + 20:array:char <- [abc] # result.first + 30:array:char <- [def] # result.rest.first + 40:array:char <- [ghi] # result.rest.rest ] ] @@ -443,14 +443,14 @@ scenario parse-nested-list [ s1:text, 12:boolean/raw <- maybe-convert *x2, atom:variant 13:address:cell/raw <- rest x1 14:address:cell/raw <- rest x - 20:array:character/raw <- copy *s1 + 20:array:char/raw <- copy *s1 memory-should-contain [ 10 <- 1 # parse result is a pair 11 <- 1 # result.first is a pair 12 <- 1 # result.first.first is an atom 13 <- 0 # result.first.rest is nil 14 <- 0 # result.rest is nil - 20:array:character <- [abc] # result.first.first + 20:array:char <- [abc] # result.first.first ] ] @@ -471,8 +471,8 @@ scenario parse-nested-list-2 [ x4:address:cell <- first x3 s2:text, 14:boolean/raw <- maybe-convert *x4, atom:variant 15:address:cell/raw <- rest x3 - 20:array:character/raw <- copy *s1 - 30:array:character/raw <- copy *s2 + 20:array:char/raw <- copy *s1 + 30:array:char/raw <- copy *s2 memory-should-contain [ 10 <- 1 # parse result is a pair 11 <- 1 # result.first is a pair @@ -480,8 +480,8 @@ scenario parse-nested-list-2 [ 13 <- 0 # result.first.rest is nil 14 <- 1 # result.rest.first is an atom 15 <- 0 # result.rest.rest is nil - 20:array:character <- [abc] # result.first.first - 30:array:character <- [def] # result.rest.first + 20:array:char <- [abc] # result.first.first + 30:array:char <- [def] # result.rest.first ] ] @@ -521,15 +521,15 @@ scenario parse-dotted-list-of-two-atoms [ x2:address:cell <- rest x s1:text, 11:boolean/raw <- maybe-convert *x1, atom:variant s2:text, 12:boolean/raw <- maybe-convert *x2, atom:variant - 20:array:character/raw <- copy *s1 - 30:array:character/raw <- copy *s2 + 20:array:char/raw <- copy *s1 + 30:array:char/raw <- copy *s2 memory-should-contain [ # parses to < abc | def > 10 <- 1 # parse result is a pair 11 <- 1 # result.first is an atom 12 <- 1 # result.rest is an atom - 20:array:character <- [abc] # result.first - 30:array:character <- [def] # result.rest + 20:array:char <- [abc] # result.first + 30:array:char <- [def] # result.rest ] ] @@ -549,18 +549,18 @@ scenario parse-dotted-list-of-more-than-two-atoms [ s2:text, 13:boolean/raw <- maybe-convert *x3, atom:variant x4:address:cell <- rest x2 s3:text, 14:boolean/raw <- maybe-convert *x4, atom:variant - 20:array:character/raw <- copy *s1 - 30:array:character/raw <- copy *s2 - 40:array:character/raw <- copy *s3 + 20:array:char/raw <- copy *s1 + 30:array:char/raw <- copy *s2 + 40:array:char/raw <- copy *s3 memory-should-contain [ 10 <- 1 # parse result is a pair 11 <- 1 # result.first is an atom 12 <- 1 # result.rest is a pair 13 <- 1 # result.rest.first is an atom 14 <- 1 # result.rest.rest is an atom - 20:array:character <- [abc] # result.first - 30:array:character <- [def] # result.rest.first - 40:array:character <- [ghi] # result.rest.rest + 20:array:char <- [abc] # result.first + 30:array:char <- [def] # result.rest.first + 40:array:char <- [ghi] # result.rest.rest ] ] diff --git a/real_files.mu b/real_files.mu index 50137a0b..0411d872 100644 --- a/real_files.mu +++ b/real_files.mu @@ -7,7 +7,7 @@ def main [ local-scope f:number/file <- $open-file-for-reading [/tmp/mu-x] $print [file to read from: ], f, 10/newline - c:character, eof?:boolean <- $read-from-file f + c:char, eof?:boolean <- $read-from-file f $print [copying ], c, 10/newline f <- $close-file f $print [file after closing: ], f, 10/newline diff --git a/screen.mu b/screen.mu index 3400504c..f396c72c 100644 --- a/screen.mu +++ b/screen.mu @@ -4,14 +4,14 @@ # screens. def main [ open-console - 10:character <- copy 97/a - print 0/screen, 10:character/a, 2/red + 10:char <- copy 97/a + print 0/screen, 10:char/a, 2/red 1:number/raw, 2:number/raw <- cursor-position 0/screen wait-for-event 0/console clear-screen 0/screen move-cursor 0/screen, 0/row, 4/column - 10:character <- copy 98/b - print 0/screen, 10:character + 10:char <- copy 98/b + print 0/screen, 10:char wait-for-event 0/console move-cursor 0/screen, 0/row, 0/column clear-line 0/screen diff --git a/server-socket.mu b/server-socket.mu index 8a9b27ef..88c4a193 100644 --- a/server-socket.mu +++ b/server-socket.mu @@ -5,7 +5,7 @@ def main [ session:number <- $accept socket { client-message:address:buffer <- new-buffer 1024 - c:character <- $read-from-socket session + c:char <- $read-from-socket session break-unless c $print c loop |