about summary refs log tree commit diff stats
path: root/html/061channel.mu.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-25 22:27:19 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-25 22:27:19 -0700
commitc5ffb6e1cc9c5ff880d037c53b8ebc8562be0008 (patch)
tree2d05d987ec3c81bfbb0c1f598966d9d1b16e9b1f /html/061channel.mu.html
parentb2757892d553352feb59d70b1e7241ccdafa6905 (diff)
downloadmu-c5ffb6e1cc9c5ff880d037c53b8ebc8562be0008.tar.gz
1459
Diffstat (limited to 'html/061channel.mu.html')
-rw-r--r--html/061channel.mu.html88
1 files changed, 45 insertions, 43 deletions
diff --git a/html/061channel.mu.html b/html/061channel.mu.html
index 51ec7f2b..1054ee7b 100644
--- a/html/061channel.mu.html
+++ b/html/061channel.mu.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-<title>~/Desktop/s/mu/061channel.mu</title>
+<title>061channel.mu</title>
 <meta name="Generator" content="Vim/7.4">
 <meta name="plugin-version" content="vim7.4_v1">
 <meta name="syntax" content="none">
@@ -14,6 +14,8 @@ pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-
 body { font-family: monospace; color: #d0d0d0; background-color: #000000; }
 * { font-size: 1em; }
 .CommentedCode { color: #6c6c6c; }
+.muRecipe { color: #ff8700; }
+.muScenario { color: #00af00; }
 .Delimiter { color: #c000c0; }
 .Comment { color: #8080ff; }
 .Constant { color: #008080; }
@@ -41,7 +43,7 @@ body { font-family: monospace; color: #d0d0d0; background-color: #000000; }
 <span class="Comment"># from an empty one will put the current routine in 'waiting' state until the</span>
 <span class="Comment"># operation can be completed.</span>
 
-scenario channel [
+<span class="muScenario">scenario</span> channel [
   run [
     1:address:channel<span class="Special"> &lt;- </span>init-channel <span class="Constant">3:literal/capacity</span>
     1:address:channel<span class="Special"> &lt;- </span>write 1:address:channel, <span class="Constant">34:literal</span>
@@ -65,8 +67,8 @@ container channel [
 ]
 
 <span class="Comment"># result:address:channel &lt;- init-channel capacity:number</span>
-recipe init-channel [
-  default-space:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
+<span class="muRecipe">recipe</span> init-channel [
+  <span class="Identifier">default-space</span>:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
   <span class="Comment"># result = new channel</span>
   result:address:channel<span class="Special"> &lt;- </span>new channel:type
   <span class="Comment"># result.first-full = 0</span>
@@ -76,7 +78,7 @@ recipe init-channel [
   free:address:number<span class="Special"> &lt;- </span>get-address result:address:channel/deref, first-free:offset
   free:address:number/deref<span class="Special"> &lt;- </span>copy <span class="Constant">0:literal</span>
   <span class="Comment"># result.data = new location[ingredient+1]</span>
-  capacity:number<span class="Special"> &lt;- </span>next-ingredient
+  capacity:number<span class="Special"> &lt;- </span><span class="Identifier">next-ingredient</span>
   capacity:number<span class="Special"> &lt;- </span>add capacity:number, <span class="Constant">1:literal</span>  <span class="Comment"># unused slot for 'full?' below</span>
   dest:address:address:array:location<span class="Special"> &lt;- </span>get-address result:address:channel/deref, data:offset
   dest:address:address:array:location/deref<span class="Special"> &lt;- </span>new location:type, capacity:number
@@ -84,10 +86,10 @@ recipe init-channel [
 ]
 
 <span class="Comment"># chan:address:channel &lt;- write chan:address:channel, val:location</span>
-recipe write [
-  default-space:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
-  chan:address:channel<span class="Special"> &lt;- </span>next-ingredient
-  val:location<span class="Special"> &lt;- </span>next-ingredient
+<span class="muRecipe">recipe</span> write [
+  <span class="Identifier">default-space</span>:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
+  chan:address:channel<span class="Special"> &lt;- </span><span class="Identifier">next-ingredient</span>
+  val:location<span class="Special"> &lt;- </span><span class="Identifier">next-ingredient</span>
   <span class="Delimiter">{</span>
     <span class="Comment"># block if chan is full</span>
     full:boolean<span class="Special"> &lt;- </span>channel-full? chan:address:channel
@@ -113,9 +115,9 @@ recipe write [
 ]
 
 <span class="Comment"># result:location, chan:address:channel &lt;- read chan:address:channel</span>
-recipe read [
-  default-space:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
-  chan:address:channel<span class="Special"> &lt;- </span>next-ingredient
+<span class="muRecipe">recipe</span> read [
+  <span class="Identifier">default-space</span>:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
+  chan:address:channel<span class="Special"> &lt;- </span><span class="Identifier">next-ingredient</span>
   <span class="Delimiter">{</span>
     <span class="Comment"># block if chan is empty</span>
     empty:boolean<span class="Special"> &lt;- </span>channel-empty? chan:address:channel
@@ -139,9 +141,9 @@ recipe read [
   <span class="Identifier">reply</span> result:location, chan:address:channel/same-as-ingredient:0
 ]
 
-recipe clear-channel [
-  default-space:address:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
-  chan:address:channel<span class="Special"> &lt;- </span>next-ingredient
+<span class="muRecipe">recipe</span> clear-channel [
+  <span class="Identifier">default-space</span>:address:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
+  chan:address:channel<span class="Special"> &lt;- </span><span class="Identifier">next-ingredient</span>
   <span class="Delimiter">{</span>
     empty?:boolean<span class="Special"> &lt;- </span>channel-empty? chan:address:channel
     <span class="Identifier">break-if</span> empty?:boolean
@@ -150,7 +152,7 @@ recipe clear-channel [
   <span class="Identifier">reply</span> chan:address:channel/same-as-ingredient:0
 ]
 
-scenario channel-initialization [
+<span class="muScenario">scenario</span> channel-initialization [
   run [
     1:address:channel<span class="Special"> &lt;- </span>init-channel <span class="Constant">3:literal/capacity</span>
     2:number<span class="Special"> &lt;- </span>get 1:address:channel/deref, first-full:offset
@@ -162,7 +164,7 @@ scenario channel-initialization [
   ]
 ]
 
-scenario channel-write-increments-free [
+<span class="muScenario">scenario</span> channel-write-increments-free [
   run [
     1:address:channel<span class="Special"> &lt;- </span>init-channel <span class="Constant">3:literal/capacity</span>
     1:address:channel<span class="Special"> &lt;- </span>write 1:address:channel, <span class="Constant">34:literal</span>
@@ -175,7 +177,7 @@ scenario channel-write-increments-free [
   ]
 ]
 
-scenario channel-read-increments-full [
+<span class="muScenario">scenario</span> channel-read-increments-full [
   run [
     1:address:channel<span class="Special"> &lt;- </span>init-channel <span class="Constant">3:literal/capacity</span>
     1:address:channel<span class="Special"> &lt;- </span>write 1:address:channel, <span class="Constant">34:literal</span>
@@ -189,7 +191,7 @@ scenario channel-read-increments-full [
   ]
 ]
 
-scenario channel-wrap [
+<span class="muScenario">scenario</span> channel-wrap [
   run [
     <span class="Comment"># channel with just 1 slot</span>
     1:address:channel<span class="Special"> &lt;- </span>init-channel <span class="Constant">1:literal/capacity</span>
@@ -217,9 +219,9 @@ scenario channel-wrap [
 <span class="SalientComment">## helpers</span>
 
 <span class="Comment"># An empty channel has first-empty and first-full both at the same value.</span>
-recipe channel-empty? [
-  default-space:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
-  chan:address:channel<span class="Special"> &lt;- </span>next-ingredient
+<span class="muRecipe">recipe</span> channel-empty? [
+  <span class="Identifier">default-space</span>:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
+  chan:address:channel<span class="Special"> &lt;- </span><span class="Identifier">next-ingredient</span>
   <span class="Comment"># return chan.first-full == chan.first-free</span>
   full:number<span class="Special"> &lt;- </span>get chan:address:channel/deref, first-full:offset
   free:number<span class="Special"> &lt;- </span>get chan:address:channel/deref, first-free:offset
@@ -229,9 +231,9 @@ recipe channel-empty? [
 
 <span class="Comment"># A full channel has first-empty just before first-full, wasting one slot.</span>
 <span class="Comment"># (Other alternatives: <a href="https://en.wikipedia.org/wiki/Circular_buffer#Full_.2F_Empty_Buffer_Distinction)">https://en.wikipedia.org/wiki/Circular_buffer#Full_.2F_Empty_Buffer_Distinction)</a></span>
-recipe channel-full? [
-  default-space:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
-  chan:address:channel<span class="Special"> &lt;- </span>next-ingredient
+<span class="muRecipe">recipe</span> channel-full? [
+  <span class="Identifier">default-space</span>:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
+  chan:address:channel<span class="Special"> &lt;- </span><span class="Identifier">next-ingredient</span>
   <span class="Comment"># tmp = chan.first-free + 1</span>
   tmp:number<span class="Special"> &lt;- </span>get chan:address:channel/deref, first-free:offset
   tmp:number<span class="Special"> &lt;- </span>add tmp:number, <span class="Constant">1:literal</span>
@@ -249,15 +251,15 @@ recipe channel-full? [
 ]
 
 <span class="Comment"># result:number &lt;- channel-capacity chan:address:channel</span>
-recipe channel-capacity [
-  default-space:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
-  chan:address:channel<span class="Special"> &lt;- </span>next-ingredient
+<span class="muRecipe">recipe</span> channel-capacity [
+  <span class="Identifier">default-space</span>:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
+  chan:address:channel<span class="Special"> &lt;- </span><span class="Identifier">next-ingredient</span>
   q:address:array:location<span class="Special"> &lt;- </span>get chan:address:channel/deref, data:offset
   result:number<span class="Special"> &lt;- </span>length q:address:array:location/deref
   <span class="Identifier">reply</span> result:number
 ]
 
-scenario channel-new-empty-not-full [
+<span class="muScenario">scenario</span> channel-new-empty-not-full [
   run [
     1:address:channel<span class="Special"> &lt;- </span>init-channel <span class="Constant">3:literal/capacity</span>
     2:boolean<span class="Special"> &lt;- </span>channel-empty? 1:address:channel
@@ -269,7 +271,7 @@ scenario channel-new-empty-not-full [
   ]
 ]
 
-scenario channel-write-not-empty [
+<span class="muScenario">scenario</span> channel-write-not-empty [
   run [
     1:address:channel<span class="Special"> &lt;- </span>init-channel <span class="Constant">3:literal/capacity</span>
     1:address:channel<span class="Special"> &lt;- </span>write 1:address:channel, <span class="Constant">34:literal</span>
@@ -282,7 +284,7 @@ scenario channel-write-not-empty [
   ]
 ]
 
-scenario channel-write-full [
+<span class="muScenario">scenario</span> channel-write-full [
   run [
     1:address:channel<span class="Special"> &lt;- </span>init-channel <span class="Constant">1:literal/capacity</span>
     1:address:channel<span class="Special"> &lt;- </span>write 1:address:channel, <span class="Constant">34:literal</span>
@@ -295,7 +297,7 @@ scenario channel-write-full [
   ]
 ]
 
-scenario channel-read-not-full [
+<span class="muScenario">scenario</span> channel-read-not-full [
   run [
     1:address:channel<span class="Special"> &lt;- </span>init-channel <span class="Constant">1:literal/capacity</span>
     1:address:channel<span class="Special"> &lt;- </span>write 1:address:channel, <span class="Constant">34:literal</span>
@@ -311,12 +313,12 @@ scenario channel-read-not-full [
 
 <span class="Comment"># helper for channels of characters in particular</span>
 <span class="Comment"># out:address:channel &lt;- buffer-lines in:address:channel, out:address:channel</span>
-recipe buffer-lines [
-  default-space:address:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
+<span class="muRecipe">recipe</span> buffer-lines [
+  <span class="Identifier">default-space</span>:address:address:array:location<span class="Special"> &lt;- </span>new location:type, <span class="Constant">30:literal</span>
 <span class="CommentedCode">#?   $print [buffer-lines: aaa</span>
 <span class="CommentedCode">#? ]</span>
-  in:address:channel<span class="Special"> &lt;- </span>next-ingredient
-  out:address:channel<span class="Special"> &lt;- </span>next-ingredient
+  in:address:channel<span class="Special"> &lt;- </span><span class="Identifier">next-ingredient</span>
+  out:address:channel<span class="Special"> &lt;- </span><span class="Identifier">next-ingredient</span>
   <span class="Comment"># repeat forever</span>
   <span class="Delimiter">{</span>
     line:address:buffer<span class="Special"> &lt;- </span>init-buffer, <span class="Constant">30:literal</span>
@@ -382,33 +384,33 @@ recipe buffer-lines [
   <span class="Identifier">reply</span> out:address:channel/same-as-ingredient:1
 ]
 
-scenario buffer-lines-blocks-until-newline [
+<span class="muScenario">scenario</span> buffer-lines-blocks-until-newline [
   run [
     1:address:channel/stdin<span class="Special"> &lt;- </span>init-channel <span class="Constant">10:literal/capacity</span>
     2:address:channel/buffered-stdin<span class="Special"> &lt;- </span>init-channel <span class="Constant">10:literal/capacity</span>
     3:boolean<span class="Special"> &lt;- </span>channel-empty? 2:address:channel/buffered-stdin
     assert 3:boolean, [
-F buffer-lines-blocks-until-newline: channel should be empty after init]
+F buffer-lines-blocks-until-newline: channel should be empty <span class="muRecipe">after</span> init]
     <span class="Comment"># buffer stdin into buffered-stdin, try to read from buffered-stdin</span>
-    4:number/buffer-routine<span class="Special"> &lt;- </span>start-running buffer-lines:recipe, 1:address:channel/stdin, 2:address:channel/buffered-stdin
+    4:number/buffer-routine<span class="Special"> &lt;- </span>start-running buffer-lines:<span class="muRecipe">recipe</span>, 1:address:channel/stdin, 2:address:channel/buffered-stdin
     wait-for-routine 4:number/buffer-routine
     5:boolean<span class="Special"> &lt;- </span>channel-empty? 2:address:channel/buffered-stdin
     assert 5:boolean, [
-F buffer-lines-blocks-until-newline: channel should be empty after buffer-lines bring-up]
+F buffer-lines-blocks-until-newline: channel should be empty <span class="muRecipe">after</span> buffer-lines bring-up]
     <span class="Comment"># write 'a'</span>
     1:address:channel<span class="Special"> &lt;- </span>write 1:address:channel, <span class="Constant">97:literal/a</span>
     restart 4:number/buffer-routine
     wait-for-routine 4:number/buffer-routine
     6:boolean<span class="Special"> &lt;- </span>channel-empty? 2:address:channel/buffered-stdin
     assert 6:boolean, [
-F buffer-lines-blocks-until-newline: channel should be empty after writing<span class="Identifier"> 'a</span>']
+F buffer-lines-blocks-until-newline: channel should be empty <span class="muRecipe">after</span> writing<span class="Identifier"> 'a</span>']
     <span class="Comment"># write 'b'</span>
     1:address:channel<span class="Special"> &lt;- </span>write 1:address:channel, <span class="Constant">98:literal/b</span>
     restart 4:number/buffer-routine
     wait-for-routine 4:number/buffer-routine
     7:boolean<span class="Special"> &lt;- </span>channel-empty? 2:address:channel/buffered-stdin
     assert 7:boolean, [
-F buffer-lines-blocks-until-newline: channel should be empty after writing<span class="Identifier"> 'b</span>']
+F buffer-lines-blocks-until-newline: channel should be empty <span class="muRecipe">after</span> writing<span class="Identifier"> 'b</span>']
     <span class="Comment"># write newline</span>
     1:address:channel<span class="Special"> &lt;- </span>write 1:address:channel, <span class="Constant">10:literal/newline</span>
     restart 4:number/buffer-routine
@@ -416,7 +418,7 @@ F buffer-lines-blocks-until-newline: channel should be empty after writing<span
     8:boolean<span class="Special"> &lt;- </span>channel-empty? 2:address:channel/buffered-stdin
     9:boolean/completed?<span class="Special"> &lt;- </span>not 8:boolean
     assert 9:boolean/completed?, [
-F buffer-lines-blocks-until-newline: channel should contain data after writing newline]
+F buffer-lines-blocks-until-newline: channel should contain data <span class="muRecipe">after</span> writing newline]
     trace <span class="Constant">[test]</span>, <span class="Constant">[reached end]</span>
   ]
   trace-should-contain [