From 762b099ef6c6ad5b6b61d29e473baa6df8d64ab9 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 18 Jul 2015 15:22:49 -0700 Subject: 1818 --- html/061channel.mu.html | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'html/061channel.mu.html') diff --git a/html/061channel.mu.html b/html/061channel.mu.html index d1fc9b9b..73a39542 100644 --- a/html/061channel.mu.html +++ b/html/061channel.mu.html @@ -68,7 +68,7 @@ container channel [ # result:address:channel <- new-channel capacity:number recipe new-channel [ - new-default-space + local-scope # result = new channel result:address:channel <- new channel:type # result.first-full = 0 @@ -87,7 +87,7 @@ container channel [ # chan:address:channel <- write chan:address:channel, val:location recipe write [ - new-default-space + local-scope chan:address:channel <- next-ingredient val:location <- next-ingredient { @@ -116,7 +116,7 @@ container channel [ # result:location, chan:address:channel <- read chan:address:channel recipe read [ - new-default-space + local-scope chan:address:channel <- next-ingredient { # block if chan is empty @@ -142,7 +142,7 @@ container channel [ ] recipe clear-channel [ - new-default-space + local-scope chan:address:channel <- next-ingredient { empty?:boolean <- channel-empty? chan:address:channel @@ -220,7 +220,7 @@ container channel [ # An empty channel has first-empty and first-full both at the same value. recipe channel-empty? [ - new-default-space + local-scope chan:address:channel <- next-ingredient # return chan.first-full == chan.first-free full:number <- get chan:address:channel/deref, first-full:offset @@ -232,7 +232,7 @@ container channel [ # A full channel has first-empty just before first-full, wasting one slot. # (Other alternatives: https://en.wikipedia.org/wiki/Circular_buffer#Full_.2F_Empty_Buffer_Distinction) recipe channel-full? [ - new-default-space + local-scope chan:address:channel <- next-ingredient # tmp = chan.first-free + 1 tmp:number <- get chan:address:channel/deref, first-free:offset @@ -252,7 +252,7 @@ container channel [ # result:number <- channel-capacity chan:address:channel recipe channel-capacity [ - new-default-space + local-scope chan:address:channel <- next-ingredient q:address:array:location <- get chan:address:channel/deref, data:offset result:number <- length q:address:array:location/deref @@ -314,7 +314,7 @@ container channel [ # helper for channels of characters in particular # out:address:channel <- buffer-lines in:address:channel, out:address:channel recipe buffer-lines [ - new-default-space + local-scope #? $print [buffer-lines: aaa #? ] in:address:channel <- next-ingredient @@ -333,25 +333,22 @@ container channel [ break-unless backspace?:boolean # drop previous character #? close-console #? 2 -#? $print [backspace! #? 1 +#? $print [backspace! #? ] #? 1 { buffer-length:address:number <- get-address line:address:buffer/deref, length:offset buffer-empty?:boolean <- equal buffer-length:address:number/deref, 0:literal break-if buffer-empty?:boolean -#? $print [before: ], buffer-length:address:number/deref, [ -#? ] #? 1 +#? $print [before: ], buffer-length:address:number/deref, 10:literal/newline buffer-length:address:number/deref <- subtract buffer-length:address:number/deref, 1:literal -#? $print [after: ], buffer-length:address:number/deref, [ -#? ] #? 1 +#? $print [after: ], buffer-length:address:number/deref, 10:literal/newline } #? $exit #? 2 # and don't append this one loop +next-character:label } # append anything else -#? $print [buffer-lines: appending ], c:character, [ -#? ] +#? $print [buffer-lines: appending ], c:character, 10:literal/newline line:address:buffer <- buffer-append line:address:buffer, c:character line-done?:boolean <- equal c:character, 10:literal/newline break-if line-done?:boolean @@ -372,8 +369,7 @@ container channel [ break-if done?:boolean c:character <- index line-contents:address:array:character/deref, i:number out:address:channel <- write out:address:channel, c:character -#? $print [writing ], i:number, [: ], c:character, [ -#? ] #? 1 +#? $print [writing ], i:number, [: ], c:character, 10:literal/newline i:number <- add i:number, 1:literal loop } -- cgit 1.4.1-2-gfad0