diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-15 01:01:58 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-15 01:01:58 -0700 |
commit | 0ca56ed853c3d9bc8c26d1b014d8b665363fc2d0 (patch) | |
tree | abd2d2e4b65c34797a635aeb2f7d06c9d65c7bf9 /html/088file.mu.html | |
parent | 36b927a63cb25e9fc64cf4ae079b32d23d528b1b (diff) | |
download | mu-0ca56ed853c3d9bc8c26d1b014d8b665363fc2d0.tar.gz |
3355
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 e86201ed..435e3439 100644 --- a/html/088file.mu.html +++ b/html/088file.mu.html @@ -39,11 +39,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muData">container</span> file-mapping [ - name:address:array:character - contents:address:array:character + name:text + contents:text ] -<span class="muRecipe">def</span> start-reading fs:address:filesystem, filename:address:array:character<span class="muRecipe"> -> </span>contents:address:source:character [ +<span class="muRecipe">def</span> start-reading fs:address:filesystem, filename:text<span class="muRecipe"> -> </span>contents:address:source:character [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Delimiter">{</span> @@ -64,11 +64,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">break-if</span> done? tmp:file-mapping<span class="Special"> <- </span>index *data, i i<span class="Special"> <- </span>add i, <span class="Constant">1</span> - curr-filename:address:array:character<span class="Special"> <- </span>get tmp, <span class="Constant">name:offset</span> + curr-filename:text<span class="Special"> <- </span>get tmp, <span class="Constant">name:offset</span> found?:boolean<span class="Special"> <- </span>equal filename, curr-filename <span class="muControl">loop-unless</span> found? contents:address:source:character, sink:address:sink:character<span class="Special"> <- </span>new-channel <span class="Constant">30</span> - curr-contents:address:array:character<span class="Special"> <- </span>get tmp, <span class="Constant">contents:offset</span> + curr-contents:text<span class="Special"> <- </span>get tmp, <span class="Constant">contents:offset</span> start-running transmit-from-text curr-contents, sink <span class="muControl">return</span> <span class="Delimiter">}</span> @@ -88,7 +88,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color file<span class="Special"> <- </span>$close-file file ] -<span class="muRecipe">def</span> transmit-from-text contents:address:array:character, sink:address:sink:character<span class="muRecipe"> -> </span>sink:address:sink:character [ +<span class="muRecipe">def</span> transmit-from-text contents:text, sink:address:sink:character<span class="muRecipe"> -> </span>sink:address:sink:character [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> i:number<span class="Special"> <- </span>copy <span class="Constant">0</span> @@ -104,7 +104,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color sink<span class="Special"> <- </span>close sink ] -<span class="muRecipe">def</span> start-writing fs:address:filesystem, filename:address:array:character<span class="muRecipe"> -> </span>sink:address:sink:character, routine-id:number [ +<span class="muRecipe">def</span> start-writing fs:address:filesystem, filename:text<span class="muRecipe"> -> </span>sink:address:sink:character, routine-id:number [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> source:address:source:character, sink:address:sink:character<span class="Special"> <- </span>new-channel <span class="Constant">30</span> @@ -133,7 +133,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color file<span class="Special"> <- </span>$close-file file ] -<span class="muRecipe">def</span> transmit-to-fake-file fs:address:filesystem, filename:address:array:character, source:address:source:character<span class="muRecipe"> -> </span>fs:address:filesystem, source:address:source:character [ +<span class="muRecipe">def</span> transmit-to-fake-file fs:address:filesystem, filename:text, source:address:source:character<span class="muRecipe"> -> </span>fs:address:filesystem, source:address:source:character [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># compute new file contents</span> @@ -144,10 +144,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color buf<span class="Special"> <- </span>append buf, c <span class="muControl">loop</span> <span class="Delimiter">}</span> - contents:address:array:character<span class="Special"> <- </span>buffer-to-array buf + contents:text<span class="Special"> <- </span>buffer-to-array buf new-file-mapping:file-mapping<span class="Special"> <- </span>merge filename, contents <span class="Comment"># write to filesystem</span> - curr-filename:address:array:character<span class="Special"> <- </span>copy <span class="Constant">0</span> + curr-filename:text<span class="Special"> <- </span>copy <span class="Constant">0</span> data:address:array:file-mapping<span class="Special"> <- </span>get *fs, <span class="Constant">data:offset</span> <span class="Comment"># replace file contents if it already exists</span> i:number<span class="Special"> <- </span>copy <span class="Constant">0</span> |