diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-09-07 10:37:27 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-09-07 10:37:27 -0700 |
commit | f5465e1220d73e237c51897b7d1211ec53b0dc04 (patch) | |
tree | 939ee8e57241b8515aede8106c6420e330ace75a /html/066stream.mu.html | |
parent | 5ccf2653fb7d31b013f77df4e92e964e45c54f8a (diff) | |
download | mu-f5465e1220d73e237c51897b7d1211ec53b0dc04.tar.gz |
2177
Diffstat (limited to 'html/066stream.mu.html')
-rw-r--r-- | html/066stream.mu.html | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/html/066stream.mu.html b/html/066stream.mu.html index a43f8090..23a019f6 100644 --- a/html/066stream.mu.html +++ b/html/066stream.mu.html @@ -13,10 +13,12 @@ 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; } -.Special { color: #ff6060; } +.muRecipe { color: #ff8700; } +.muData { color: #ffff00; } .Comment { color: #9090ff; } -.Underlined { color: #c000c0; text-decoration: underline; } -.Identifier { color: #804000; } +.Constant { color: #00a0a0; } +.Special { color: #ff6060; } +.muControl { color: #c0a020; } --> </style> @@ -29,48 +31,48 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <body> <pre id='vimCodeElement'> <span class="Comment"># new type to help incrementally read strings</span> -container stream [ +<span class="muData">container</span> stream [ index:number - data:address:<span class="Identifier">array</span>:character + data:address:array:character ] -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> 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 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> 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 <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> 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 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 +<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 result:boolean<span class="Special"> <- </span>greater-or-equal idx, len - reply result + <span class="muControl">reply</span> result ] </pre> </body> |