diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-07-27 17:07:52 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-07-27 17:08:29 -0700 |
commit | 5fe060d582d4a82444243a28b18085c971a85628 (patch) | |
tree | 7a13eb020d0a9cab5d4195da931a373f575229ab /html/088file.mu.html | |
parent | 013d95266d563a3f531c13eba6d2a6bfe18f8808 (diff) | |
download | mu-5fe060d582d4a82444243a28b18085c971a85628.tar.gz |
4447
Diffstat (limited to 'html/088file.mu.html')
-rw-r--r-- | html/088file.mu.html | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/html/088file.mu.html b/html/088file.mu.html index 6f3a124d..d769c5ff 100644 --- a/html/088file.mu.html +++ b/html/088file.mu.html @@ -15,6 +15,7 @@ body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color a { color:#eeeeee; text-decoration: none; } a:hover { text-decoration: underline; } * { font-size: 12pt; font-size: 1em; } +.muData { color: #ffff00; } .muRecipe { color: #ff8700; } .Special { color: #c00000; } .Delimiter { color: #800080; } @@ -23,7 +24,6 @@ a:hover { text-decoration: underline; } .Constant { color: #00a0a0; } .LineNr { color: #444444; } .muControl { color: #c0a020; } -.muData { color: #ffff00; } --> </style> @@ -81,7 +81,7 @@ if ('onhashchange' in window) { <span id="L21" class="LineNr"> 21 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L21'>start-reading</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, filename:text<span class="muRecipe"> -> </span>contents:&:<a href='075channel.mu.html#L36'>source</a>:char, error?:bool [ <span id="L22" class="LineNr"> 22 </span> <span class="Constant">local-scope</span> <span id="L23" class="LineNr"> 23 </span> <span class="Constant">load-inputs</span> -<span id="L24" class="LineNr"> 24 </span> error? <span class="Special"><-</span> copy <span class="Constant">0/false</span> +<span id="L24" class="LineNr"> 24 </span> error? <span class="Special"><-</span> copy<span class="Constant"> false</span> <span id="L25" class="LineNr"> 25 </span> <span class="Delimiter">{</span> <span id="L26" class="LineNr"> 26 </span> <span class="muControl">break-unless</span> <a href='088file.mu.html#L11'>resources</a> <span id="L27" class="LineNr"> 27 </span> <span class="Comment"># fake file system</span> @@ -90,7 +90,7 @@ if ('onhashchange' in window) { <span id="L30" class="LineNr"> 30 </span> <span class="Delimiter">}</span> <span id="L31" class="LineNr"> 31 </span> <span class="Comment"># real file system</span> <span id="L32" class="LineNr"> 32 </span> file:num <span class="Special"><-</span> $open-file-for-reading filename -<span id="L33" class="LineNr"> 33 </span> <span class="muControl">return-unless</span> file, <span class="Constant">0/contents</span>, <span class="Constant">1/error?</span> +<span id="L33" class="LineNr"> 33 </span> <span class="muControl">return-unless</span> file,<span class="Constant"> null/no-contents, true/error</span> <span id="L34" class="LineNr"> 34 </span> contents:&:<a href='075channel.mu.html#L36'>source</a>:char, <a href='075channel.mu.html#L40'>sink</a>:&:<a href='075channel.mu.html#L40'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L44'>new-channel</a><span class="Constant"> 30</span> <span id="L35" class="LineNr"> 35 </span> <span class="muControl">start-running</span> <a href='088file.mu.html#L76'>receive-from-file</a> file, <a href='075channel.mu.html#L40'>sink</a> <span id="L36" class="LineNr"> 36 </span>] @@ -99,7 +99,7 @@ if ('onhashchange' in window) { <span id="L39" class="LineNr"> 39 </span> <span class="Constant">local-scope</span> <span id="L40" class="LineNr"> 40 </span> <span class="Constant">load-inputs</span> <span id="L41" class="LineNr"> 41 </span> <a href='075channel.mu.html#L36'>source</a>:&:<a href='075channel.mu.html#L36'>source</a>:char, error?:bool <span class="Special"><-</span> <a href='088file.mu.html#L21'>start-reading</a> <a href='088file.mu.html#L11'>resources</a>, filename -<span id="L42" class="LineNr"> 42 </span> <span class="muControl">return-if</span> error?, <span class="Constant">0/contents</span> +<span id="L42" class="LineNr"> 42 </span> <span class="muControl">return-if</span> error?,<span class="Constant"> null/no-contents</span> <span id="L43" class="LineNr"> 43 </span> buf:&:<a href='061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L125'>new-buffer</a> <span class="Constant">30/capacity</span> <span id="L44" class="LineNr"> 44 </span> <span class="Delimiter">{</span> <span id="L45" class="LineNr"> 45 </span> c:char, done?:bool, <a href='075channel.mu.html#L36'>source</a> <span class="Special"><-</span> read <a href='075channel.mu.html#L36'>source</a> @@ -113,7 +113,7 @@ if ('onhashchange' in window) { <span id="L53" class="LineNr"> 53 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L53'>start-reading-from-fake-resource</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, <a href='088file.mu.html#L16'>resource</a>:text<span class="muRecipe"> -> </span>contents:&:<a href='075channel.mu.html#L36'>source</a>:char, error?:bool [ <span id="L54" class="LineNr"> 54 </span> <span class="Constant">local-scope</span> <span id="L55" class="LineNr"> 55 </span> <span class="Constant">load-inputs</span> -<span id="L56" class="LineNr"> 56 </span> error? <span class="Special"><-</span> copy <span class="Constant">0/no-error</span> +<span id="L56" class="LineNr"> 56 </span> error? <span class="Special"><-</span> copy<span class="Constant"> false</span> <span id="L57" class="LineNr"> 57 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L58" class="LineNr"> 58 </span> data:&:@:<a href='088file.mu.html#L16'>resource</a> <span class="Special"><-</span> get *resources, <span class="Constant">data:offset</span> <span id="L59" class="LineNr"> 59 </span> len:num <span class="Special"><-</span> length *data @@ -130,7 +130,7 @@ if ('onhashchange' in window) { <span id="L70" class="LineNr"> 70 </span> <span class="muControl">start-running</span> <a href='088file.mu.html#L89'>receive-from-text</a> curr-contents, <a href='075channel.mu.html#L40'>sink</a> <span id="L71" class="LineNr"> 71 </span> <span class="muControl"> return</span> <span id="L72" class="LineNr"> 72 </span> <span class="Delimiter">}</span> -<span id="L73" class="LineNr"> 73 </span> <span class="muControl"> return</span> <span class="Constant">0/not-found</span>, <span class="Constant">1/error</span> +<span id="L73" class="LineNr"> 73 </span> <span class="muControl"> return</span><span class="Constant"> null/no-such-resource, true/error-found</span> <span id="L74" class="LineNr"> 74 </span>] <span id="L75" class="LineNr"> 75 </span> <span id="L76" class="LineNr"> 76 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L76'>receive-from-file</a> file:num, <a href='075channel.mu.html#L40'>sink</a>:&:<a href='075channel.mu.html#L40'>sink</a>:char<span class="muRecipe"> -> </span><a href='075channel.mu.html#L40'>sink</a>:&:<a href='075channel.mu.html#L40'>sink</a>:char [ @@ -165,7 +165,7 @@ if ('onhashchange' in window) { <span id="L105" class="LineNr">105 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, filename:text<span class="muRecipe"> -> </span><a href='075channel.mu.html#L40'>sink</a>:&:<a href='075channel.mu.html#L40'>sink</a>:char, routine-id:num, error?:bool [ <span id="L106" class="LineNr">106 </span> <span class="Constant">local-scope</span> <span id="L107" class="LineNr">107 </span> <span class="Constant">load-inputs</span> -<span id="L108" class="LineNr">108 </span> error? <span class="Special"><-</span> copy <span class="Constant">0/false</span> +<span id="L108" class="LineNr">108 </span> error? <span class="Special"><-</span> copy<span class="Constant"> false</span> <span id="L109" class="LineNr">109 </span> <a href='075channel.mu.html#L36'>source</a>:&:<a href='075channel.mu.html#L36'>source</a>:char, <a href='075channel.mu.html#L40'>sink</a>:&:<a href='075channel.mu.html#L40'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L44'>new-channel</a><span class="Constant"> 30</span> <span id="L110" class="LineNr">110 </span> <span class="Delimiter">{</span> <span id="L111" class="LineNr">111 </span> <span class="muControl">break-unless</span> <a href='088file.mu.html#L11'>resources</a> @@ -175,7 +175,7 @@ if ('onhashchange' in window) { <span id="L115" class="LineNr">115 </span> <span class="Delimiter">}</span> <span id="L116" class="LineNr">116 </span> <span class="Comment"># real file system</span> <span id="L117" class="LineNr">117 </span> file:num <span class="Special"><-</span> $open-file-for-writing filename -<span id="L118" class="LineNr">118 </span> <span class="muControl">return-unless</span> file, <span class="Constant">0/sink</span>, <span class="Constant">0/routine-id</span>, <span class="Constant">1/error?</span> +<span id="L118" class="LineNr">118 </span> <span class="muControl">return-unless</span> file,<span class="Constant"> null/sink,</span> <span class="Constant">0/routine-id</span>,<span class="Constant"> true/error</span> <span id="L119" class="LineNr">119 </span> <span class="Delimiter">{</span> <span id="L120" class="LineNr">120 </span> <span class="muControl">break-if</span> file <span id="L121" class="LineNr">121 </span> msg:text <span class="Special"><-</span> append <span class="Constant">[no such file: ]</span> filename @@ -188,7 +188,7 @@ if ('onhashchange' in window) { <span id="L128" class="LineNr">128 </span> <span class="Constant">local-scope</span> <span id="L129" class="LineNr">129 </span> <span class="Constant">load-inputs</span> <span id="L130" class="LineNr">130 </span> <span class="Comment"># todo: really create an empty file</span> -<span id="L131" class="LineNr">131 </span> <span class="muControl">return-unless</span> contents, <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">0/no-error</span> +<span id="L131" class="LineNr">131 </span> <span class="muControl">return-unless</span> contents, <a href='088file.mu.html#L11'>resources</a>,<span class="Constant"> false/no-error</span> <span id="L132" class="LineNr">132 </span> sink-file:&:<a href='075channel.mu.html#L40'>sink</a>:char, write-routine:num, error?:bool <span class="Special"><-</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>, filename <span id="L133" class="LineNr">133 </span> <span class="muControl">return-if</span> error? <span id="L134" class="LineNr">134 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> @@ -235,7 +235,7 @@ if ('onhashchange' in window) { <span id="L175" class="LineNr">175 </span> contents:text <span class="Special"><-</span> <a href='061text.mu.html#L338'>buffer-to-array</a> buf <span id="L176" class="LineNr">176 </span> new-resource:<a href='088file.mu.html#L16'>resource</a> <span class="Special"><-</span> merge filename, contents <span id="L177" class="LineNr">177 </span> <span class="Comment"># write to resources</span> -<span id="L178" class="LineNr">178 </span> curr-filename:text <span class="Special"><-</span> copy<span class="Constant"> 0</span> +<span id="L178" class="LineNr">178 </span> curr-filename:text <span class="Special"><-</span> copy<span class="Constant"> null</span> <span id="L179" class="LineNr">179 </span> data:&:@:<a href='088file.mu.html#L16'>resource</a> <span class="Special"><-</span> get *resources, <span class="Constant">data:offset</span> <span id="L180" class="LineNr">180 </span> <span class="Comment"># replace file contents if it already exists</span> <span id="L181" class="LineNr">181 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> |