diff options
Diffstat (limited to 'html')
-rw-r--r-- | html/088file.mu.html | 12 | ||||
-rw-r--r-- | html/090scenario_filesystem_test.mu.html | 21 |
2 files changed, 28 insertions, 5 deletions
diff --git a/html/088file.mu.html b/html/088file.mu.html index 8f044eaa..49801745 100644 --- a/html/088file.mu.html +++ b/html/088file.mu.html @@ -170,10 +170,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color tmp:resource <span class="Special"><-</span> index *data, i curr-filename <span class="Special"><-</span> get tmp, <span class="Constant">name:offset</span> found?:bool <span class="Special"><-</span> equal filename, curr-filename - <span class="muControl">loop-unless</span> found? - put-index *data, i, new-resource - reset lock - <span class="muControl">return</span> + <span class="Delimiter">{</span> + <span class="muControl">break-unless</span> found? + put-index *data, i, new-resource + <span class="muControl">jump</span> <span class="Constant">+unlock-and-exit</span> + <span class="Delimiter">}</span> + i <span class="Special"><-</span> add i,<span class="Constant"> 1</span> + <span class="muControl">loop</span> <span class="Delimiter">}</span> <span class="Comment"># if file didn't already exist, make room for it</span> new-len:num <span class="Special"><-</span> add len,<span class="Constant"> 1</span> @@ -189,6 +192,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">}</span> <span class="Comment"># write new file</span> put-index *new-data, len, new-resource +<span class="Constant"> +unlock-and-exit</span> reset lock ] </pre> diff --git a/html/090scenario_filesystem_test.mu.html b/html/090scenario_filesystem_test.mu.html index f82e26e0..91d039bb 100644 --- a/html/090scenario_filesystem_test.mu.html +++ b/html/090scenario_filesystem_test.mu.html @@ -55,7 +55,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] ] -<span class="muScenario">scenario</span> write-to-fake-file [ +<span class="muScenario">scenario</span> write-to-new-fake-file [ <span class="Constant">local-scope</span> assume-resources [ ] @@ -71,6 +71,25 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] ] +<span class="muScenario">scenario</span> write-to-new-fake-file-2 [ + <span class="Constant">local-scope</span> + assume-resources [ + <span class="Constant">[a]</span> <span class="Special"><-</span> [ +<span class="Constant"> |abc|</span> + ] + ] + sink:&:sink:char, writer:num/routine <span class="Special"><-</span> start-writing resources, <span class="Constant">[b]</span> + sink <span class="Special"><-</span> write sink, <span class="Constant">120/x</span> + sink <span class="Special"><-</span> write sink, <span class="Constant">121/y</span> + close sink + wait-for-routine writer + contents-read-back:text <span class="Special"><-</span> slurp resources, <span class="Constant">[b]</span> + 10:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal contents-read-back, <span class="Constant">[xy]</span> + memory-should-contain [ + <span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 1</span> <span class="Comment"># file contents read back exactly match what was written</span> + ] +] + <span class="muScenario">scenario</span> write-to-fake-file-that-exists [ <span class="Constant">local-scope</span> assume-resources [ |