From 4fe9f5e8257770a6b1de1aa94748609acd37f0f6 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 3 Aug 2015 00:49:38 -0700 Subject: 1925 --- html/061channel.mu.html | 66 ++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'html/061channel.mu.html') diff --git a/html/061channel.mu.html b/html/061channel.mu.html index 89df9b83..b8cfae4c 100644 --- a/html/061channel.mu.html +++ b/html/061channel.mu.html @@ -13,14 +13,14 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } body { font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 1.05em; } -.muScenario { color: #00af00; } -.Delimiter { color: #a04060; } +.muControl { color: #c0a020; } .muRecipe { color: #ff8700; } +.muScenario { color: #00af00; } .SalientComment { color: #00ffff; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .Special { color: #ff6060; } -.muControl { color: #c0a020; } +.Delimiter { color: #a04060; } --> @@ -69,18 +69,18 @@ container channel [ recipe new-channel [ local-scope # result = new channel - result:address:channel <- new channel:type + result:address:channel <- new channel:type # result.first-full = 0 - full:address:number <- get-address *result, first-full:offset + full:address:number <- get-address *result, first-full:offset *full <- copy 0 # result.first-free = 0 - free:address:number <- get-address *result, first-free:offset + free:address:number <- get-address *result, first-free:offset *free <- copy 0 # result.data = new location[ingredient+1] capacity:number <- next-ingredient capacity <- add capacity, 1 # unused slot for 'full?' below - dest:address:address:array:location <- get-address *result, data:offset - *dest <- new location:type, capacity + dest:address:address:array:location <- get-address *result, data:offset + *dest <- new location:type, capacity reply result ] @@ -93,12 +93,12 @@ container channel [ # block if chan is full full:boolean <- channel-full? chan break-unless full - full-address:address:number <- get-address *chan, first-full:offset + full-address:address:number <- get-address *chan, first-full:offset wait-for-location *full-address } # store val - circular-buffer:address:array:location <- get *chan, data:offset - free:address:number <- get-address *chan, first-free:offset + circular-buffer:address:array:location <- get *chan, data:offset + free:address:number <- get-address *chan, first-free:offset dest:address:location <- index-address *circular-buffer, *free *dest <- copy val # mark its slot as filled @@ -121,12 +121,12 @@ container channel [ # block if chan is empty empty?:boolean <- channel-empty? chan break-unless empty? - free-address:address:number <- get-address *chan, first-free:offset + free-address:address:number <- get-address *chan, first-free:offset wait-for-location *free-address } # read result - full:address:number <- get-address *chan, first-full:offset - circular-buffer:address:array:location <- get *chan, data:offset + full:address:number <- get-address *chan, first-full:offset + circular-buffer:address:array:location <- get *chan, data:offset result:location <- index *circular-buffer, *full # increment full *full <- add *full, 1 @@ -154,8 +154,8 @@ container channel [ scenario channel-initialization [ run [ 1:address:channel <- new-channel 3/capacity - 2:number <- get *1:address:channel, first-full:offset - 3:number <- get *1:address:channel, first-free:offset + 2:number <- get *1:address:channel, first-full:offset + 3:number <- get *1:address:channel, first-free:offset ] memory-should-contain [ 2 <- 0 # first-full @@ -167,8 +167,8 @@ container channel [ run [ 1:address:channel <- new-channel 3/capacity 1:address:channel <- write 1:address:channel, 34 - 2:number <- get *1:address:channel, first-full:offset - 3:number <- get *1:address:channel, first-free:offset + 2:number <- get *1:address:channel, first-full:offset + 3:number <- get *1:address:channel, first-free:offset ] memory-should-contain [ 2 <- 0 # first-full @@ -181,8 +181,8 @@ container channel [ 1:address:channel <- new-channel 3/capacity 1:address:channel <- write 1:address:channel, 34 _, 1:address:channel <- read 1:address:channel - 2:number <- get *1:address:channel, first-full:offset - 3:number <- get *1:address:channel, first-free:offset + 2:number <- get *1:address:channel, first-full:offset + 3:number <- get *1:address:channel, first-free:offset ] memory-should-contain [ 2 <- 1 # first-full @@ -198,14 +198,14 @@ container channel [ 1:address:channel <- write 1:address:channel, 34 _, 1:address:channel <- read 1:address:channel # first-free will now be 1 - 2:number <- get *1:address:channel, first-free:offset - 3:number <- get *1:address:channel, first-free:offset + 2:number <- get *1:address:channel, first-free:offset + 3:number <- get *1:address:channel, first-free:offset # write second value, verify that first-free wraps 1:address:channel <- write 1:address:channel, 34 - 4:number <- get *1:address:channel, first-free:offset + 4:number <- get *1:address:channel, first-free:offset # read second value, verify that first-full wraps _, 1:address:channel <- read 1:address:channel - 5:number <- get *1:address:channel, first-full:offset + 5:number <- get *1:address:channel, first-full:offset ] memory-should-contain [ 2 <- 1 # first-free after first write @@ -222,8 +222,8 @@ container channel [ local-scope chan:address:channel <- next-ingredient # return chan.first-full == chan.first-free - full:number <- get *chan, first-full:offset - free:number <- get *chan, first-free:offset + full:number <- get *chan, first-full:offset + free:number <- get *chan, first-free:offset result:boolean <- equal full, free reply result ] @@ -234,7 +234,7 @@ container channel [ local-scope chan:address:channel <- next-ingredient # tmp = chan.first-free + 1 - tmp:number <- get *chan, first-free:offset + tmp:number <- get *chan, first-free:offset tmp <- add tmp, 1 { # if tmp == chan.capacity, tmp = 0 @@ -244,7 +244,7 @@ container channel [ tmp <- copy 0 } # return chan.first-full == tmp - full:number <- get *chan, first-full:offset + full:number <- get *chan, first-full:offset result:boolean <- equal full, tmp reply result ] @@ -253,7 +253,7 @@ container channel [ recipe channel-capacity [ local-scope chan:address:channel <- next-ingredient - q:address:array:location <- get *chan, data:offset + q:address:array:location <- get *chan, data:offset result:number <- length *q reply result ] @@ -330,7 +330,7 @@ container channel [ break-unless backspace? # drop previous character { - buffer-length:address:number <- get-address *line, length:offset + buffer-length:address:number <- get-address *line, length:offset buffer-empty?:boolean <- equal *buffer-length, 0 break-if buffer-empty? *buffer-length <- subtract *buffer-length, 1 @@ -349,8 +349,8 @@ container channel [ } # copy line into 'out' i:number <- copy 0 - line-contents:address:array:character <- get *line, data:offset - max:number <- get *line, length:offset + line-contents:address:array:character <- get *line, data:offset + max:number <- get *line, length:offset { done?:boolean <- greater-or-equal i, max break-if done? @@ -372,7 +372,7 @@ container channel [ assert 3:boolean, [ F buffer-lines-blocks-until-newline: channel should be empty after init] # buffer stdin into buffered-stdin, try to read from buffered-stdin - 4:number/buffer-routine <- start-running buffer-lines:recipe, 1:address:channel/stdin, 2:address:channel/buffered-stdin + 4:number/buffer-routine <- start-running buffer-lines:recipe, 1:address:channel/stdin, 2:address:channel/buffered-stdin wait-for-routine 4:number/buffer-routine 5:boolean <- channel-empty? 2:address:channel/buffered-stdin assert 5:boolean, [ -- cgit 1.4.1-2-gfad0