diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-09-06 16:35:46 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-09-06 16:35:46 -0700 |
commit | 0e4a335edc7d4e584924fd6b298156e45d2626c8 (patch) | |
tree | 4bde00176d6d00b72462e856974fecd4411ef025 /html/066stream.mu.html | |
parent | 3cf4cc43f2622816777c22c49c32e5159574a1d3 (diff) | |
download | mu-0e4a335edc7d4e584924fd6b298156e45d2626c8.tar.gz |
2175
Diffstat (limited to 'html/066stream.mu.html')
-rw-r--r-- | html/066stream.mu.html | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/html/066stream.mu.html b/html/066stream.mu.html index c6504424..a43f8090 100644 --- a/html/066stream.mu.html +++ b/html/066stream.mu.html @@ -13,11 +13,10 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } body { font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 1.05em; } -.muRecipe { color: #ff8700; } -.Comment { color: #9090ff; } -.Constant { color: #00a0a0; } .Special { color: #ff6060; } -.muControl { color: #c0a020; } +.Comment { color: #9090ff; } +.Underlined { color: #c000c0; text-decoration: underline; } +.Identifier { color: #804000; } --> </style> @@ -32,46 +31,46 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="Comment"># new type to help incrementally read strings</span> container stream [ index:number - data:address:array:character + data:address:<span class="Identifier">array</span>:character ] -<span class="muRecipe">recipe</span> new-stream [ - <span class="Constant">local-scope</span> - result:address:stream<span class="Special"> <- </span>new <span class="Constant">stream:type</span> - i:address:number<span class="Special"> <- </span>get-address *result, <span class="Constant">index:offset</span> - *i<span class="Special"> <- </span>copy <span class="Constant">0</span> - d:address:address:array:character<span class="Special"> <- </span>get-address *result, <span class="Constant">data:offset</span> - *d<span class="Special"> <- </span><span class="Constant">next-ingredient</span> - <span class="muControl">reply</span> result +recipe <span class="Identifier">new</span>-stream [ + <span class="Underlined">local</span>-scope + result:address:stream<span class="Special"> <- </span><span class="Identifier">new</span> stream:<span class="Identifier">type</span> + i:address:number<span class="Special"> <- </span>get-address *result, index:offset + *i<span class="Special"> <- </span><span class="Identifier">copy</span> 0 + d:address:address:<span class="Identifier">array</span>:character<span class="Special"> <- </span>get-address *result, data:offset + *d<span class="Special"> <- </span>next-ingredient + reply result ] -<span class="muRecipe">recipe</span> rewind-stream [ - <span class="Constant">local-scope</span> - in:address:stream<span class="Special"> <- </span><span class="Constant">next-ingredient</span> - x:address:number<span class="Special"> <- </span>get-address *in, <span class="Constant">index:offset</span> - *x<span class="Special"> <- </span>copy <span class="Constant">0</span> - <span class="muControl">reply</span> in/same-as-arg:<span class="Constant">0</span> +recipe rewind-stream [ + <span class="Underlined">local</span>-scope + <span class="Identifier">in</span>:address:stream<span class="Special"> <- </span>next-ingredient + x:address:number<span class="Special"> <- </span>get-address *<span class="Identifier">in</span>, index:offset + *x<span class="Special"> <- </span><span class="Identifier">copy</span> 0 + reply <span class="Identifier">in</span>/same-as-<span class="Identifier">arg</span>:0 ] -<span class="muRecipe">recipe</span> read-line [ - <span class="Constant">local-scope</span> - in:address:stream<span class="Special"> <- </span><span class="Constant">next-ingredient</span> - idx:address:number<span class="Special"> <- </span>get-address *in, <span class="Constant">index:offset</span> - s:address:array:character<span class="Special"> <- </span>get *in, <span class="Constant">data:offset</span> - next-idx:number<span class="Special"> <- </span>find-next s, <span class="Constant">10/newline</span>, *idx - result:address:array:character<span class="Special"> <- </span>string-copy s, *idx, next-idx - *idx<span class="Special"> <- </span>add next-idx, <span class="Constant">1</span> <span class="Comment"># skip newline</span> - <span class="muControl">reply</span> result +recipe <span class="Identifier">read</span>-line [ + <span class="Underlined">local</span>-scope + <span class="Identifier">in</span>:address:stream<span class="Special"> <- </span>next-ingredient + idx:address:number<span class="Special"> <- </span>get-address *<span class="Identifier">in</span>, index:offset + s:address:<span class="Identifier">array</span>:character<span class="Special"> <- </span>get *<span class="Identifier">in</span>, data:offset + next-idx:number<span class="Special"> <- </span>find-next s, 10/newline, *idx + result:address:<span class="Identifier">array</span>:character<span class="Special"> <- </span>string-<span class="Identifier">copy</span> s, *idx, next-idx + *idx<span class="Special"> <- </span>add next-idx, 1 <span class="Comment"># skip newline</span> + reply result ] -<span class="muRecipe">recipe</span> end-of-stream? [ - <span class="Constant">local-scope</span> - in:address:stream<span class="Special"> <- </span><span class="Constant">next-ingredient</span> - idx:address:number<span class="Special"> <- </span>get *in, <span class="Constant">index:offset</span> - s:address:array:character<span class="Special"> <- </span>get *in, <span class="Constant">data:offset</span> - len:number<span class="Special"> <- </span>length *s +recipe end-of-stream? [ + <span class="Underlined">local</span>-scope + <span class="Identifier">in</span>:address:stream<span class="Special"> <- </span>next-ingredient + idx:address:number<span class="Special"> <- </span>get *<span class="Identifier">in</span>, index:offset + s:address:<span class="Identifier">array</span>:character<span class="Special"> <- </span>get *<span class="Identifier">in</span>, data:offset + len:number<span class="Special"> <- </span><span class="Identifier">length</span> *s result:boolean<span class="Special"> <- </span>greater-or-equal idx, len - <span class="muControl">reply</span> result + reply result ] </pre> </body> |