about summary refs log tree commit diff stats
path: root/061channel.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-13 20:33:39 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-13 20:33:39 -0700
commitdfd2ed38f24b82da102d7fd899fa58bb0a791023 (patch)
tree37f72197f8239e6bb79ad2fed9ae3e606b875fd9 /061channel.mu
parenta2d8c7132258efeb6da2716267786a931f95b47b (diff)
downloadmu-dfd2ed38f24b82da102d7fd899fa58bb0a791023.tar.gz
1773 - update all mu recipes to new-default-space
Turns out to not affect memory utilization or run-time. At all.
But still looks nicer and requires less fudging on our part.
Diffstat (limited to '061channel.mu')
-rw-r--r--061channel.mu16
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