diff options
Diffstat (limited to 'html/060string.mu.html')
-rw-r--r-- | html/060string.mu.html | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/html/060string.mu.html b/html/060string.mu.html index 9b30c7fa..9f3c3c99 100644 --- a/html/060string.mu.html +++ b/html/060string.mu.html @@ -13,14 +13,14 @@ 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; } +.muControl { color: #c0a020; } .muRecipe { color: #ff8700; } -.Delimiter { color: #a04060; } .muScenario { color: #00af00; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .Special { color: #ff6060; } .CommentedCode { color: #6c6c6c; } -.muControl { color: #c0a020; } +.Delimiter { color: #a04060; } --> </style> @@ -68,7 +68,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="muScenario">scenario</span> string-equal-reflexive [ run [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30</span> + <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new <span class="Constant">location:type</span>, <span class="Constant">30</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc]</span> <span class="Constant">3</span>:boolean/<span class="Special">raw <- </span>string-equal x, x ] @@ -79,7 +79,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="muScenario">scenario</span> string-equal-identical [ run [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30</span> + <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new <span class="Constant">location:type</span>, <span class="Constant">30</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc]</span> y:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc]</span> <span class="Constant">3</span>:boolean/<span class="Special">raw <- </span>string-equal x, y @@ -91,7 +91,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="muScenario">scenario</span> string-equal-distinct-lengths [ run [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30</span> + <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new <span class="Constant">location:type</span>, <span class="Constant">30</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc]</span> y:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abcd]</span> <span class="Constant">3</span>:boolean/<span class="Special">raw <- </span>string-equal x, y @@ -109,7 +109,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="muScenario">scenario</span> string-equal-with-empty [ run [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30</span> + <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new <span class="Constant">location:type</span>, <span class="Constant">30</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> y:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abcd]</span> <span class="Constant">3</span>:boolean/<span class="Special">raw <- </span>string-equal x, y @@ -121,7 +121,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="muScenario">scenario</span> string-equal-common-lengths-but-distinct [ run [ - <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30</span> + <span class="Constant">default-space</span>:address:array:location<span class="Special"> <- </span>new <span class="Constant">location:type</span>, <span class="Constant">30</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc]</span> y:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abd]</span> <span class="Constant">3</span>:boolean/<span class="Special">raw <- </span>string-equal x, y @@ -140,13 +140,13 @@ container buffer [ <span class="muRecipe">recipe</span> new-buffer [ <span class="Constant">local-scope</span> <span class="CommentedCode">#? $print default-space:address:array:location, 10/newline</span> - result:address:buffer<span class="Special"> <- </span>new buffer:type - len:address:number<span class="Special"> <- </span>get-address *result, length:offset + result:address:buffer<span class="Special"> <- </span>new <span class="Constant">buffer:type</span> + len:address:number<span class="Special"> <- </span>get-address *result, <span class="Constant">length:offset</span> *len:address:number<span class="Special"> <- </span>copy <span class="Constant">0</span> - s:address:address:array:character<span class="Special"> <- </span>get-address *result, data:offset + s:address:address:array:character<span class="Special"> <- </span>get-address *result, <span class="Constant">data:offset</span> capacity:number, found?:boolean<span class="Special"> <- </span><span class="Constant">next-ingredient</span> assert found?, <span class="Constant">[new-buffer must get a capacity argument]</span> - *s<span class="Special"> <- </span>new character:type, capacity + *s<span class="Special"> <- </span>new <span class="Constant">character:type</span>, capacity <span class="CommentedCode">#? $print *s, 10/newline</span> <span class="muControl">reply</span> result ] @@ -155,11 +155,11 @@ container buffer [ <span class="Constant">local-scope</span> in:address:buffer<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Comment"># double buffer size</span> - x:address:address:array:character<span class="Special"> <- </span>get-address *in, data:offset + x:address:address:array:character<span class="Special"> <- </span>get-address *in, <span class="Constant">data:offset</span> oldlen:number<span class="Special"> <- </span>length **x newlen:number<span class="Special"> <- </span>multiply oldlen, <span class="Constant">2</span> olddata:address:array:character<span class="Special"> <- </span>copy *x - *x<span class="Special"> <- </span>new character:type, newlen + *x<span class="Special"> <- </span>new <span class="Constant">character:type</span>, newlen <span class="Comment"># copy old contents</span> i:number<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Delimiter">{</span> @@ -177,8 +177,8 @@ container buffer [ <span class="muRecipe">recipe</span> buffer-full? [ <span class="Constant">local-scope</span> in:address:buffer<span class="Special"> <- </span><span class="Constant">next-ingredient</span> - len:number<span class="Special"> <- </span>get *in, length:offset - s:address:array:character<span class="Special"> <- </span>get *in, data:offset + len:number<span class="Special"> <- </span>get *in, <span class="Constant">length:offset</span> + s:address:array:character<span class="Special"> <- </span>get *in, <span class="Constant">data:offset</span> capacity:number<span class="Special"> <- </span>length *s result:boolean<span class="Special"> <- </span>greater-or-equal len, capacity <span class="muControl">reply</span> result @@ -189,7 +189,7 @@ container buffer [ <span class="Constant">local-scope</span> in:address:buffer<span class="Special"> <- </span><span class="Constant">next-ingredient</span> c:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> - len:address:number<span class="Special"> <- </span>get-address *in, length:offset + len:address:number<span class="Special"> <- </span>get-address *in, <span class="Constant">length:offset</span> <span class="Delimiter">{</span> <span class="Comment"># backspace? just drop last character if it exists and return</span> backspace?:boolean<span class="Special"> <- </span>equal c, <span class="Constant">8/backspace</span> @@ -205,7 +205,7 @@ container buffer [ <span class="muControl">break-unless</span> full? in<span class="Special"> <- </span>grow-buffer in <span class="Delimiter">}</span> - s:address:array:character<span class="Special"> <- </span>get *in, data:offset + s:address:array:character<span class="Special"> <- </span>get *in, <span class="Constant">data:offset</span> <span class="CommentedCode">#? $print [array underlying buf: ], s, 10/newline</span> <span class="CommentedCode">#? $print [index: ], *len, 10/newline</span> dest:address:character<span class="Special"> <- </span>index-address *s, *len @@ -219,18 +219,18 @@ container buffer [ run [ <span class="Constant">local-scope</span> x:address:buffer<span class="Special"> <- </span>new-buffer <span class="Constant">3</span> - s1:address:array:character<span class="Special"> <- </span>get *x:address:buffer, data:offset + s1:address:array:character<span class="Special"> <- </span>get *x:address:buffer, <span class="Constant">data:offset</span> x:address:buffer<span class="Special"> <- </span>buffer-append x:address:buffer, <span class="Constant">97</span> <span class="Comment"># 'a'</span> x:address:buffer<span class="Special"> <- </span>buffer-append x:address:buffer, <span class="Constant">98</span> <span class="Comment"># 'b'</span> x:address:buffer<span class="Special"> <- </span>buffer-append x:address:buffer, <span class="Constant">99</span> <span class="Comment"># 'c'</span> - s2:address:array:character<span class="Special"> <- </span>get *x:address:buffer, data:offset + s2:address:array:character<span class="Special"> <- </span>get *x:address:buffer, <span class="Constant">data:offset</span> <span class="Constant">1</span>:boolean/<span class="Special">raw <- </span>equal s1:address:array:character, s2:address:array:character <span class="Constant">2</span>:array:character/<span class="Special">raw <- </span>copy *s2:address:array:character <span class="Constant"> +buffer-filled</span> x:address:buffer<span class="Special"> <- </span>buffer-append x:address:buffer, <span class="Constant">100</span> <span class="Comment"># 'd'</span> - s3:address:array:character<span class="Special"> <- </span>get *x:address:buffer, data:offset + s3:address:array:character<span class="Special"> <- </span>get *x:address:buffer, <span class="Constant">data:offset</span> <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>equal s1:address:array:character, s3:address:array:character - <span class="Constant">11</span>:number/<span class="Special">raw <- </span>get *x:address:buffer, length:offset + <span class="Constant">11</span>:number/<span class="Special">raw <- </span>get *x:address:buffer, <span class="Constant">length:offset</span> <span class="Constant">12</span>:array:character/<span class="Special">raw <- </span>copy *s3:address:array:character ] memory-should-contain [ @@ -305,9 +305,9 @@ container buffer [ tmp<span class="Special"> <- </span>buffer-append tmp, <span class="Constant">45</span> <span class="Comment"># '-'</span> <span class="Delimiter">}</span> <span class="Comment"># reverse buffer into string result</span> - len:number<span class="Special"> <- </span>get *tmp, length:offset - buf:address:array:character<span class="Special"> <- </span>get *tmp, data:offset - result:address:array:character<span class="Special"> <- </span>new character:type, len + len:number<span class="Special"> <- </span>get *tmp, <span class="Constant">length:offset</span> + buf:address:array:character<span class="Special"> <- </span>get *tmp, <span class="Constant">data:offset</span> + result:address:array:character<span class="Special"> <- </span>new <span class="Constant">character:type</span>, len i:number<span class="Special"> <- </span>subtract len, <span class="Constant">1</span> <span class="Comment"># source index, decreasing</span> j:number<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Comment"># destination index, increasing</span> <span class="Delimiter">{</span> @@ -333,11 +333,11 @@ container buffer [ <span class="muControl">break-if</span> in <span class="muControl">reply</span> <span class="Constant">0</span> <span class="Delimiter">}</span> - len:number<span class="Special"> <- </span>get *in, length:offset + len:number<span class="Special"> <- </span>get *in, <span class="Constant">length:offset</span> <span class="CommentedCode">#? $print [size ], len, 10/newline</span> - s:address:array:character<span class="Special"> <- </span>get *in, data:offset + s:address:array:character<span class="Special"> <- </span>get *in, <span class="Constant">data:offset</span> <span class="Comment"># we can't just return s because it is usually the wrong length</span> - result:address:array:character<span class="Special"> <- </span>new character:type, len + result:address:array:character<span class="Special"> <- </span>new <span class="Constant">character:type</span>, len i:number<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Delimiter">{</span> <span class="CommentedCode">#? $print i #? 1</span> @@ -393,7 +393,7 @@ container buffer [ b:address:array:character<span class="Special"> <- </span><span class="Constant">next-ingredient</span> b-len:number<span class="Special"> <- </span>length *b result-len:number<span class="Special"> <- </span>add a-len, b-len - result:address:array:character<span class="Special"> <- </span>new character:type, result-len + result:address:array:character<span class="Special"> <- </span>new <span class="Constant">character:type</span>, result-len <span class="Comment"># copy a into result</span> result-idx:number<span class="Special"> <- </span>copy <span class="Constant">0</span> i:number<span class="Special"> <- </span>copy <span class="Constant">0</span> @@ -459,7 +459,7 @@ container buffer [ <span class="CommentedCode">#? $print tem-len, [ ], $result-len, 10/newline</span> rewind-ingredients _<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Comment"># skip template</span> - result:address:array:character<span class="Special"> <- </span>new character:type, result-len + result:address:array:character<span class="Special"> <- </span>new <span class="Constant">character:type</span>, result-len <span class="Comment"># repeatedly copy sections of template and 'holes' into result</span> result-idx:number<span class="Special"> <- </span>copy <span class="Constant">0</span> i:number<span class="Special"> <- </span>copy <span class="Constant">0</span> @@ -632,7 +632,7 @@ container buffer [ <span class="Delimiter">{</span> at-end?:boolean<span class="Special"> <- </span>greater-or-equal start, len <span class="muControl">break-unless</span> at-end? - result:address:array:character<span class="Special"> <- </span>new character:type, <span class="Constant">0</span> + result:address:array:character<span class="Special"> <- </span>new <span class="Constant">character:type</span>, <span class="Constant">0</span> <span class="muControl">reply</span> result <span class="Delimiter">}</span> curr:character<span class="Special"> <- </span>index *s, start @@ -654,7 +654,7 @@ container buffer [ <span class="Delimiter">}</span> <span class="Comment"># result = new character[end+1 - start]</span> new-len:number<span class="Special"> <- </span>subtract end, start, -1 - result:address:array:character<span class="Special"> <- </span>new character:type, new-len + result:address:array:character<span class="Special"> <- </span>new <span class="Constant">character:type</span>, new-len <span class="Comment"># i = start, j = 0</span> i:number<span class="Special"> <- </span>copy start j:number<span class="Special"> <- </span>copy <span class="Constant">0</span> @@ -1050,7 +1050,7 @@ container buffer [ <span class="Delimiter">{</span> empty?:boolean<span class="Special"> <- </span>equal len, <span class="Constant">0</span> <span class="muControl">break-unless</span> empty? - result:address:array:address:array:character<span class="Special"> <- </span>new location:type, <span class="Constant">0</span> + result:address:array:address:array:character<span class="Special"> <- </span>new <span class="Constant">location:type</span>, <span class="Constant">0</span> <span class="muControl">reply</span> result <span class="Delimiter">}</span> <span class="Comment"># count #pieces we need room for</span> @@ -1065,7 +1065,7 @@ container buffer [ <span class="muControl">loop</span> <span class="Delimiter">}</span> <span class="Comment"># allocate space</span> - result:address:array:address:array:character<span class="Special"> <- </span>new location:type, count + result:address:array:address:array:character<span class="Special"> <- </span>new <span class="Constant">location:type</span>, count <span class="Comment"># repeatedly copy slices start..end until delimiter into result[curr-result]</span> curr-result:number<span class="Special"> <- </span>copy <span class="Constant">0</span> start:number<span class="Special"> <- </span>copy <span class="Constant">0</span> @@ -1216,7 +1216,7 @@ container buffer [ end:number<span class="Special"> <- </span>min len, end <span class="Comment"># allocate space for result</span> len<span class="Special"> <- </span>subtract end, start - result:address:array:character<span class="Special"> <- </span>new character:type, len + result:address:array:character<span class="Special"> <- </span>new <span class="Constant">character:type</span>, len <span class="Comment"># copy start..end into result[curr-result]</span> src-idx:number<span class="Special"> <- </span>copy start dest-idx:number<span class="Special"> <- </span>copy <span class="Constant">0</span> |