diff options
Diffstat (limited to '061channel.mu')
-rw-r--r-- | 061channel.mu | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/061channel.mu b/061channel.mu index 5de745eb..5b3f31d3 100644 --- a/061channel.mu +++ b/061channel.mu @@ -33,7 +33,7 @@ container channel [ # result:address:channel <- new-channel capacity:number recipe new-channel [ - default-space:address:array:location <- new location:type, 30:literal + new-default-space # result = new channel result:address:channel <- new channel:type # result.first-full = 0 @@ -52,7 +52,7 @@ recipe new-channel [ # chan:address:channel <- write chan:address:channel, val:location recipe write [ - default-space:address:array:location <- new location:type, 30:literal + new-default-space chan:address:channel <- next-ingredient val:location <- next-ingredient { @@ -81,7 +81,7 @@ recipe write [ # result:location, chan:address:channel <- read chan:address:channel recipe read [ - default-space:address:array:location <- new location:type, 30:literal + new-default-space chan:address:channel <- next-ingredient { # block if chan is empty @@ -107,7 +107,7 @@ recipe read [ ] recipe clear-channel [ - default-space:address:address:array:location <- new location:type, 30:literal + new-default-space chan:address:channel <- next-ingredient { empty?:boolean <- channel-empty? chan:address:channel @@ -185,7 +185,7 @@ scenario channel-wrap [ # An empty channel has first-empty and first-full both at the same value. recipe channel-empty? [ - default-space:address:array:location <- new location:type, 30:literal + new-default-space chan:address:channel <- next-ingredient # return chan.first-full == chan.first-free full:number <- get chan:address:channel/deref, first-full:offset @@ -197,7 +197,7 @@ recipe channel-empty? [ # 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? [ - default-space:address:array:location <- new location:type, 30:literal + new-default-space chan:address:channel <- next-ingredient # tmp = chan.first-free + 1 tmp:number <- get chan:address:channel/deref, first-free:offset @@ -217,7 +217,7 @@ recipe channel-full? [ # result:number <- channel-capacity chan:address:channel recipe channel-capacity [ - default-space:address:array:location <- new location:type, 30:literal + new-default-space chan:address:channel <- next-ingredient q:address:array:location <- get chan:address:channel/deref, data:offset result:number <- length q:address:array:location/deref @@ -279,7 +279,7 @@ scenario channel-read-not-full [ # helper for channels of characters in particular # out:address:channel <- buffer-lines in:address:channel, out:address:channel recipe buffer-lines [ - default-space:address:address:array:location <- new location:type, 30:literal + new-default-space #? $print [buffer-lines: aaa #? ] in:address:channel <- next-ingredient |