diff options
Diffstat (limited to 'html/061channel.mu.html')
-rw-r--r-- | html/061channel.mu.html | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/html/061channel.mu.html b/html/061channel.mu.html index a52d34f3..47a11e0f 100644 --- a/html/061channel.mu.html +++ b/html/061channel.mu.html @@ -13,15 +13,15 @@ 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; } +.muControl { color: #c0a020; } +.muRecipe { color: #ff8700; } .muScenario { color: #00af00; } .muData { color: #ffff00; } .SalientComment { color: #00ffff; } -.muRecipe { color: #ff8700; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .Special { color: #ff6060; } .Delimiter { color: #a04060; } -.muControl { color: #c0a020; } --> </style> @@ -47,7 +47,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } run [ <span class="Constant">1</span>:address:channel<span class="Special"> <- </span>new-channel <span class="Constant">3/capacity</span> <span class="Constant">1</span>:address:channel<span class="Special"> <- </span>write <span class="Constant">1</span>:address:channel, <span class="Constant">34</span> - <span class="Constant">2</span>:number, <span class="Constant">1</span>:address:channel<span class="Special"> <- </span>read <span class="Constant">1</span>:address:channel + <span class="Constant">2</span>:character, <span class="Constant">1</span>:address:channel<span class="Special"> <- </span>read <span class="Constant">1</span>:address:channel ] memory-should-contain [ <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">34</span> @@ -63,7 +63,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="Comment"># A circular buffer contains values from index first-full up to (but not</span> <span class="Comment"># including) index first-empty. The reader always modifies it at first-full,</span> <span class="Comment"># while the writer always modifies it at first-empty.</span> - data:address:array:location + data:address:array:character ] <span class="Comment"># result:address:channel <- new-channel capacity:number</span> @@ -80,16 +80,16 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="Comment"># result.data = new location[ingredient+1]</span> capacity:number<span class="Special"> <- </span><span class="Constant">next-ingredient</span> capacity<span class="Special"> <- </span>add capacity, <span class="Constant">1</span> <span class="Comment"># unused slot for 'full?' below</span> - dest:address:address:array:location<span class="Special"> <- </span>get-address *result, <span class="Constant">data:offset</span> - *dest<span class="Special"> <- </span>new <span class="Constant">location:type</span>, capacity + dest:address:address:array:character<span class="Special"> <- </span>get-address *result, <span class="Constant">data:offset</span> + *dest<span class="Special"> <- </span>new <span class="Constant">character:type</span>, capacity <span class="muControl">reply</span> result ] -<span class="Comment"># chan <- write chan:address:channel, val:location</span> +<span class="Comment"># chan <- write chan:address:channel, val:character</span> <span class="muRecipe">recipe</span> write [ <span class="Constant">local-scope</span> chan:address:channel<span class="Special"> <- </span><span class="Constant">next-ingredient</span> - val:location<span class="Special"> <- </span><span class="Constant">next-ingredient</span> + val:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Delimiter">{</span> <span class="Comment"># block if chan is full</span> full:boolean<span class="Special"> <- </span>channel-full? chan @@ -98,9 +98,9 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } wait-for-location *full-address <span class="Delimiter">}</span> <span class="Comment"># store val</span> - circular-buffer:address:array:location<span class="Special"> <- </span>get *chan, <span class="Constant">data:offset</span> + circular-buffer:address:array:character<span class="Special"> <- </span>get *chan, <span class="Constant">data:offset</span> free:address:number<span class="Special"> <- </span>get-address *chan, <span class="Constant">first-free:offset</span> - dest:address:location<span class="Special"> <- </span>index-address *circular-buffer, *free + dest:address:character<span class="Special"> <- </span>index-address *circular-buffer, *free *dest<span class="Special"> <- </span>copy val <span class="Comment"># mark its slot as filled</span> *free<span class="Special"> <- </span>add *free, <span class="Constant">1</span> @@ -114,7 +114,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="muControl">reply</span> chan/same-as-ingredient:<span class="Constant">0</span> ] -<span class="Comment"># result:location, chan <- read chan:address:channel</span> +<span class="Comment"># result:character, chan <- read chan:address:channel</span> <span class="muRecipe">recipe</span> read [ <span class="Constant">local-scope</span> chan:address:channel<span class="Special"> <- </span><span class="Constant">next-ingredient</span> @@ -127,8 +127,8 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="Delimiter">}</span> <span class="Comment"># read result</span> full:address:number<span class="Special"> <- </span>get-address *chan, <span class="Constant">first-full:offset</span> - circular-buffer:address:array:location<span class="Special"> <- </span>get *chan, <span class="Constant">data:offset</span> - result:location<span class="Special"> <- </span>index *circular-buffer, *full + circular-buffer:address:array:character<span class="Special"> <- </span>get *chan, <span class="Constant">data:offset</span> + result:character<span class="Special"> <- </span>index *circular-buffer, *full <span class="Comment"># mark its slot as empty</span> *full<span class="Special"> <- </span>add *full, <span class="Constant">1</span> <span class="Delimiter">{</span> @@ -254,7 +254,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="muRecipe">recipe</span> channel-capacity [ <span class="Constant">local-scope</span> chan:address:channel<span class="Special"> <- </span><span class="Constant">next-ingredient</span> - q:address:array:location<span class="Special"> <- </span>get *chan, <span class="Constant">data:offset</span> + q:address:array:character<span class="Special"> <- </span>get *chan, <span class="Constant">data:offset</span> result:number<span class="Special"> <- </span>length *q <span class="muControl">reply</span> result ] |