diff options
Diffstat (limited to 'html/061channel.mu.html')
-rw-r--r-- | html/061channel.mu.html | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/html/061channel.mu.html b/html/061channel.mu.html index d1fc9b9b..73a39542 100644 --- a/html/061channel.mu.html +++ b/html/061channel.mu.html @@ -68,7 +68,7 @@ container channel [ <span class="Comment"># result:address:channel <- new-channel capacity:number</span> <span class="muRecipe">recipe</span> new-channel [ - <span class="Constant">new-default-space</span> + <span class="Constant">local-scope</span> <span class="Comment"># result = new channel</span> result:address:channel<span class="Special"> <- </span>new channel:type <span class="Comment"># result.first-full = 0</span> @@ -87,7 +87,7 @@ container channel [ <span class="Comment"># chan:address:channel <- write chan:address:channel, val:location</span> <span class="muRecipe">recipe</span> write [ - <span class="Constant">new-default-space</span> + <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> <span class="Delimiter">{</span> @@ -116,7 +116,7 @@ container channel [ <span class="Comment"># result:location, chan:address:channel <- read chan:address:channel</span> <span class="muRecipe">recipe</span> read [ - <span class="Constant">new-default-space</span> + <span class="Constant">local-scope</span> chan:address:channel<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Delimiter">{</span> <span class="Comment"># block if chan is empty</span> @@ -142,7 +142,7 @@ container channel [ ] <span class="muRecipe">recipe</span> clear-channel [ - <span class="Constant">new-default-space</span> + <span class="Constant">local-scope</span> chan:address:channel<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Delimiter">{</span> empty?:boolean<span class="Special"> <- </span>channel-empty? chan:address:channel @@ -220,7 +220,7 @@ container channel [ <span class="Comment"># An empty channel has first-empty and first-full both at the same value.</span> <span class="muRecipe">recipe</span> channel-empty? [ - <span class="Constant">new-default-space</span> + <span class="Constant">local-scope</span> chan:address:channel<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Comment"># return chan.first-full == chan.first-free</span> full:number<span class="Special"> <- </span>get chan:address:channel/deref, first-full:offset @@ -232,7 +232,7 @@ container channel [ <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> <span class="muRecipe">recipe</span> channel-full? [ - <span class="Constant">new-default-space</span> + <span class="Constant">local-scope</span> chan:address:channel<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Comment"># tmp = chan.first-free + 1</span> tmp:number<span class="Special"> <- </span>get chan:address:channel/deref, first-free:offset @@ -252,7 +252,7 @@ container channel [ <span class="Comment"># result:number <- channel-capacity chan:address:channel</span> <span class="muRecipe">recipe</span> channel-capacity [ - <span class="Constant">new-default-space</span> + <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:address:channel/deref, data:offset result:number<span class="Special"> <- </span>length q:address:array:location/deref @@ -314,7 +314,7 @@ container channel [ <span class="Comment"># helper for channels of characters in particular</span> <span class="Comment"># out:address:channel <- buffer-lines in:address:channel, out:address:channel</span> <span class="muRecipe">recipe</span> buffer-lines [ - <span class="Constant">new-default-space</span> + <span class="Constant">local-scope</span> <span class="CommentedCode">#? $print [buffer-lines: aaa</span> <span class="CommentedCode">#? ]</span> in:address:channel<span class="Special"> <- </span><span class="Constant">next-ingredient</span> @@ -333,25 +333,22 @@ container channel [ <span class="muControl">break-unless</span> backspace?:boolean <span class="Comment"># drop previous character</span> <span class="CommentedCode">#? close-console #? 2</span> -<span class="CommentedCode">#? $print [backspace! #? 1</span> +<span class="CommentedCode">#? $print [backspace!</span> <span class="CommentedCode">#? ] #? 1</span> <span class="Delimiter">{</span> buffer-length:address:number<span class="Special"> <- </span>get-address line:address:buffer/deref, length:offset buffer-empty?:boolean<span class="Special"> <- </span>equal buffer-length:address:number/deref, <span class="Constant">0:literal</span> <span class="muControl">break-if</span> buffer-empty?:boolean -<span class="CommentedCode">#? $print [before: ], buffer-length:address:number/deref, [ </span> -<span class="CommentedCode">#? ] #? 1</span> +<span class="CommentedCode">#? $print [before: ], buffer-length:address:number/deref, 10:literal/newline</span> buffer-length:address:number/deref<span class="Special"> <- </span>subtract buffer-length:address:number/deref, <span class="Constant">1:literal</span> -<span class="CommentedCode">#? $print [after: ], buffer-length:address:number/deref, [ </span> -<span class="CommentedCode">#? ] #? 1</span> +<span class="CommentedCode">#? $print [after: ], buffer-length:address:number/deref, 10:literal/newline</span> <span class="Delimiter">}</span> <span class="CommentedCode">#? $exit #? 2</span> <span class="Comment"># and don't append this one</span> <span class="muControl">loop</span> <span class="Constant">+next-character:label</span> <span class="Delimiter">}</span> <span class="Comment"># append anything else</span> -<span class="CommentedCode">#? $print [buffer-lines: appending ], c:character, [ </span> -<span class="CommentedCode">#? ]</span> +<span class="CommentedCode">#? $print [buffer-lines: appending ], c:character, 10:literal/newline</span> line:address:buffer<span class="Special"> <- </span>buffer-append line:address:buffer, c:character line-done?:boolean<span class="Special"> <- </span>equal c:character, <span class="Constant">10:literal/newline</span> <span class="muControl">break-if</span> line-done?:boolean @@ -372,8 +369,7 @@ container channel [ <span class="muControl">break-if</span> done?:boolean c:character<span class="Special"> <- </span>index line-contents:address:array:character/deref, i:number out:address:channel<span class="Special"> <- </span>write out:address:channel, c:character -<span class="CommentedCode">#? $print [writing ], i:number, [: ], c:character, [ </span> -<span class="CommentedCode">#? ] #? 1</span> +<span class="CommentedCode">#? $print [writing ], i:number, [: ], c:character, 10:literal/newline</span> i:number<span class="Special"> <- </span>add i:number, <span class="Constant">1:literal</span> <span class="muControl">loop</span> <span class="Delimiter">}</span> |