diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-05-26 19:01:35 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-05-26 19:01:35 -0700 |
commit | a0decd22b6534663818c1780b1726d59cbe615c2 (patch) | |
tree | 9d3ac805613b3bdef0799fe4e3a29018c54e62fa /html | |
parent | d3f1d63c7950b72dabf16b41fc9e9589e0e192cd (diff) | |
download | mu-a0decd22b6534663818c1780b1726d59cbe615c2.tar.gz |
3017
Diffstat (limited to 'html')
-rw-r--r-- | html/051scenario_test.mu.html | 30 | ||||
-rw-r--r-- | html/070text.mu.html | 254 | ||||
-rw-r--r-- | html/072channel.mu.html | 195 | ||||
-rw-r--r-- | html/073array.mu.html | 13 | ||||
-rw-r--r-- | html/074list.mu.html | 27 | ||||
-rw-r--r-- | html/076duplex_list.mu.html | 514 | ||||
-rw-r--r-- | html/079table.mu.html | 22 | ||||
-rw-r--r-- | html/081print.mu.html | 289 |
8 files changed, 696 insertions, 648 deletions
diff --git a/html/051scenario_test.mu.html b/html/051scenario_test.mu.html index 436a3def..a1901a65 100644 --- a/html/051scenario_test.mu.html +++ b/html/051scenario_test.mu.html @@ -32,20 +32,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> first_scenario_in_mu [ run [ - <span class="Constant">1</span>:number<span class="Special"> <- </span>add <span class="Constant">2</span>, <span class="Constant">2</span> + <span class="Constant">10</span>:number<span class="Special"> <- </span>add <span class="Constant">2</span>, <span class="Constant">2</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">4</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">4</span> ] ] <span class="muScenario">scenario</span> scenario_with_comment_in_mu [ run [ <span class="Comment"># comment</span> - <span class="Constant">1</span>:number<span class="Special"> <- </span>add <span class="Constant">2</span>, <span class="Constant">2</span> + <span class="Constant">10</span>:number<span class="Special"> <- </span>add <span class="Constant">2</span>, <span class="Constant">2</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">4</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">4</span> ] ] @@ -53,40 +53,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color run [ <span class="Comment"># comment1</span> <span class="Comment"># comment2</span> - <span class="Constant">1</span>:number<span class="Special"> <- </span>add <span class="Constant">2</span>, <span class="Constant">2</span> + <span class="Constant">10</span>:number<span class="Special"> <- </span>add <span class="Constant">2</span>, <span class="Constant">2</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">4</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">4</span> ] ] <span class="muScenario">scenario</span> check_text_in_memory [ run [ - <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">3</span> - <span class="Constant">2</span>:character<span class="Special"> <- </span>copy <span class="Constant">97</span> <span class="Comment"># 'a'</span> - <span class="Constant">3</span>:character<span class="Special"> <- </span>copy <span class="Constant">98</span> <span class="Comment"># 'b'</span> - <span class="Constant">4</span>:character<span class="Special"> <- </span>copy <span class="Constant">99</span> <span class="Comment"># 'c'</span> + <span class="Constant">10</span>:number<span class="Special"> <- </span>copy <span class="Constant">3</span> + <span class="Constant">11</span>:character<span class="Special"> <- </span>copy <span class="Constant">97</span> <span class="Comment"># 'a'</span> + <span class="Constant">12</span>:character<span class="Special"> <- </span>copy <span class="Constant">98</span> <span class="Comment"># 'b'</span> + <span class="Constant">13</span>:character<span class="Special"> <- </span>copy <span class="Constant">99</span> <span class="Comment"># 'c'</span> ] memory-should-contain [ - <span class="Constant">1</span>:array:character<span class="Special"> <- </span><span class="Constant">[abc]</span> + <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[abc]</span> ] ] <span class="muScenario">scenario</span> check_trace [ run [ - <span class="Constant">1</span>:number<span class="Special"> <- </span>add <span class="Constant">2</span>, <span class="Constant">2</span> + <span class="Constant">10</span>:number<span class="Special"> <- </span>add <span class="Constant">2</span>, <span class="Constant">2</span> ] trace-should-contain [ - mem: storing <span class="Constant">4</span> in location <span class="Constant">1</span> + mem: storing <span class="Constant">4</span> in location <span class="Constant">10</span> ] ] <span class="muScenario">scenario</span> check_trace_negative [ run [ - <span class="Constant">1</span>:number<span class="Special"> <- </span>add <span class="Constant">2</span>, <span class="Constant">2</span> + <span class="Constant">10</span>:number<span class="Special"> <- </span>add <span class="Constant">2</span>, <span class="Constant">2</span> ] trace-should-not-contain [ - mem: storing <span class="Constant">5</span> in location <span class="Constant">1</span> + mem: storing <span class="Constant">3</span> in location <span class="Constant">10</span> ] ] diff --git a/html/070text.mu.html b/html/070text.mu.html index 12114ddd..7b1c40d7 100644 --- a/html/070text.mu.html +++ b/html/070text.mu.html @@ -84,10 +84,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color run [ <span class="Constant">local-scope</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>equal x, x + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>equal x, x ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># x == x for all x</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># x == x for all x</span> ] ] @@ -96,10 +96,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</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>equal x, y + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>equal x, y ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># abc == abc</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># abc == abc</span> ] ] @@ -108,10 +108,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</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>equal x, y + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>equal x, y ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># abc != abcd</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># abc != abcd</span> ] trace-should-contain [ text-equal: comparing lengths @@ -126,10 +126,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</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>equal x, y + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>equal x, y ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># "" != abcd</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># "" != abcd</span> ] ] @@ -138,10 +138,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</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>equal x, y + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>equal x, y ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># abc != abd</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># abc != abd</span> ] ] @@ -246,33 +246,33 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color c:character<span class="Special"> <- </span>copy <span class="Constant">99/c</span> x<span class="Special"> <- </span>append x, c s2:address:array:character<span class="Special"> <- </span>get *x, <span class="Constant">data:offset</span> - <span class="Constant">1</span>:boolean/<span class="Special">raw <- </span>equal s1, s2 - <span class="Constant">2</span>:array:character/<span class="Special">raw <- </span>copy *s2 + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>equal s1, s2 + <span class="Constant">11</span>:array:character/<span class="Special">raw <- </span>copy *s2 <span class="Constant"> +buffer-filled</span> c:character<span class="Special"> <- </span>copy <span class="Constant">100/d</span> x<span class="Special"> <- </span>append x, c s3:address:array:character<span class="Special"> <- </span>get *x, <span class="Constant">data:offset</span> - <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>equal s1, s3 - <span class="Constant">11</span>:number/<span class="Special">raw <- </span>get *x, <span class="Constant">length:offset</span> - <span class="Constant">12</span>:array:character/<span class="Special">raw <- </span>copy *s3 + <span class="Constant">20</span>:boolean/<span class="Special">raw <- </span>equal s1, s3 + <span class="Constant">21</span>:number/<span class="Special">raw <- </span>get *x, <span class="Constant">length:offset</span> + <span class="Constant">30</span>:array:character/<span class="Special">raw <- </span>copy *s3 ] memory-should-contain [ <span class="Comment"># before +buffer-filled</span> - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># no change in data pointer</span> - <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Comment"># size of data</span> - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># data</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">98</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">99</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># no change in data pointer</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Comment"># size of data</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># data</span> + <span class="Constant">13</span><span class="Special"> <- </span><span class="Constant">98</span> + <span class="Constant">14</span><span class="Special"> <- </span><span class="Constant">99</span> <span class="Comment"># in the end</span> - <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># data pointer has grown</span> - <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># final length</span> - <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># but data's capacity has doubled</span> - <span class="Constant">13</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># data</span> - <span class="Constant">14</span><span class="Special"> <- </span><span class="Constant">98</span> - <span class="Constant">15</span><span class="Special"> <- </span><span class="Constant">99</span> - <span class="Constant">16</span><span class="Special"> <- </span><span class="Constant">100</span> - <span class="Constant">17</span><span class="Special"> <- </span><span class="Constant">0</span> - <span class="Constant">18</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># data pointer has grown</span> + <span class="Constant">21</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># final length</span> + <span class="Constant">30</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># but data's capacity has doubled</span> + <span class="Constant">31</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># data</span> + <span class="Constant">32</span><span class="Special"> <- </span><span class="Constant">98</span> + <span class="Constant">33</span><span class="Special"> <- </span><span class="Constant">99</span> + <span class="Constant">34</span><span class="Special"> <- </span><span class="Constant">100</span> + <span class="Constant">35</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">36</span><span class="Special"> <- </span><span class="Constant">0</span> ] ] @@ -287,12 +287,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color c:character<span class="Special"> <- </span>copy <span class="Constant">8/backspace</span> x<span class="Special"> <- </span>append x, c s:address:array:character<span class="Special"> <- </span>buffer-to-array x - <span class="Constant">1</span>:array:character/<span class="Special">raw <- </span>copy *s + <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *s ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># length</span> - <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># contents</span> - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># length</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># contents</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">0</span> ] ] @@ -365,10 +365,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[hello,]</span> y:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ world!]</span> z:address:array:character<span class="Special"> <- </span>append x, y - <span class="Constant">1</span>:array:character/<span class="Special">raw <- </span>copy *z + <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *z ] memory-should-contain [ - <span class="Constant">1</span>:array:character<span class="Special"> <- </span><span class="Constant">[hello, world!]</span> + <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[hello, world!]</span> ] ] @@ -378,10 +378,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color x:address:array:character<span class="Special"> <- </span>copy <span class="Constant">0</span> y:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ world!]</span> z:address:array:character<span class="Special"> <- </span>append x, y - <span class="Constant">1</span>:array:character/<span class="Special">raw <- </span>copy *z + <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *z ] memory-should-contain [ - <span class="Constant">1</span>:array:character<span class="Special"> <- </span><span class="Constant">[ world!]</span> + <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[ world!]</span> ] ] @@ -391,10 +391,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[hello,]</span> y:address:array:character<span class="Special"> <- </span>copy <span class="Constant">0</span> z:address:array:character<span class="Special"> <- </span>append x, y - <span class="Constant">1</span>:array:character/<span class="Special">raw <- </span>copy *z + <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *z ] memory-should-contain [ - <span class="Constant">1</span>:array:character<span class="Special"> <- </span><span class="Constant">[hello,]</span> + <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[hello,]</span> ] ] @@ -403,10 +403,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc]</span> x<span class="Special"> <- </span>replace x, <span class="Constant">98/b</span>, <span class="Constant">122/z</span> - <span class="Constant">1</span>:array:character/<span class="Special">raw <- </span>copy *x + <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *x ] memory-should-contain [ - <span class="Constant">1</span>:array:character<span class="Special"> <- </span><span class="Constant">[azc]</span> + <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[azc]</span> ] ] @@ -427,10 +427,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc]</span> x<span class="Special"> <- </span>replace x, <span class="Constant">97/a</span>, <span class="Constant">122/z</span> - <span class="Constant">1</span>:array:character/<span class="Special">raw <- </span>copy *x + <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *x ] memory-should-contain [ - <span class="Constant">1</span>:array:character<span class="Special"> <- </span><span class="Constant">[zbc]</span> + <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[zbc]</span> ] ] @@ -439,10 +439,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc]</span> x<span class="Special"> <- </span>replace x, <span class="Constant">99/c</span>, <span class="Constant">122/z</span> - <span class="Constant">1</span>:array:character/<span class="Special">raw <- </span>copy *x + <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *x ] memory-should-contain [ - <span class="Constant">1</span>:array:character<span class="Special"> <- </span><span class="Constant">[abz]</span> + <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[abz]</span> ] ] @@ -451,10 +451,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc]</span> x<span class="Special"> <- </span>replace x, <span class="Constant">100/d</span>, <span class="Constant">122/z</span> - <span class="Constant">1</span>:array:character/<span class="Special">raw <- </span>copy *x + <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *x ] memory-should-contain [ - <span class="Constant">1</span>:array:character<span class="Special"> <- </span><span class="Constant">[abc]</span> + <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[abc]</span> ] ] @@ -463,10 +463,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[banana]</span> x<span class="Special"> <- </span>replace x, <span class="Constant">97/a</span>, <span class="Constant">122/z</span> - <span class="Constant">1</span>:array:character/<span class="Special">raw <- </span>copy *x + <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *x ] memory-should-contain [ - <span class="Constant">1</span>:array:character<span class="Special"> <- </span><span class="Constant">[bznznz]</span> + <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[bznznz]</span> ] ] @@ -547,13 +547,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> interpolate-works [ run [ <span class="Constant">local-scope</span> - x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc _]</span> + x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc_ghi]</span> y:address:array:character<span class="Special"> <- </span>new <span class="Constant">[def]</span> z:address:array:character<span class="Special"> <- </span>interpolate x, y - <span class="Constant">1</span>:array:character/<span class="Special">raw <- </span>copy *z + <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *z ] memory-should-contain [ - <span class="Constant">1</span>:array:character<span class="Special"> <- </span><span class="Constant">[abc def]</span> + <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[abcdefghi]</span> ] ] @@ -563,11 +563,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[_, hello!]</span> y:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc]</span> z:address:array:character<span class="Special"> <- </span>interpolate x, y - <span class="Constant">1</span>:array:character/<span class="Special">raw <- </span>copy *z + <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *z ] memory-should-contain [ - <span class="Constant">1</span>:array:character<span class="Special"> <- </span><span class="Constant">[abc, hello!]</span> - <span class="Constant">13</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># out of bounds</span> + <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[abc, hello!]</span> + <span class="Constant">22</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># out of bounds</span> ] ] @@ -576,10 +576,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[hello, _]</span> y:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc]</span> z:address:array:character<span class="Special"> <- </span>interpolate x, y - <span class="Constant">4</span>:array:character/<span class="Special">raw <- </span>copy *z + <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *z ] memory-should-contain [ - <span class="Constant">4</span>:array:character<span class="Special"> <- </span><span class="Constant">[hello, abc]</span> + <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[hello, abc]</span> ] ] @@ -775,10 +775,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color run [ <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[a/b]</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">0/start-index</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">0/start-index</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">1</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> ] ] @@ -786,10 +786,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color run [ <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">0/start-index</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">0/start-index</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> ] ] @@ -797,10 +797,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color run [ <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[/abc]</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">0/start-index</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">0/start-index</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># prefix match</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># prefix match</span> ] ] @@ -808,10 +808,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color run [ <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc/]</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">0/start-index</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">0/start-index</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Comment"># suffix match</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Comment"># suffix match</span> ] ] @@ -819,10 +819,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color run [ <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abcd]</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">0/start-index</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">0/start-index</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># no match</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># no match</span> ] ] @@ -830,10 +830,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color run [ <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">4/start-index</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">4/start-index</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># no change</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># no change</span> ] ] @@ -841,10 +841,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color run [ <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ab/c/]</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">0/start-index</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">0/start-index</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Comment"># first '/' of multiple</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Comment"># first '/' of multiple</span> ] ] @@ -852,10 +852,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color run [ <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ab/c/]</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">3/start-index</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>find-next x, <span class="Constant">47/slash</span>, <span class="Constant">3/start-index</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># second '/' of multiple</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># second '/' of multiple</span> ] ] @@ -910,10 +910,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</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">[bd]</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>find-next x, y, <span class="Constant">0</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>find-next x, y, <span class="Constant">0</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Comment"># not found</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Comment"># not found</span> ] ] @@ -922,10 +922,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abcd]</span> y:address:array:character<span class="Special"> <- </span>new <span class="Constant">[cd]</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>find-next x, y, <span class="Constant">0</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>find-next x, y, <span class="Constant">0</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">2</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">2</span> ] ] @@ -934,10 +934,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abcd]</span> y:address:array:character<span class="Special"> <- </span>new <span class="Constant">[cde]</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>find-next x, y, <span class="Constant">0</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>find-next x, y, <span class="Constant">0</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># not found</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># not found</span> ] ] @@ -978,10 +978,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</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">[ab]</span> - <span class="Constant">1</span>:boolean/<span class="Special">raw <- </span>match-at x, y, <span class="Constant">0</span> + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>match-at x, y, <span class="Constant">0</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># match found</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># match found</span> ] ] @@ -989,10 +989,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color run [ <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc]</span> - <span class="Constant">1</span>:boolean/<span class="Special">raw <- </span>match-at x, x, <span class="Constant">0</span> + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>match-at x, x, <span class="Constant">0</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># match found</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># match found</span> ] ] @@ -1001,10 +1001,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</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">[a]</span> - <span class="Constant">1</span>:boolean/<span class="Special">raw <- </span>match-at x, y, <span class="Constant">4</span> + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>match-at x, y, <span class="Constant">4</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># never matches</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># never matches</span> ] ] @@ -1013,10 +1013,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</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">[]</span> - <span class="Constant">1</span>:boolean/<span class="Special">raw <- </span>match-at x, y, <span class="Constant">0</span> + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>match-at x, y, <span class="Constant">0</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># always matches empty pattern given a valid index</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># always matches empty pattern given a valid index</span> ] ] @@ -1025,10 +1025,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</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">[]</span> - <span class="Constant">1</span>:boolean/<span class="Special">raw <- </span>match-at x, y, <span class="Constant">4</span> + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>match-at x, y, <span class="Constant">4</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># no match</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># no match</span> ] ] @@ -1037,10 +1037,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</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">[abc]</span> - <span class="Constant">1</span>:boolean/<span class="Special">raw <- </span>match-at x, y, <span class="Constant">0</span> + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>match-at x, y, <span class="Constant">0</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># no match</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># no match</span> ] ] @@ -1048,10 +1048,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color run [ <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">1</span>:boolean/<span class="Special">raw <- </span>match-at x, x, <span class="Constant">0</span> + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>match-at x, x, <span class="Constant">0</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># matches because pattern is also empty</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># matches because pattern is also empty</span> ] ] @@ -1060,10 +1060,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</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">[bc]</span> - <span class="Constant">1</span>:boolean/<span class="Special">raw <- </span>match-at x, y, <span class="Constant">1</span> + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>match-at x, y, <span class="Constant">1</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># match</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># match</span> ] ] @@ -1072,10 +1072,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</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">[bc]</span> - <span class="Constant">1</span>:boolean/<span class="Special">raw <- </span>match-at x, y, <span class="Constant">0</span> + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>match-at x, y, <span class="Constant">0</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># no match</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># no match</span> ] ] @@ -1126,16 +1126,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[a/b]</span> y:address:array:address:array:character<span class="Special"> <- </span>split x, <span class="Constant">47/slash</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>length *y + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>length *y a:address:array:character<span class="Special"> <- </span>index *y, <span class="Constant">0</span> b:address:array:character<span class="Special"> <- </span>index *y, <span class="Constant">1</span> - <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *a - <span class="Constant">20</span>:array:character/<span class="Special">raw <- </span>copy *b + <span class="Constant">20</span>:array:character/<span class="Special">raw <- </span>copy *a + <span class="Constant">30</span>:array:character/<span class="Special">raw <- </span>copy *b ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Comment"># length of result</span> - <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[a]</span> - <span class="Constant">20</span>:array:character<span class="Special"> <- </span><span class="Constant">[b]</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Comment"># length of result</span> + <span class="Constant">20</span>:array:character<span class="Special"> <- </span><span class="Constant">[a]</span> + <span class="Constant">30</span>:array:character<span class="Special"> <- </span><span class="Constant">[b]</span> ] ] @@ -1144,19 +1144,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[a/b/c]</span> y:address:array:address:array:character<span class="Special"> <- </span>split x, <span class="Constant">47/slash</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>length *y + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>length *y a:address:array:character<span class="Special"> <- </span>index *y, <span class="Constant">0</span> b:address:array:character<span class="Special"> <- </span>index *y, <span class="Constant">1</span> c:address:array:character<span class="Special"> <- </span>index *y, <span class="Constant">2</span> - <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *a - <span class="Constant">20</span>:array:character/<span class="Special">raw <- </span>copy *b - <span class="Constant">30</span>:array:character/<span class="Special">raw <- </span>copy *c + <span class="Constant">20</span>:array:character/<span class="Special">raw <- </span>copy *a + <span class="Constant">30</span>:array:character/<span class="Special">raw <- </span>copy *b + <span class="Constant">40</span>:array:character/<span class="Special">raw <- </span>copy *c ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Comment"># length of result</span> - <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[a]</span> - <span class="Constant">20</span>:array:character<span class="Special"> <- </span><span class="Constant">[b]</span> - <span class="Constant">30</span>:array:character<span class="Special"> <- </span><span class="Constant">[c]</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Comment"># length of result</span> + <span class="Constant">20</span>:array:character<span class="Special"> <- </span><span class="Constant">[a]</span> + <span class="Constant">30</span>:array:character<span class="Special"> <- </span><span class="Constant">[b]</span> + <span class="Constant">40</span>:array:character<span class="Special"> <- </span><span class="Constant">[c]</span> ] ] @@ -1165,13 +1165,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc]</span> y:address:array:address:array:character<span class="Special"> <- </span>split x, <span class="Constant">47/slash</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>length *y + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>length *y a:address:array:character<span class="Special"> <- </span>index *y, <span class="Constant">0</span> - <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *a + <span class="Constant">20</span>:array:character/<span class="Special">raw <- </span>copy *a ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># length of result</span> - <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[abc]</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># length of result</span> + <span class="Constant">20</span>:array:character<span class="Special"> <- </span><span class="Constant">[abc]</span> ] ] @@ -1180,10 +1180,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[]</span> y:address:array:address:array:character<span class="Special"> <- </span>split x, <span class="Constant">47/slash</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>length *y + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>length *y ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># empty result</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># empty result</span> ] ] @@ -1192,22 +1192,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> x:address:array:character<span class="Special"> <- </span>new <span class="Constant">[a/b//c]</span> y:address:array:address:array:character<span class="Special"> <- </span>split x:address:array:character, <span class="Constant">47/slash</span> - <span class="Constant">1</span>:number/<span class="Special">raw <- </span>length *y + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>length *y a:address:array:character<span class="Special"> <- </span>index *y, <span class="Constant">0</span> b:address:array:character<span class="Special"> <- </span>index *y, <span class="Constant">1</span> c:address:array:character<span class="Special"> <- </span>index *y, <span class="Constant">2</span> d:address:array:character<span class="Special"> <- </span>index *y, <span class="Constant">3</span> - <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *a - <span class="Constant">20</span>:array:character/<span class="Special">raw <- </span>copy *b - <span class="Constant">30</span>:array:character/<span class="Special">raw <- </span>copy *c - <span class="Constant">40</span>:array:character/<span class="Special">raw <- </span>copy *d + <span class="Constant">20</span>:array:character/<span class="Special">raw <- </span>copy *a + <span class="Constant">30</span>:array:character/<span class="Special">raw <- </span>copy *b + <span class="Constant">40</span>:array:character/<span class="Special">raw <- </span>copy *c + <span class="Constant">50</span>:array:character/<span class="Special">raw <- </span>copy *d ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># length of result</span> - <span class="Constant">10</span>:array:character<span class="Special"> <- </span><span class="Constant">[a]</span> - <span class="Constant">20</span>:array:character<span class="Special"> <- </span><span class="Constant">[b]</span> - <span class="Constant">30</span>:array:character<span class="Special"> <- </span><span class="Constant">[]</span> - <span class="Constant">40</span>:array:character<span class="Special"> <- </span><span class="Constant">[c]</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># length of result</span> + <span class="Constant">20</span>:array:character<span class="Special"> <- </span><span class="Constant">[a]</span> + <span class="Constant">30</span>:array:character<span class="Special"> <- </span><span class="Constant">[b]</span> + <span class="Constant">40</span>:array:character<span class="Special"> <- </span><span class="Constant">[]</span> + <span class="Constant">50</span>:array:character<span class="Special"> <- </span><span class="Constant">[c]</span> ] ] diff --git a/html/072channel.mu.html b/html/072channel.mu.html index 9ba20e6e..dd3923a5 100644 --- a/html/072channel.mu.html +++ b/html/072channel.mu.html @@ -45,13 +45,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> channel [ run [ - <span class="Constant">1</span>:address:source:number, <span class="Constant">2</span>:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">3/capacity</span> - <span class="Constant">2</span>:address:sink:number<span class="Special"> <- </span>write <span class="Constant">2</span>:address:sink:number, <span class="Constant">34</span> - <span class="Constant">3</span>:number, <span class="Constant">4</span>:boolean, <span class="Constant">1</span>:address:source:number<span class="Special"> <- </span>read <span class="Constant">1</span>:address:source:number + <span class="Constant">local-scope</span> + source:address:source:number, sink:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">3/capacity</span> + sink<span class="Special"> <- </span>write sink, <span class="Constant">34</span> + <span class="Constant">10</span>:number/<span class="Special">raw</span>, <span class="Constant">11</span>:boolean/<span class="Special">raw</span>, source<span class="Special"> <- </span>read source ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">34</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># read was successful</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">34</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># read was successful</span> ] ] @@ -168,125 +169,132 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> channel-initialization [ run [ - <span class="Constant">1</span>:address:source:number<span class="Special"> <- </span>new-channel <span class="Constant">3/capacity</span> - <span class="Constant">2</span>:address:channel:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:source:number, <span class="Constant">chan:offset</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>get *<span class="Constant">2</span>:address:channel:number, <span class="Constant">first-full:offset</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>get *<span class="Constant">2</span>:address:channel:number, <span class="Constant">first-free:offset</span> + <span class="Constant">local-scope</span> + source:address:source:number<span class="Special"> <- </span>new-channel <span class="Constant">3/capacity</span> + chan:address:channel:number<span class="Special"> <- </span>get *source, <span class="Constant">chan:offset</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>get *chan, <span class="Constant">first-full:offset</span> + <span class="Constant">11</span>:number/<span class="Special">raw <- </span>get *chan, <span class="Constant">first-free:offset</span> ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># first-full</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># first-free</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># first-full</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># first-free</span> ] ] <span class="muScenario">scenario</span> channel-write-increments-free [ run [ - _, <span class="Constant">1</span>:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">3/capacity</span> - <span class="Constant">1</span>:address:sink:number<span class="Special"> <- </span>write <span class="Constant">1</span>:address:sink:number, <span class="Constant">34</span> - <span class="Constant">2</span>:address:channel:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:sink:number, <span class="Constant">chan:offset</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>get *<span class="Constant">2</span>:address:channel:character, <span class="Constant">first-full:offset</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>get *<span class="Constant">2</span>:address:channel:character, <span class="Constant">first-free:offset</span> + <span class="Constant">local-scope</span> + _, sink:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">3/capacity</span> + sink<span class="Special"> <- </span>write sink, <span class="Constant">34</span> + chan:address:channel:number<span class="Special"> <- </span>get *sink, <span class="Constant">chan:offset</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>get *chan, <span class="Constant">first-full:offset</span> + <span class="Constant">11</span>:number/<span class="Special">raw <- </span>get *chan, <span class="Constant">first-free:offset</span> ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># first-full</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># first-free</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># first-full</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># first-free</span> ] ] <span class="muScenario">scenario</span> channel-read-increments-full [ run [ - <span class="Constant">1</span>:address:source:number, <span class="Constant">2</span>:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">3/capacity</span> - <span class="Constant">2</span>:address:sink:number<span class="Special"> <- </span>write <span class="Constant">2</span>:address:sink:number, <span class="Constant">34</span> - _, _, <span class="Constant">1</span>:address:source:number<span class="Special"> <- </span>read <span class="Constant">1</span>:address:source:number - <span class="Constant">3</span>:address:channel:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:source:number, <span class="Constant">chan:offset</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>get *<span class="Constant">3</span>:address:channel:number, <span class="Constant">first-full:offset</span> - <span class="Constant">5</span>:number<span class="Special"> <- </span>get *<span class="Constant">3</span>:address:channel:number, <span class="Constant">first-free:offset</span> + <span class="Constant">local-scope</span> + source:address:source:number, sink:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">3/capacity</span> + sink<span class="Special"> <- </span>write sink, <span class="Constant">34</span> + _, _, source<span class="Special"> <- </span>read source + chan:address:channel:number<span class="Special"> <- </span>get *source, <span class="Constant">chan:offset</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>get *chan, <span class="Constant">first-full:offset</span> + <span class="Constant">11</span>:number/<span class="Special">raw <- </span>get *chan, <span class="Constant">first-free:offset</span> ] memory-should-contain [ - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># first-full</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># first-free</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># first-full</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># first-free</span> ] ] <span class="muScenario">scenario</span> channel-wrap [ run [ + <span class="Constant">local-scope</span> <span class="Comment"># channel with just 1 slot</span> - <span class="Constant">1</span>:address:source:number, <span class="Constant">2</span>:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">1/capacity</span> - <span class="Constant">3</span>:address:channel:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:source:number, <span class="Constant">chan:offset</span> + source:address:source:number, sink:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">1/capacity</span> + chan:address:channel:number<span class="Special"> <- </span>get *source, <span class="Constant">chan:offset</span> <span class="Comment"># write and read a value</span> - <span class="Constant">2</span>:address:sink:number<span class="Special"> <- </span>write <span class="Constant">2</span>:address:sink:number, <span class="Constant">34</span> - _, _, <span class="Constant">1</span>:address:source:number<span class="Special"> <- </span>read <span class="Constant">1</span>:address:source:number + sink<span class="Special"> <- </span>write sink, <span class="Constant">34</span> + _, _, source<span class="Special"> <- </span>read source <span class="Comment"># first-free will now be 1</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>get *<span class="Constant">3</span>:address:channel:number, <span class="Constant">first-free:offset</span> - <span class="Constant">5</span>:number<span class="Special"> <- </span>get *<span class="Constant">3</span>:address:channel:number, <span class="Constant">first-free:offset</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>get *chan, <span class="Constant">first-free:offset</span> + <span class="Constant">11</span>:number/<span class="Special">raw <- </span>get *chan, <span class="Constant">first-free:offset</span> <span class="Comment"># write second value, verify that first-free wraps</span> - <span class="Constant">2</span>:address:sink:number<span class="Special"> <- </span>write <span class="Constant">2</span>:address:sink:number, <span class="Constant">34</span> - <span class="Constant">6</span>:number<span class="Special"> <- </span>get *<span class="Constant">3</span>:address:channel:number, <span class="Constant">first-free:offset</span> + sink<span class="Special"> <- </span>write sink, <span class="Constant">34</span> + <span class="Constant">20</span>:number/<span class="Special">raw <- </span>get *chan, <span class="Constant">first-free:offset</span> <span class="Comment"># read second value, verify that first-full wraps</span> - _, _, <span class="Constant">1</span>:address:source:number<span class="Special"> <- </span>read <span class="Constant">1</span>:address:source:number - <span class="Constant">7</span>:number<span class="Special"> <- </span>get *<span class="Constant">3</span>:address:channel:number, <span class="Constant">first-full:offset</span> + _, _, source<span class="Special"> <- </span>read source + <span class="Constant">30</span>:number/<span class="Special">raw <- </span>get *chan, <span class="Constant">first-full:offset</span> ] memory-should-contain [ - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># first-free after first write</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># first-full after first read</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># first-free after second write, wrapped</span> - <span class="Constant">7</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># first-full after second read, wrapped</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># first-free after first write</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># first-full after first read</span> + <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># first-free after second write, wrapped</span> + <span class="Constant">30</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># first-full after second read, wrapped</span> ] ] <span class="muScenario">scenario</span> channel-new-empty-not-full [ run [ - <span class="Constant">1</span>:address:source:number, <span class="Constant">2</span>:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">3/capacity</span> - <span class="Constant">3</span>:address:channel:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:source:number, <span class="Constant">chan:offset</span> - <span class="Constant">4</span>:boolean<span class="Special"> <- </span>channel-empty? <span class="Constant">3</span>:address:channel:number - <span class="Constant">5</span>:boolean<span class="Special"> <- </span>channel-full? <span class="Constant">3</span>:address:channel:number + <span class="Constant">local-scope</span> + source:address:source:number<span class="Special"> <- </span>new-channel <span class="Constant">3/capacity</span> + chan:address:channel:number<span class="Special"> <- </span>get *source, <span class="Constant">chan:offset</span> + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>channel-empty? chan + <span class="Constant">11</span>:boolean/<span class="Special">raw <- </span>channel-full? chan ] memory-should-contain [ - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># empty?</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># full?</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># empty?</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># full?</span> ] ] <span class="muScenario">scenario</span> channel-write-not-empty [ run [ - <span class="Constant">1</span>:address:source:number, <span class="Constant">2</span>:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">3/capacity</span> - <span class="Constant">3</span>:address:channel:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:source:number, <span class="Constant">chan:offset</span> - <span class="Constant">2</span>:address:sink:number<span class="Special"> <- </span>write <span class="Constant">2</span>:address:sink:number, <span class="Constant">34</span> - <span class="Constant">4</span>:boolean<span class="Special"> <- </span>channel-empty? <span class="Constant">3</span>:address:channel:number - <span class="Constant">5</span>:boolean<span class="Special"> <- </span>channel-full? <span class="Constant">3</span>:address:channel:number + source:address:source:number, sink:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">3/capacity</span> + chan:address:channel:number<span class="Special"> <- </span>get *source, <span class="Constant">chan:offset</span> + sink<span class="Special"> <- </span>write sink, <span class="Constant">34</span> + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>channel-empty? chan + <span class="Constant">11</span>:boolean/<span class="Special">raw <- </span>channel-full? chan ] memory-should-contain [ - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># empty?</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># full?</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># empty?</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># full?</span> ] ] <span class="muScenario">scenario</span> channel-write-full [ run [ - <span class="Constant">1</span>:address:source:number, <span class="Constant">2</span>:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">1/capacity</span> - <span class="Constant">3</span>:address:channel:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:source:number, <span class="Constant">chan:offset</span> - <span class="Constant">2</span>:address:sink:number<span class="Special"> <- </span>write <span class="Constant">2</span>:address:sink:number, <span class="Constant">34</span> - <span class="Constant">4</span>:boolean<span class="Special"> <- </span>channel-empty? <span class="Constant">3</span>:address:channel:number - <span class="Constant">5</span>:boolean<span class="Special"> <- </span>channel-full? <span class="Constant">3</span>:address:channel:number + <span class="Constant">local-scope</span> + source:address:source:number, sink:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">1/capacity</span> + chan:address:channel:number<span class="Special"> <- </span>get *source, <span class="Constant">chan:offset</span> + sink<span class="Special"> <- </span>write sink, <span class="Constant">34</span> + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>channel-empty? chan + <span class="Constant">11</span>:boolean/<span class="Special">raw <- </span>channel-full? chan ] memory-should-contain [ - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># empty?</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># full?</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># empty?</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># full?</span> ] ] <span class="muScenario">scenario</span> channel-read-not-full [ run [ - <span class="Constant">1</span>:address:source:number, <span class="Constant">2</span>:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">1/capacity</span> - <span class="Constant">3</span>:address:channel:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:source:number, <span class="Constant">chan:offset</span> - <span class="Constant">2</span>:address:sink:number<span class="Special"> <- </span>write <span class="Constant">2</span>:address:sink:number, <span class="Constant">34</span> - _, _, <span class="Constant">1</span>:address:source:number<span class="Special"> <- </span>read <span class="Constant">1</span>:address:source:number - <span class="Constant">4</span>:boolean<span class="Special"> <- </span>channel-empty? <span class="Constant">3</span>:address:channel:number - <span class="Constant">5</span>:boolean<span class="Special"> <- </span>channel-full? <span class="Constant">3</span>:address:channel:number + <span class="Constant">local-scope</span> + source:address:source:number, sink:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">1/capacity</span> + chan:address:channel:number<span class="Special"> <- </span>get *source, <span class="Constant">chan:offset</span> + sink<span class="Special"> <- </span>write sink, <span class="Constant">34</span> + _, _, source<span class="Special"> <- </span>read source + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>channel-empty? chan + <span class="Constant">11</span>:boolean/<span class="Special">raw <- </span>channel-full? chan ] memory-should-contain [ - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># empty?</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># full?</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># empty?</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># full?</span> ] ] @@ -430,39 +438,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> buffer-lines-blocks-until-newline [ run [ - <span class="Constant">1</span>:address:source:number, <span class="Constant">2</span>:address:sink:number<span class="Special"> <- </span>new-channel <span class="Constant">10/capacity</span> - _, <span class="Constant">3</span>:address:sink:number/buffered-stdin<span class="Special"> <- </span>new-channel <span class="Constant">10/capacity</span> - <span class="Constant">4</span>:address:channel:number/buffered-stdin<span class="Special"> <- </span>get *<span class="Constant">3</span>:address:source:number, <span class="Constant">chan:offset</span> - <span class="Constant">5</span>:boolean<span class="Special"> <- </span>channel-empty? <span class="Constant">4</span>:address:channel:character/buffered-stdin - assert <span class="Constant">5</span>:boolean, <span class="Constant">[ </span> + <span class="Constant">local-scope</span> + source:address:source:character, sink:address:sink:character<span class="Special"> <- </span>new-channel <span class="Constant">10/capacity</span> + _, buffered-stdin:address:sink:character/buffered-stdin<span class="Special"> <- </span>new-channel <span class="Constant">10/capacity</span> + buffered-chan:address:channel:character<span class="Special"> <- </span>get *buffered-stdin, <span class="Constant">chan:offset</span> + empty?:boolean<span class="Special"> <- </span>channel-empty? buffered-chan + assert empty?, <span class="Constant">[ </span> <span class="Constant">F buffer-lines-blocks-until-newline: channel should be empty after init]</span> <span class="Comment"># buffer stdin into buffered-stdin, try to read from buffered-stdin</span> - <span class="Constant">6</span>:number/buffer-routine<span class="Special"> <- </span>start-running buffer-lines, <span class="Constant">1</span>:address:source:character/stdin, <span class="Constant">3</span>:address:sink:character/buffered-stdin - wait-for-routine <span class="Constant">6</span>:number/buffer-routine - <span class="Constant">7</span>:boolean<span class="Special"> <- </span>channel-empty? <span class="Constant">4</span>:address:channel:character/buffered-stdin - assert <span class="Constant">7</span>:boolean, <span class="Constant">[ </span> + buffer-routine:number<span class="Special"> <- </span>start-running buffer-lines, source, buffered-stdin + wait-for-routine buffer-routine + empty?<span class="Special"> <- </span>channel-empty? buffered-chan + assert empty?:boolean, <span class="Constant">[ </span> <span class="Constant">F buffer-lines-blocks-until-newline: channel should be empty after buffer-lines bring-up]</span> <span class="Comment"># write 'a'</span> - <span class="Constant">2</span>:address:sink:character<span class="Special"> <- </span>write <span class="Constant">2</span>:address:sink:character, <span class="Constant">97/a</span> - restart <span class="Constant">6</span>:number/buffer-routine - wait-for-routine <span class="Constant">6</span>:number/buffer-routine - <span class="Constant">8</span>:boolean<span class="Special"> <- </span>channel-empty? <span class="Constant">4</span>:address:channel:character/buffered-stdin - assert <span class="Constant">8</span>:boolean, <span class="Constant">[ </span> + sink<span class="Special"> <- </span>write sink, <span class="Constant">97/a</span> + restart buffer-routine + wait-for-routine buffer-routine + empty?<span class="Special"> <- </span>channel-empty? buffered-chan + assert empty?:boolean, <span class="Constant">[ </span> <span class="Constant">F buffer-lines-blocks-until-newline: channel should be empty after writing 'a']</span> <span class="Comment"># write 'b'</span> - <span class="Constant">2</span>:address:sink:character<span class="Special"> <- </span>write <span class="Constant">2</span>:address:sink:character, <span class="Constant">98/b</span> - restart <span class="Constant">6</span>:number/buffer-routine - wait-for-routine <span class="Constant">6</span>:number/buffer-routine - <span class="Constant">9</span>:boolean<span class="Special"> <- </span>channel-empty? <span class="Constant">4</span>:address:channel:character/buffered-stdin - assert <span class="Constant">9</span>:boolean, <span class="Constant">[ </span> + sink<span class="Special"> <- </span>write sink, <span class="Constant">98/b</span> + restart buffer-routine + wait-for-routine buffer-routine + empty?<span class="Special"> <- </span>channel-empty? buffered-chan + assert empty?:boolean, <span class="Constant">[ </span> <span class="Constant">F buffer-lines-blocks-until-newline: channel should be empty after writing 'b']</span> <span class="Comment"># write newline</span> - <span class="Constant">2</span>:address:sink:character<span class="Special"> <- </span>write <span class="Constant">2</span>:address:sink:character, <span class="Constant">10/newline</span> - restart <span class="Constant">6</span>:number/buffer-routine - wait-for-routine <span class="Constant">6</span>:number/buffer-routine - <span class="Constant">10</span>:boolean<span class="Special"> <- </span>channel-empty? <span class="Constant">4</span>:address:channel:character/buffered-stdin - <span class="Constant">11</span>:boolean/completed?<span class="Special"> <- </span>not <span class="Constant">10</span>:boolean - assert <span class="Constant">11</span>:boolean/completed?, <span class="Constant">[ </span> + sink<span class="Special"> <- </span>write sink, <span class="Constant">10/newline</span> + restart buffer-routine + wait-for-routine buffer-routine + empty?<span class="Special"> <- </span>channel-empty? buffered-chan + data-emitted?:boolean<span class="Special"> <- </span>not empty? + assert data-emitted?, <span class="Constant">[ </span> <span class="Constant">F buffer-lines-blocks-until-newline: channel should contain data after writing newline]</span> trace <span class="Constant">1</span>, <span class="Constant">[test]</span>, <span class="Constant">[reached end]</span> ] diff --git a/html/073array.mu.html b/html/073array.mu.html index 433e2044..6766426d 100644 --- a/html/073array.mu.html +++ b/html/073array.mu.html @@ -33,14 +33,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <pre id='vimCodeElement'> <span class="muScenario">scenario</span> array-from-args [ run [ - <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new-array <span class="Constant">0</span>, <span class="Constant">1</span>, <span class="Constant">2</span> - <span class="Constant">2</span>:array:character<span class="Special"> <- </span>copy *<span class="Constant">1</span>:address:array:character + <span class="Constant">local-scope</span> + x:address:array:character<span class="Special"> <- </span>new-array <span class="Constant">0</span>, <span class="Constant">1</span>, <span class="Constant">2</span> + <span class="Constant">10</span>:array:character/<span class="Special">raw <- </span>copy *x ] memory-should-contain [ - <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Comment"># array length</span> - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">0</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">2</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Comment"># array length</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">1</span> + <span class="Constant">13</span><span class="Special"> <- </span><span class="Constant">2</span> ] ] diff --git a/html/074list.mu.html b/html/074list.mu.html index be4c153f..5154783c 100644 --- a/html/074list.mu.html +++ b/html/074list.mu.html @@ -63,21 +63,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> list-handling [ run [ - <span class="Constant">1</span>:address:list:number<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> - <span class="Constant">1</span>:address:list:number<span class="Special"> <- </span>push <span class="Constant">4</span>, <span class="Constant">1</span>:address:list:number - <span class="Constant">1</span>:address:list:number<span class="Special"> <- </span>push <span class="Constant">5</span>, <span class="Constant">1</span>:address:list:number - <span class="Constant">2</span>:number<span class="Special"> <- </span>first <span class="Constant">1</span>:address:list:number - <span class="Constant">1</span>:address:list:number<span class="Special"> <- </span>rest <span class="Constant">1</span>:address:list:number - <span class="Constant">3</span>:number<span class="Special"> <- </span>first <span class="Constant">1</span>:address:list:number - <span class="Constant">1</span>:address:list:number<span class="Special"> <- </span>rest <span class="Constant">1</span>:address:list:number - <span class="Constant">4</span>:number<span class="Special"> <- </span>first <span class="Constant">1</span>:address:list:number - <span class="Constant">1</span>:address:list:number<span class="Special"> <- </span>rest <span class="Constant">1</span>:address:list:number + <span class="Constant">local-scope</span> + x:address:list:number<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> + x<span class="Special"> <- </span>push <span class="Constant">4</span>, x + x<span class="Special"> <- </span>push <span class="Constant">5</span>, x + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>first x + x<span class="Special"> <- </span>rest x + <span class="Constant">11</span>:number/<span class="Special">raw <- </span>first x + x<span class="Special"> <- </span>rest x + <span class="Constant">12</span>:number/<span class="Special">raw <- </span>first x + <span class="Constant">20</span>:address:list:number/<span class="Special">raw <- </span>rest x ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># empty to empty, dust to dust..</span> - <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">5</span> - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">4</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">3</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">5</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">4</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">3</span> + <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># nothing left</span> ] ] diff --git a/html/076duplex_list.mu.html b/html/076duplex_list.mu.html index aebf00dd..aa5cff43 100644 --- a/html/076duplex_list.mu.html +++ b/html/076duplex_list.mu.html @@ -77,42 +77,42 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> duplex-list-handling [ run [ - <span class="Comment"># reserve locations 0, 1 and 2 to check for missing null check</span> - <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">34</span> - <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">35</span> - <span class="Constant">3</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> - <span class="Constant">3</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">4</span>, <span class="Constant">3</span>:address:duplex-list:character - <span class="Constant">3</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">5</span>, <span class="Constant">3</span>:address:duplex-list:character - <span class="Constant">4</span>:address:duplex-list:character<span class="Special"> <- </span>copy <span class="Constant">3</span>:address:duplex-list:character - <span class="Constant">5</span>:character<span class="Special"> <- </span>first <span class="Constant">4</span>:address:duplex-list:character - <span class="Constant">4</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">4</span>:address:duplex-list:character - <span class="Constant">6</span>:character<span class="Special"> <- </span>first <span class="Constant">4</span>:address:duplex-list:character - <span class="Constant">4</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">4</span>:address:duplex-list:character - <span class="Constant">7</span>:character<span class="Special"> <- </span>first <span class="Constant">4</span>:address:duplex-list:character - <span class="Constant">8</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">4</span>:address:duplex-list:character - <span class="Constant">9</span>:character<span class="Special"> <- </span>first <span class="Constant">8</span>:address:duplex-list:character - <span class="Constant">10</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">8</span>:address:duplex-list:character - <span class="Constant">11</span>:address:duplex-list:character<span class="Special"> <- </span>prev <span class="Constant">8</span>:address:duplex-list:character - <span class="Constant">4</span>:address:duplex-list:character<span class="Special"> <- </span>prev <span class="Constant">4</span>:address:duplex-list:character - <span class="Constant">12</span>:character<span class="Special"> <- </span>first <span class="Constant">4</span>:address:duplex-list:character - <span class="Constant">4</span>:address:duplex-list:character<span class="Special"> <- </span>prev <span class="Constant">4</span>:address:duplex-list:character - <span class="Constant">13</span>:character<span class="Special"> <- </span>first <span class="Constant">4</span>:address:duplex-list:character - <span class="Constant">14</span>:boolean<span class="Special"> <- </span>equal <span class="Constant">3</span>:address:duplex-list:character, <span class="Constant">4</span>:address:duplex-list:character + <span class="Comment"># reserve locations 0-9 to check for missing null check</span> + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>copy <span class="Constant">34</span> + <span class="Constant">11</span>:number/<span class="Special">raw <- </span>copy <span class="Constant">35</span> + list:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> + list<span class="Special"> <- </span>push <span class="Constant">4</span>, list + list<span class="Special"> <- </span>push <span class="Constant">5</span>, list + list2:address:duplex-list:character<span class="Special"> <- </span>copy list + <span class="Constant">20</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>next list2 + <span class="Constant">21</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>next list2 + <span class="Constant">22</span>:character/<span class="Special">raw <- </span>first list2 + <span class="Constant">30</span>:address:duplex-list:character/<span class="Special">raw <- </span>next list2 + <span class="Constant">31</span>:character/<span class="Special">raw <- </span>first <span class="Constant">30</span>:address:duplex-list:character/<span class="Special">raw</span> + <span class="Constant">32</span>:address:duplex-list:character/<span class="Special">raw <- </span>next <span class="Constant">30</span>:address:duplex-list:character/<span class="Special">raw</span> + <span class="Constant">33</span>:address:duplex-list:character/<span class="Special">raw <- </span>prev <span class="Constant">30</span>:address:duplex-list:character/<span class="Special">raw</span> + list2<span class="Special"> <- </span>prev list2 + <span class="Constant">40</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>prev list2 + <span class="Constant">41</span>:character/<span class="Special">raw <- </span>first list2 + <span class="Constant">50</span>:boolean/<span class="Special">raw <- </span>equal list, list2 ] memory-should-contain [ <span class="Constant">0</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># no modifications to null pointers</span> - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">34</span> - <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">35</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># scanning next</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">4</span> - <span class="Constant">7</span><span class="Special"> <- </span><span class="Constant">3</span> - <span class="Constant">8</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># null</span> - <span class="Constant">9</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># first of null</span> - <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># next of null</span> - <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># prev of null</span> - <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># then start scanning prev</span> - <span class="Constant">13</span><span class="Special"> <- </span><span class="Constant">5</span> - <span class="Constant">14</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># list back at start</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">34</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">35</span> + <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># scanning next</span> + <span class="Constant">21</span><span class="Special"> <- </span><span class="Constant">4</span> + <span class="Constant">22</span><span class="Special"> <- </span><span class="Constant">3</span> + <span class="Constant">30</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># null</span> + <span class="Constant">31</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># first of null</span> + <span class="Constant">32</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># next of null</span> + <span class="Constant">33</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># prev of null</span> + <span class="Constant">40</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># then start scanning prev</span> + <span class="Constant">41</span><span class="Special"> <- </span><span class="Constant">5</span> + <span class="Constant">50</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># list back at start</span> ] ] @@ -133,109 +133,109 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> inserting-into-duplex-list [ run [ - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">4</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">5</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">1</span>:address:duplex-list:character <span class="Comment"># 2 points inside list</span> - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>insert <span class="Constant">6</span>, <span class="Constant">2</span>:address:duplex-list:character + list:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> + list<span class="Special"> <- </span>push <span class="Constant">4</span>, list + list<span class="Special"> <- </span>push <span class="Constant">5</span>, list + list2:address:duplex-list:character<span class="Special"> <- </span>next list <span class="Comment"># inside list</span> + list2<span class="Special"> <- </span>insert <span class="Constant">6</span>, list2 <span class="Comment"># check structure like before</span> - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">3</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">4</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">5</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">6</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>prev <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">7</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>prev <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">8</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>prev <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">9</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">10</span>:boolean<span class="Special"> <- </span>equal <span class="Constant">1</span>:address:duplex-list:character, <span class="Constant">2</span>:address:duplex-list:character + list2<span class="Special"> <- </span>copy list + <span class="Constant">10</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>next list2 + <span class="Constant">11</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>next list2 + <span class="Constant">12</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>next list2 + <span class="Constant">13</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>prev list2 + <span class="Constant">20</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>prev list2 + <span class="Constant">21</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>prev list2 + <span class="Constant">22</span>:character/<span class="Special">raw <- </span>first list2 + <span class="Constant">30</span>:boolean/<span class="Special">raw <- </span>equal list, list2 ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># scanning next</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">4</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># inserted element</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">3</span> - <span class="Constant">7</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># then prev</span> - <span class="Constant">8</span><span class="Special"> <- </span><span class="Constant">4</span> - <span class="Constant">9</span><span class="Special"> <- </span><span class="Constant">5</span> - <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># list back at start</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># scanning next</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">4</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># inserted element</span> + <span class="Constant">13</span><span class="Special"> <- </span><span class="Constant">3</span> + <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># then prev</span> + <span class="Constant">21</span><span class="Special"> <- </span><span class="Constant">4</span> + <span class="Constant">22</span><span class="Special"> <- </span><span class="Constant">5</span> + <span class="Constant">30</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># list back at start</span> ] ] <span class="muScenario">scenario</span> inserting-at-end-of-duplex-list [ run [ - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">4</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">5</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">1</span>:address:duplex-list:character <span class="Comment"># 2 points inside list</span> - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character <span class="Comment"># now at end of list</span> - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>insert <span class="Constant">6</span>, <span class="Constant">2</span>:address:duplex-list:character + list:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> + list<span class="Special"> <- </span>push <span class="Constant">4</span>, list + list<span class="Special"> <- </span>push <span class="Constant">5</span>, list + list2:address:duplex-list:character<span class="Special"> <- </span>next list <span class="Comment"># inside list</span> + list2<span class="Special"> <- </span>next list2 <span class="Comment"># now at end of list</span> + list2<span class="Special"> <- </span>insert <span class="Constant">6</span>, list2 <span class="Comment"># check structure like before</span> - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">3</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">4</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">5</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">6</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>prev <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">7</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>prev <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">8</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>prev <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">9</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">10</span>:boolean<span class="Special"> <- </span>equal <span class="Constant">1</span>:address:duplex-list:character, <span class="Constant">2</span>:address:duplex-list:character + list2<span class="Special"> <- </span>copy list + <span class="Constant">10</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>next list2 + <span class="Constant">11</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>next list2 + <span class="Constant">12</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>next list2 + <span class="Constant">13</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>prev list2 + <span class="Constant">20</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>prev list2 + <span class="Constant">21</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>prev list2 + <span class="Constant">22</span>:character/<span class="Special">raw <- </span>first list2 + <span class="Constant">30</span>:boolean/<span class="Special">raw <- </span>equal list, list2 ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># scanning next</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">4</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">3</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># inserted element</span> - <span class="Constant">7</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Comment"># then prev</span> - <span class="Constant">8</span><span class="Special"> <- </span><span class="Constant">4</span> - <span class="Constant">9</span><span class="Special"> <- </span><span class="Constant">5</span> - <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># list back at start</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># scanning next</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">4</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">3</span> + <span class="Constant">13</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># inserted element</span> + <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Comment"># then prev</span> + <span class="Constant">21</span><span class="Special"> <- </span><span class="Constant">4</span> + <span class="Constant">22</span><span class="Special"> <- </span><span class="Constant">5</span> + <span class="Constant">30</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># list back at start</span> ] ] <span class="muScenario">scenario</span> inserting-after-start-of-duplex-list [ run [ - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">4</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">5</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>insert <span class="Constant">6</span>, <span class="Constant">1</span>:address:duplex-list:character + list:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> + list<span class="Special"> <- </span>push <span class="Constant">4</span>, list + list<span class="Special"> <- </span>push <span class="Constant">5</span>, list + list<span class="Special"> <- </span>insert <span class="Constant">6</span>, list <span class="Comment"># check structure like before</span> - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">3</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">4</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">5</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">6</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>prev <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">7</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>prev <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">8</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>prev <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">9</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">10</span>:boolean<span class="Special"> <- </span>equal <span class="Constant">1</span>:address:duplex-list:character, <span class="Constant">2</span>:address:duplex-list:character + list2:address:duplex-list:character<span class="Special"> <- </span>copy list + <span class="Constant">10</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>next list2 + <span class="Constant">11</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>next list2 + <span class="Constant">12</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>next list2 + <span class="Constant">13</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>prev list2 + <span class="Constant">20</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>prev list2 + <span class="Constant">21</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>prev list2 + <span class="Constant">22</span>:character/<span class="Special">raw <- </span>first list2 + <span class="Constant">30</span>:boolean/<span class="Special">raw <- </span>equal list, list2 ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># scanning next</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># inserted element</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">4</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">3</span> - <span class="Constant">7</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># then prev</span> - <span class="Constant">8</span><span class="Special"> <- </span><span class="Constant">6</span> - <span class="Constant">9</span><span class="Special"> <- </span><span class="Constant">5</span> - <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># list back at start</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># scanning next</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># inserted element</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">4</span> + <span class="Constant">13</span><span class="Special"> <- </span><span class="Constant">3</span> + <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># then prev</span> + <span class="Constant">21</span><span class="Special"> <- </span><span class="Constant">6</span> + <span class="Constant">22</span><span class="Special"> <- </span><span class="Constant">5</span> + <span class="Constant">30</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># list back at start</span> ] ] @@ -271,91 +271,93 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> removing-from-duplex-list [ run [ - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">4</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">5</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">1</span>:address:duplex-list:character <span class="Comment"># 2 points at second element</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>remove <span class="Constant">2</span>:address:duplex-list:character, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">3</span>:boolean<span class="Special"> <- </span>equal <span class="Constant">2</span>:address:duplex-list:character, <span class="Constant">0</span> + list:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> + list<span class="Special"> <- </span>push <span class="Constant">4</span>, list + list<span class="Special"> <- </span>push <span class="Constant">5</span>, list + list2:address:duplex-list:character<span class="Special"> <- </span>next list <span class="Comment"># second element</span> + list<span class="Special"> <- </span>remove list2, list + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>equal list2, <span class="Constant">0</span> <span class="Comment"># check structure like before</span> - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">4</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">5</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">6</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>prev <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">7</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">8</span>:boolean<span class="Special"> <- </span>equal <span class="Constant">1</span>:address:duplex-list:character, <span class="Constant">2</span>:address:duplex-list:character + list2<span class="Special"> <- </span>copy list + <span class="Constant">11</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>next list2 + <span class="Constant">12</span>:character/<span class="Special">raw <- </span>first list2 + <span class="Constant">20</span>:address:duplex-list:character/<span class="Special">raw <- </span>next list2 + list2<span class="Special"> <- </span>prev list2 + <span class="Constant">30</span>:character/<span class="Special">raw <- </span>first list2 + <span class="Constant">40</span>:boolean/<span class="Special">raw <- </span>equal list, list2 ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># remove returned non-null</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># scanning next, skipping deleted element</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">3</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># no more elements</span> - <span class="Constant">7</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># prev of final element</span> - <span class="Constant">8</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># list back at start</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># remove returned non-null</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># scanning next, skipping deleted element</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">3</span> + <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># no more elements</span> + <span class="Constant">30</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># prev of final element</span> + <span class="Constant">40</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># list back at start</span> ] ] <span class="muScenario">scenario</span> removing-from-start-of-duplex-list [ run [ - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">4</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">5</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>remove <span class="Constant">1</span>:address:duplex-list:character, <span class="Constant">1</span>:address:duplex-list:character + list:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> + list<span class="Special"> <- </span>push <span class="Constant">4</span>, list + list<span class="Special"> <- </span>push <span class="Constant">5</span>, list + list<span class="Special"> <- </span>remove list, list <span class="Comment"># check structure like before</span> - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">3</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">4</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">5</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>prev <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">6</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">7</span>:boolean<span class="Special"> <- </span>equal <span class="Constant">1</span>:address:duplex-list:character, <span class="Constant">2</span>:address:duplex-list:character + list2:address:duplex-list:character<span class="Special"> <- </span>copy list + <span class="Constant">10</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>next list2 + <span class="Constant">11</span>:character/<span class="Special">raw <- </span>first list2 + <span class="Constant">20</span>:address:duplex-list:character/<span class="Special">raw <- </span>next list2 + list2<span class="Special"> <- </span>prev list2 + <span class="Constant">30</span>:character/<span class="Special">raw <- </span>first list2 + <span class="Constant">40</span>:boolean/<span class="Special">raw <- </span>equal list, list2 ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># scanning next, skipping deleted element</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">3</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># no more elements</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># prev of final element</span> - <span class="Constant">7</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># list back at start</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># scanning next, skipping deleted element</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">3</span> + <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># no more elements</span> + <span class="Constant">30</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># prev of final element</span> + <span class="Constant">40</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># list back at start</span> ] ] <span class="muScenario">scenario</span> removing-from-end-of-duplex-list [ run [ - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">4</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">5</span>, <span class="Constant">1</span>:address:duplex-list:character + list:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> + list<span class="Special"> <- </span>push <span class="Constant">4</span>, list + list<span class="Special"> <- </span>push <span class="Constant">5</span>, list <span class="Comment"># delete last element</span> - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>remove <span class="Constant">2</span>:address:duplex-list:character, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">3</span>:boolean<span class="Special"> <- </span>equal <span class="Constant">2</span>:address:duplex-list:character, <span class="Constant">0</span> + list2:address:duplex-list:character<span class="Special"> <- </span>next list + list2<span class="Special"> <- </span>next list2 + list<span class="Special"> <- </span>remove list2, list + <span class="Constant">10</span>:boolean/<span class="Special">raw <- </span>equal list2, <span class="Constant">0</span> <span class="Comment"># check structure like before</span> - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">4</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">5</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">6</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>prev <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">7</span>:character<span class="Special"> <- </span>first <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">8</span>:boolean<span class="Special"> <- </span>equal <span class="Constant">1</span>:address:duplex-list:character, <span class="Constant">2</span>:address:duplex-list:character + list2<span class="Special"> <- </span>copy list + <span class="Constant">11</span>:character/<span class="Special">raw <- </span>first list2 + list2<span class="Special"> <- </span>next list2 + <span class="Constant">12</span>:character/<span class="Special">raw <- </span>first list2 + <span class="Constant">20</span>:address:duplex-list:character/<span class="Special">raw <- </span>next list2 + list2<span class="Special"> <- </span>prev list2 + <span class="Constant">30</span>:character/<span class="Special">raw <- </span>first list2 + <span class="Constant">40</span>:boolean/<span class="Special">raw <- </span>equal list, list2 ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># remove returned non-null</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># scanning next, skipping deleted element</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">4</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># no more elements</span> - <span class="Constant">7</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># prev of final element</span> - <span class="Constant">8</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># list back at start</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># remove returned non-null</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># scanning next, skipping deleted element</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">4</span> + <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># no more elements</span> + <span class="Constant">30</span><span class="Special"> <- </span><span class="Constant">5</span> <span class="Comment"># prev of final element</span> + <span class="Constant">40</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># list back at start</span> ] ] <span class="muScenario">scenario</span> removing-from-singleton-list [ run [ - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>remove <span class="Constant">1</span>:address:duplex-list:character, <span class="Constant">1</span>:address:duplex-list:character + <span class="Constant">local-scope</span> + list:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> + list<span class="Special"> <- </span>remove list, list + <span class="Constant">1</span>:number/<span class="Special">raw <- </span>copy list ] memory-should-contain [ <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># back to an empty list</span> @@ -389,116 +391,132 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> remove-range [ <span class="Comment"># construct a duplex list with six elements [13, 14, 15, 16, 17, 18]</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">18</span>, <span class="Constant">0</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">17</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">16</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">15</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">14</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">13</span>, <span class="Constant">1</span>:address:duplex-list:character + <span class="Constant">local-scope</span> + list:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">18</span>, <span class="Constant">0</span> + list<span class="Special"> <- </span>push <span class="Constant">17</span>, list + list<span class="Special"> <- </span>push <span class="Constant">16</span>, list + list<span class="Special"> <- </span>push <span class="Constant">15</span>, list + list<span class="Special"> <- </span>push <span class="Constant">14</span>, list + list<span class="Special"> <- </span>push <span class="Constant">13</span>, list + <span class="Constant">1</span>:address:duplex-list:character/<span class="Special">raw <- </span>copy list <span class="Comment"># save list</span> run [ + <span class="Constant">local-scope</span> + list:address:duplex-list:character<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:duplex-list:character/<span class="Special">raw</span> <span class="Comment"># restore list</span> <span class="Comment"># delete 16 onwards</span> <span class="Comment"># first pointer: to the third element</span> - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>remove-between <span class="Constant">2</span>:address:duplex-list:character, <span class="Constant">0</span> + list2:address:duplex-list:character<span class="Special"> <- </span>next list + list2<span class="Special"> <- </span>next list2 + list2<span class="Special"> <- </span>remove-between list2, <span class="Constant">0</span> <span class="Comment"># now check the list</span> - <span class="Constant">4</span>:character<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:duplex-list:character, <span class="Constant">value:offset</span> - <span class="Constant">5</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">6</span>:character<span class="Special"> <- </span>get *<span class="Constant">5</span>:address:duplex-list:character, <span class="Constant">value:offset</span> - <span class="Constant">7</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">5</span>:address:duplex-list:character - <span class="Constant">8</span>:character<span class="Special"> <- </span>get *<span class="Constant">7</span>:address:duplex-list:character, <span class="Constant">value:offset</span> - <span class="Constant">9</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">7</span>:address:duplex-list:character + <span class="Constant">10</span>:character/<span class="Special">raw <- </span>get *list, <span class="Constant">value:offset</span> + list<span class="Special"> <- </span>next list + <span class="Constant">11</span>:character/<span class="Special">raw <- </span>get *list, <span class="Constant">value:offset</span> + list<span class="Special"> <- </span>next list + <span class="Constant">12</span>:character/<span class="Special">raw <- </span>get *list, <span class="Constant">value:offset</span> + <span class="Constant">20</span>:address:duplex-list:character/<span class="Special">raw <- </span>next list ] memory-should-contain [ - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">13</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">14</span> - <span class="Constant">8</span><span class="Special"> <- </span><span class="Constant">15</span> - <span class="Constant">9</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">13</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">14</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">15</span> + <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">0</span> ] ] <span class="muScenario">scenario</span> remove-range-to-final [ + <span class="Constant">local-scope</span> <span class="Comment"># construct a duplex list with six elements [13, 14, 15, 16, 17, 18]</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">18</span>, <span class="Constant">0</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">17</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">16</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">15</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">14</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">13</span>, <span class="Constant">1</span>:address:duplex-list:character + list:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">18</span>, <span class="Constant">0</span> + list<span class="Special"> <- </span>push <span class="Constant">17</span>, list + list<span class="Special"> <- </span>push <span class="Constant">16</span>, list + list<span class="Special"> <- </span>push <span class="Constant">15</span>, list + list<span class="Special"> <- </span>push <span class="Constant">14</span>, list + list<span class="Special"> <- </span>push <span class="Constant">13</span>, list + <span class="Constant">1</span>:address:duplex-list:character/<span class="Special">raw <- </span>copy list <span class="Comment"># save list</span> run [ + <span class="Constant">local-scope</span> + list:address:duplex-list:character<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:duplex-list:character/<span class="Special">raw</span> <span class="Comment"># restore list</span> <span class="Comment"># delete 15, 16 and 17</span> <span class="Comment"># start pointer: to the second element</span> - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">1</span>:address:duplex-list:character + list2:address:duplex-list:character<span class="Special"> <- </span>next list <span class="Comment"># end pointer: to the last (sixth) element</span> - <span class="Constant">3</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">2</span>:address:duplex-list:character - <span class="Constant">3</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">3</span>:address:duplex-list:character - <span class="Constant">3</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">3</span>:address:duplex-list:character - <span class="Constant">3</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">3</span>:address:duplex-list:character - remove-between <span class="Constant">2</span>:address:duplex-list:character, <span class="Constant">3</span>:address:duplex-list:character + end:address:duplex-list:character<span class="Special"> <- </span>next list2 + end<span class="Special"> <- </span>next end + end<span class="Special"> <- </span>next end + end<span class="Special"> <- </span>next end + remove-between list2, end <span class="Comment"># now check the list</span> - <span class="Constant">4</span>:character<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:duplex-list:character, <span class="Constant">value:offset</span> - <span class="Constant">5</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">6</span>:character<span class="Special"> <- </span>get *<span class="Constant">5</span>:address:duplex-list:character, <span class="Constant">value:offset</span> - <span class="Constant">7</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">5</span>:address:duplex-list:character - <span class="Constant">8</span>:character<span class="Special"> <- </span>get *<span class="Constant">7</span>:address:duplex-list:character, <span class="Constant">value:offset</span> - <span class="Constant">9</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">7</span>:address:duplex-list:character + <span class="Constant">10</span>:character/<span class="Special">raw <- </span>get *list, <span class="Constant">value:offset</span> + list<span class="Special"> <- </span>next list + <span class="Constant">11</span>:character/<span class="Special">raw <- </span>get *list, <span class="Constant">value:offset</span> + list<span class="Special"> <- </span>next list + <span class="Constant">12</span>:character/<span class="Special">raw <- </span>get *list, <span class="Constant">value:offset</span> + <span class="Constant">20</span>:address:duplex-list:character/<span class="Special">raw <- </span>next list ] memory-should-contain [ - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">13</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">14</span> - <span class="Constant">8</span><span class="Special"> <- </span><span class="Constant">18</span> - <span class="Constant">9</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">13</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">14</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">18</span> + <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># no more elements</span> ] ] <span class="muScenario">scenario</span> remove-range-empty [ + <span class="Constant">local-scope</span> <span class="Comment"># construct a duplex list with three elements [13, 14, 15]</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">15</span>, <span class="Constant">0</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">14</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">13</span>, <span class="Constant">1</span>:address:duplex-list:character + list:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">15</span>, <span class="Constant">0</span> + list<span class="Special"> <- </span>push <span class="Constant">14</span>, list + list<span class="Special"> <- </span>push <span class="Constant">13</span>, list + <span class="Constant">1</span>:address:duplex-list:character/<span class="Special">raw <- </span>copy list <span class="Comment"># save list</span> run [ + <span class="Constant">local-scope</span> + list:address:duplex-list:character<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:duplex-list:character/<span class="Special">raw</span> <span class="Comment"># restore list</span> <span class="Comment"># delete between first and second element (i.e. nothing)</span> - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">1</span>:address:duplex-list:character - remove-between <span class="Constant">1</span>:address:duplex-list:character, <span class="Constant">2</span>:address:duplex-list:character + list2:address:duplex-list:character<span class="Special"> <- </span>next list + remove-between list, list2 <span class="Comment"># now check the list</span> - <span class="Constant">4</span>:character<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:duplex-list:character, <span class="Constant">value:offset</span> - <span class="Constant">5</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">6</span>:character<span class="Special"> <- </span>get *<span class="Constant">5</span>:address:duplex-list:character, <span class="Constant">value:offset</span> - <span class="Constant">7</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">5</span>:address:duplex-list:character - <span class="Constant">8</span>:character<span class="Special"> <- </span>get *<span class="Constant">7</span>:address:duplex-list:character, <span class="Constant">value:offset</span> - <span class="Constant">9</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">7</span>:address:duplex-list:character + <span class="Constant">10</span>:character/<span class="Special">raw <- </span>get *list, <span class="Constant">value:offset</span> + list<span class="Special"> <- </span>next list + <span class="Constant">11</span>:character/<span class="Special">raw <- </span>get *list, <span class="Constant">value:offset</span> + list<span class="Special"> <- </span>next list + <span class="Constant">12</span>:character/<span class="Special">raw <- </span>get *list, <span class="Constant">value:offset</span> + <span class="Constant">20</span>:address:duplex-list:character/<span class="Special">raw <- </span>next list ] <span class="Comment"># no change</span> memory-should-contain [ - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">13</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">14</span> - <span class="Constant">8</span><span class="Special"> <- </span><span class="Constant">15</span> - <span class="Constant">9</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">13</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">14</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">15</span> + <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">0</span> ] ] <span class="muScenario">scenario</span> remove-range-to-end [ + <span class="Constant">local-scope</span> <span class="Comment"># construct a duplex list with six elements [13, 14, 15, 16, 17, 18]</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">18</span>, <span class="Constant">0</span> - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">17</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">16</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">15</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">14</span>, <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">1</span>:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">13</span>, <span class="Constant">1</span>:address:duplex-list:character + list:address:duplex-list:character<span class="Special"> <- </span>push <span class="Constant">18</span>, <span class="Constant">0</span> + list<span class="Special"> <- </span>push <span class="Constant">17</span>, list + list<span class="Special"> <- </span>push <span class="Constant">16</span>, list + list<span class="Special"> <- </span>push <span class="Constant">15</span>, list + list<span class="Special"> <- </span>push <span class="Constant">14</span>, list + list<span class="Special"> <- </span>push <span class="Constant">13</span>, list + <span class="Constant">1</span>:address:duplex-list:character/<span class="Special">raw <- </span>copy list <span class="Comment"># save list</span> run [ + <span class="Constant">local-scope</span> + list:address:duplex-list:character<span class="Special"> <- </span>copy <span class="Constant">1</span>:address:duplex-list:character/<span class="Special">raw</span> <span class="Comment"># restore list</span> <span class="Comment"># remove the third element and beyond</span> - <span class="Constant">2</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">1</span>:address:duplex-list:character - remove-between <span class="Constant">2</span>:address:duplex-list:character, <span class="Constant">0</span> + list2:address:duplex-list:character<span class="Special"> <- </span>next list + remove-between list2, <span class="Constant">0</span> <span class="Comment"># now check the list</span> - <span class="Constant">4</span>:character<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:duplex-list:character, <span class="Constant">value:offset</span> - <span class="Constant">5</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">1</span>:address:duplex-list:character - <span class="Constant">6</span>:character<span class="Special"> <- </span>get *<span class="Constant">5</span>:address:duplex-list:character, <span class="Constant">value:offset</span> - <span class="Constant">7</span>:address:duplex-list:character<span class="Special"> <- </span>next <span class="Constant">5</span>:address:duplex-list:character + <span class="Constant">10</span>:character/<span class="Special">raw <- </span>get *list, <span class="Constant">value:offset</span> + list<span class="Special"> <- </span>next list + <span class="Constant">11</span>:character/<span class="Special">raw <- </span>get *list, <span class="Constant">value:offset</span> + <span class="Constant">20</span>:address:duplex-list:character/<span class="Special">raw <- </span>next list ] memory-should-contain [ - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">13</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">14</span> - <span class="Constant">7</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">13</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">14</span> + <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">0</span> ] ] diff --git a/html/079table.mu.html b/html/079table.mu.html index 76d97082..547a9c2f 100644 --- a/html/079table.mu.html +++ b/html/079table.mu.html @@ -37,24 +37,26 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> table-read-write [ run [ - <span class="Constant">1</span>:address:table:number:number<span class="Special"> <- </span>new-table <span class="Constant">30</span> - put <span class="Constant">1</span>:address:table:number:number, <span class="Constant">12</span>, <span class="Constant">34</span> - <span class="Constant">2</span>:number<span class="Special"> <- </span>index <span class="Constant">1</span>:address:table:number:number, <span class="Constant">12</span> + <span class="Constant">local-scope</span> + tab:address:table:number:number<span class="Special"> <- </span>new-table <span class="Constant">30</span> + put-index tab, <span class="Constant">12</span>, <span class="Constant">34</span> + <span class="Constant">1</span>:number/<span class="Special">raw <- </span>index tab, <span class="Constant">12</span> ] memory-should-contain [ - <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">34</span> + <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">34</span> ] ] <span class="muScenario">scenario</span> table-read-write-non-integer [ run [ - <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc def]</span> - <span class="Delimiter">{</span><span class="Constant">2</span>: (address table (address array character) number)<span class="Delimiter">}</span><span class="Special"> <- </span>new-table <span class="Constant">30</span> - put <span class="Delimiter">{</span><span class="Constant">2</span>: (address table (address array character) number)<span class="Delimiter">}</span>, <span class="Constant">1</span>:address:array:character, <span class="Constant">34</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>index <span class="Delimiter">{</span><span class="Constant">2</span>: (address table (address array character) number)<span class="Delimiter">}</span>, <span class="Constant">1</span>:address:array:character + <span class="Constant">local-scope</span> + key:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abc def]</span> + <span class="Delimiter">{</span>tab: (address table (address array character) number)<span class="Delimiter">}</span><span class="Special"> <- </span>new-table <span class="Constant">30</span> + put-index tab, key, <span class="Constant">34</span> + <span class="Constant">1</span>:number/<span class="Special">raw <- </span>index tab, key ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">34</span> + <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">34</span> ] ] @@ -78,7 +80,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color *result<span class="Special"> <- </span>merge <span class="Constant">0/length</span>, capacity, data ] -<span class="muRecipe">def</span> put table:address:table:_key:_value, key:_key, value:_value<span class="muRecipe"> -> </span>table:address:table:_key:_value [ +<span class="muRecipe">def</span> put-index table:address:table:_key:_value, key:_key, value:_value<span class="muRecipe"> -> </span>table:address:table:_key:_value [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> hash:number<span class="Special"> <- </span>hash key diff --git a/html/081print.mu.html b/html/081print.mu.html index 286e801d..b6d2bd96 100644 --- a/html/081print.mu.html +++ b/html/081print.mu.html @@ -207,162 +207,175 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> print-character-at-top-left [ run [ - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> - <span class="Constant">11</span>:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">11</span>:character/a - <span class="Constant">2</span>:address:array:screen-cell<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">data:offset</span> - <span class="Constant">3</span>:array:screen-cell<span class="Special"> <- </span>copy *<span class="Constant">2</span>:address:array:screen-cell + <span class="Constant">local-scope</span> + fake-screen:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> + a:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> + fake-screen<span class="Special"> <- </span>print fake-screen, a:character + cell:address:array:screen-cell<span class="Special"> <- </span>get *fake-screen, <span class="Constant">data:offset</span> + <span class="Constant">1</span>:array:screen-cell/<span class="Special">raw <- </span>copy *cell ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># width*height</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># 'a'</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># width*height</span> + <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># 'a'</span> + <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> + <span class="Comment"># rest of screen is empty</span> + <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">0</span> ] ] <span class="muScenario">scenario</span> print-character-in-color [ run [ - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> - <span class="Constant">11</span>:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">11</span>:character/a, <span class="Constant">1/red</span> - <span class="Constant">2</span>:address:array:screen-cell<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">data:offset</span> - <span class="Constant">3</span>:array:screen-cell<span class="Special"> <- </span>copy *<span class="Constant">2</span>:address:array:screen-cell + <span class="Constant">local-scope</span> + fake-screen:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> + a:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> + fake-screen<span class="Special"> <- </span>print fake-screen, a:character, <span class="Constant">1/red</span> + cell:address:array:screen-cell<span class="Special"> <- </span>get *fake-screen, <span class="Constant">data:offset</span> + <span class="Constant">1</span>:array:screen-cell/<span class="Special">raw <- </span>copy *cell ] memory-should-contain [ - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># width*height</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># 'a'</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># red</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># width*height</span> + <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># 'a'</span> + <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># red</span> + <span class="Comment"># rest of screen is empty</span> + <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">0</span> ] ] <span class="muScenario">scenario</span> print-backspace-character [ run [ - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> - <span class="Constant">11</span>:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">11</span>:character/a - <span class="Constant">12</span>:character<span class="Special"> <- </span>copy <span class="Constant">8/backspace</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">12</span>:character/backspace - <span class="Constant">2</span>:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">cursor-column:offset</span> - <span class="Constant">3</span>:address:array:screen-cell<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">data:offset</span> - <span class="Constant">4</span>:array:screen-cell<span class="Special"> <- </span>copy *<span class="Constant">3</span>:address:array:screen-cell + <span class="Constant">local-scope</span> + fake-screen:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> + a:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> + fake-screen<span class="Special"> <- </span>print fake-screen, a + backspace:character<span class="Special"> <- </span>copy <span class="Constant">8/backspace</span> + fake-screen<span class="Special"> <- </span>print fake-screen, backspace + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>get *fake-screen, <span class="Constant">cursor-column:offset</span> + cell:address:array:screen-cell<span class="Special"> <- </span>get *fake-screen, <span class="Constant">data:offset</span> + <span class="Constant">11</span>:array:screen-cell/<span class="Special">raw <- </span>copy *cell ] memory-should-contain [ - <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># cursor column</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># width*height</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">32</span> <span class="Comment"># space, not 'a'</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> - <span class="Constant">7</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># cursor column</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># width*height</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">32</span> <span class="Comment"># space, not 'a'</span> + <span class="Constant">13</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> + <span class="Comment"># rest of screen is empty</span> + <span class="Constant">14</span><span class="Special"> <- </span><span class="Constant">0</span> ] ] <span class="muScenario">scenario</span> print-extra-backspace-character [ run [ - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> - <span class="Constant">11</span>:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">11</span>:character/a - <span class="Constant">12</span>:character<span class="Special"> <- </span>copy <span class="Constant">8/backspace</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">12</span>:character/backspace - <span class="Constant">12</span>:character<span class="Special"> <- </span>copy <span class="Constant">8/backspace</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">12</span>:character/backspace - <span class="Constant">2</span>:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">cursor-column:offset</span> - <span class="Constant">3</span>:address:array:screen-cell<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">data:offset</span> - <span class="Constant">4</span>:array:screen-cell<span class="Special"> <- </span>copy *<span class="Constant">3</span>:address:array:screen-cell + <span class="Constant">local-scope</span> + fake-screen:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> + a:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> + fake-screen<span class="Special"> <- </span>print fake-screen, a + backspace:character<span class="Special"> <- </span>copy <span class="Constant">8/backspace</span> + fake-screen<span class="Special"> <- </span>print fake-screen, backspace + fake-screen<span class="Special"> <- </span>print fake-screen, backspace + <span class="Constant">1</span>:number/<span class="Special">raw <- </span>get *fake-screen, <span class="Constant">cursor-column:offset</span> + cell:address:array:screen-cell<span class="Special"> <- </span>get *fake-screen, <span class="Constant">data:offset</span> + <span class="Constant">3</span>:array:screen-cell/<span class="Special">raw <- </span>copy *cell ] memory-should-contain [ - <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># cursor column</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># width*height</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">32</span> <span class="Comment"># space, not 'a'</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> - <span class="Constant">7</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># cursor column</span> + <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># width*height</span> + <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">32</span> <span class="Comment"># space, not 'a'</span> + <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> + <span class="Comment"># rest of screen is empty</span> + <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">0</span> ] ] <span class="muScenario">scenario</span> print-character-at-right-margin [ run [ - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">2/width</span>, <span class="Constant">2/height</span> - <span class="Constant">11</span>:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">11</span>:character/a - <span class="Constant">12</span>:character<span class="Special"> <- </span>copy <span class="Constant">98/b</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">12</span>:character/b - <span class="Constant">13</span>:character<span class="Special"> <- </span>copy <span class="Constant">99/b</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">13</span>:character/c - <span class="Constant">2</span>:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">cursor-column:offset</span> - <span class="Constant">3</span>:address:array:screen-cell<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">data:offset</span> - <span class="Constant">4</span>:array:screen-cell<span class="Special"> <- </span>copy *<span class="Constant">3</span>:address:array:screen-cell + <span class="Constant">local-scope</span> + fake-screen:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">2/width</span>, <span class="Constant">2/height</span> + a:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> + fake-screen<span class="Special"> <- </span>print fake-screen, a + b:character<span class="Special"> <- </span>copy <span class="Constant">98/b</span> + fake-screen<span class="Special"> <- </span>print fake-screen, b + c:character<span class="Special"> <- </span>copy <span class="Constant">99/c</span> + fake-screen<span class="Special"> <- </span>print fake-screen, c + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>get *fake-screen, <span class="Constant">cursor-column:offset</span> + cell:address:array:screen-cell<span class="Special"> <- </span>get *fake-screen, <span class="Constant">data:offset</span> + <span class="Constant">11</span>:array:screen-cell/<span class="Special">raw <- </span>copy *cell ] memory-should-contain [ - <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># cursor column</span> - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># width*height</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># 'a'</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> - <span class="Constant">7</span><span class="Special"> <- </span><span class="Constant">99</span> <span class="Comment"># 'c' over 'b'</span> - <span class="Constant">8</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> - <span class="Constant">9</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># cursor column</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># width*height</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># 'a'</span> + <span class="Constant">13</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> + <span class="Constant">14</span><span class="Special"> <- </span><span class="Constant">99</span> <span class="Comment"># 'c' over 'b'</span> + <span class="Constant">15</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> + <span class="Comment"># rest of screen is empty</span> + <span class="Constant">16</span><span class="Special"> <- </span><span class="Constant">0</span> ] ] <span class="muScenario">scenario</span> print-newline-character [ run [ - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> - <span class="Constant">10</span>:character<span class="Special"> <- </span>copy <span class="Constant">10/newline</span> - <span class="Constant">11</span>:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">11</span>:character/a - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">10</span>:character/newline - <span class="Constant">2</span>:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">cursor-row:offset</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">cursor-column:offset</span> - <span class="Constant">4</span>:address:array:screen-cell<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">data:offset</span> - <span class="Constant">5</span>:array:screen-cell<span class="Special"> <- </span>copy *<span class="Constant">4</span>:address:array:screen-cell + <span class="Constant">local-scope</span> + fake-screen:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> + newline:character<span class="Special"> <- </span>copy <span class="Constant">10/newline</span> + a:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> + fake-screen<span class="Special"> <- </span>print fake-screen, a + fake-screen<span class="Special"> <- </span>print fake-screen, newline + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>get *fake-screen, <span class="Constant">cursor-row:offset</span> + <span class="Constant">11</span>:number/<span class="Special">raw <- </span>get *fake-screen, <span class="Constant">cursor-column:offset</span> + cell:address:array:screen-cell<span class="Special"> <- </span>get *fake-screen, <span class="Constant">data:offset</span> + <span class="Constant">12</span>:array:screen-cell/<span class="Special">raw <- </span>copy *cell ] memory-should-contain [ - <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># cursor row</span> - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># cursor column</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># width*height</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># 'a'</span> - <span class="Constant">7</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> - <span class="Constant">8</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># cursor row</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># cursor column</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># width*height</span> + <span class="Constant">13</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># 'a'</span> + <span class="Constant">14</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> + <span class="Comment"># rest of screen is empty</span> + <span class="Constant">15</span><span class="Special"> <- </span><span class="Constant">0</span> ] ] <span class="muScenario">scenario</span> print-newline-at-bottom-line [ run [ - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> - <span class="Constant">10</span>:character<span class="Special"> <- </span>copy <span class="Constant">10/newline</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">10</span>:character/newline - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">10</span>:character/newline - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">10</span>:character/newline - <span class="Constant">2</span>:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">cursor-row:offset</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">cursor-column:offset</span> + <span class="Constant">local-scope</span> + fake-screen:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> + newline:character<span class="Special"> <- </span>copy <span class="Constant">10/newline</span> + fake-screen<span class="Special"> <- </span>print fake-screen, newline + fake-screen<span class="Special"> <- </span>print fake-screen, newline + fake-screen<span class="Special"> <- </span>print fake-screen, newline + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>get *fake-screen, <span class="Constant">cursor-row:offset</span> + <span class="Constant">11</span>:number/<span class="Special">raw <- </span>get *fake-screen, <span class="Constant">cursor-column:offset</span> ] memory-should-contain [ - <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># cursor row</span> - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># cursor column</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># cursor row</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># cursor column</span> ] ] <span class="muScenario">scenario</span> print-character-at-bottom-right [ run [ - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">2/width</span>, <span class="Constant">2/height</span> - <span class="Constant">10</span>:character<span class="Special"> <- </span>copy <span class="Constant">10/newline</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">10</span>:character/newline - <span class="Constant">11</span>:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">11</span>:character/a - <span class="Constant">12</span>:character<span class="Special"> <- </span>copy <span class="Constant">98/b</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">12</span>:character/b - <span class="Constant">13</span>:character<span class="Special"> <- </span>copy <span class="Constant">99/c</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">13</span>:character/c - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">10</span>:character/newline - <span class="Constant">14</span>:character<span class="Special"> <- </span>copy <span class="Constant">100/d</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">14</span>:character/d - <span class="Constant">2</span>:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">cursor-row:offset</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">cursor-column:offset</span> - <span class="Constant">4</span>:address:array:screen-cell<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">data:offset</span> - <span class="Constant">20</span>:array:screen-cell<span class="Special"> <- </span>copy *<span class="Constant">4</span>:address:array:screen-cell + <span class="Constant">local-scope</span> + fake-screen:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">2/width</span>, <span class="Constant">2/height</span> + newline:character<span class="Special"> <- </span>copy <span class="Constant">10/newline</span> + fake-screen<span class="Special"> <- </span>print fake-screen, newline + a:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> + fake-screen<span class="Special"> <- </span>print fake-screen, a + b:character<span class="Special"> <- </span>copy <span class="Constant">98/b</span> + fake-screen<span class="Special"> <- </span>print fake-screen, b + c:character<span class="Special"> <- </span>copy <span class="Constant">99/c</span> + fake-screen<span class="Special"> <- </span>print fake-screen, c + fake-screen<span class="Special"> <- </span>print fake-screen, newline + d:character<span class="Special"> <- </span>copy <span class="Constant">100/d</span> + fake-screen<span class="Special"> <- </span>print fake-screen, d + <span class="Constant">10</span>:number/<span class="Special">raw <- </span>get *fake-screen, <span class="Constant">cursor-row:offset</span> + <span class="Constant">11</span>:number/<span class="Special">raw <- </span>get *fake-screen, <span class="Constant">cursor-column:offset</span> + cell:address:array:screen-cell<span class="Special"> <- </span>get *fake-screen, <span class="Constant">data:offset</span> + <span class="Constant">20</span>:array:screen-cell/<span class="Special">raw <- </span>copy *cell ] memory-should-contain [ - <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># cursor row</span> - <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># cursor column</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># cursor row</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Comment"># cursor column</span> <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">4</span> <span class="Comment"># width*height</span> <span class="Constant">21</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># unused</span> <span class="Constant">22</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> @@ -372,6 +385,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">26</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> <span class="Constant">27</span><span class="Special"> <- </span><span class="Constant">100</span> <span class="Comment"># 'd' over 'b' and 'c' and newline</span> <span class="Constant">28</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> + <span class="Comment"># rest of screen is empty</span> <span class="Constant">29</span><span class="Special"> <- </span><span class="Constant">0</span> ] ] @@ -452,32 +466,33 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> clear-line-erases-printed-characters [ run [ - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> + <span class="Constant">local-scope</span> + fake-screen:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> <span class="Comment"># print a character</span> - <span class="Constant">10</span>:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">10</span>:character/a + a:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> + fake-screen<span class="Special"> <- </span>print fake-screen, a <span class="Comment"># move cursor to start of line</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>move-cursor <span class="Constant">1</span>:address:screen, <span class="Constant">0/row</span>, <span class="Constant">0/column</span> + fake-screen<span class="Special"> <- </span>move-cursor fake-screen, <span class="Constant">0/row</span>, <span class="Constant">0/column</span> <span class="Comment"># clear line</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>clear-line <span class="Constant">1</span>:address:screen - <span class="Constant">2</span>:address:array:screen-cell<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">data:offset</span> - <span class="Constant">20</span>:array:screen-cell<span class="Special"> <- </span>copy *<span class="Constant">2</span>:address:array:screen-cell + fake-screen<span class="Special"> <- </span>clear-line fake-screen + cell:address:array:screen-cell<span class="Special"> <- </span>get *fake-screen, <span class="Constant">data:offset</span> + <span class="Constant">10</span>:array:screen-cell/<span class="Special">raw <- </span>copy *cell ] <span class="Comment"># screen should be blank</span> memory-should-contain [ - <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># width*height</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># width*height</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">7</span> + <span class="Constant">13</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">14</span><span class="Special"> <- </span><span class="Constant">7</span> + <span class="Constant">15</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">16</span><span class="Special"> <- </span><span class="Constant">7</span> + <span class="Constant">17</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">18</span><span class="Special"> <- </span><span class="Constant">7</span> + <span class="Constant">19</span><span class="Special"> <- </span><span class="Constant">0</span> + <span class="Constant">20</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Constant">21</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Constant">22</span><span class="Special"> <- </span><span class="Constant">7</span> - <span class="Constant">23</span><span class="Special"> <- </span><span class="Constant">0</span> - <span class="Constant">24</span><span class="Special"> <- </span><span class="Constant">7</span> - <span class="Constant">25</span><span class="Special"> <- </span><span class="Constant">0</span> - <span class="Constant">26</span><span class="Special"> <- </span><span class="Constant">7</span> - <span class="Constant">27</span><span class="Special"> <- </span><span class="Constant">0</span> - <span class="Constant">28</span><span class="Special"> <- </span><span class="Constant">7</span> - <span class="Constant">29</span><span class="Special"> <- </span><span class="Constant">0</span> - <span class="Constant">30</span><span class="Special"> <- </span><span class="Constant">7</span> - <span class="Constant">31</span><span class="Special"> <- </span><span class="Constant">0</span> - <span class="Constant">32</span><span class="Special"> <- </span><span class="Constant">7</span> ] ] @@ -692,21 +707,23 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> print-text-stops-at-right-margin [ run [ - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> - <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abcd]</span> - <span class="Constant">1</span>:address:screen<span class="Special"> <- </span>print <span class="Constant">1</span>:address:screen, <span class="Constant">2</span>:address:array:character - <span class="Constant">3</span>:address:array:screen-cell<span class="Special"> <- </span>get *<span class="Constant">1</span>:address:screen, <span class="Constant">data:offset</span> - <span class="Constant">4</span>:array:screen-cell<span class="Special"> <- </span>copy *<span class="Constant">3</span>:address:array:screen-cell + <span class="Constant">local-scope</span> + fake-screen:address:screen<span class="Special"> <- </span>new-fake-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> + s:address:array:character<span class="Special"> <- </span>new <span class="Constant">[abcd]</span> + fake-screen<span class="Special"> <- </span>print fake-screen, s:address:array:character + cell:address:array:screen-cell<span class="Special"> <- </span>get *fake-screen, <span class="Constant">data:offset</span> + <span class="Constant">10</span>:array:screen-cell/<span class="Special">raw <- </span>copy *cell ] memory-should-contain [ - <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># width*height</span> - <span class="Constant">5</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># 'a'</span> - <span class="Constant">6</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> - <span class="Constant">7</span><span class="Special"> <- </span><span class="Constant">98</span> <span class="Comment"># 'b'</span> - <span class="Constant">8</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> - <span class="Constant">9</span><span class="Special"> <- </span><span class="Constant">100</span> <span class="Comment"># 'd' overwrites 'c'</span> - <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> - <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># unused</span> + <span class="Constant">10</span><span class="Special"> <- </span><span class="Constant">6</span> <span class="Comment"># width*height</span> + <span class="Constant">11</span><span class="Special"> <- </span><span class="Constant">97</span> <span class="Comment"># 'a'</span> + <span class="Constant">12</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> + <span class="Constant">13</span><span class="Special"> <- </span><span class="Constant">98</span> <span class="Comment"># 'b'</span> + <span class="Constant">14</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> + <span class="Constant">15</span><span class="Special"> <- </span><span class="Constant">100</span> <span class="Comment"># 'd' overwrites 'c'</span> + <span class="Constant">16</span><span class="Special"> <- </span><span class="Constant">7</span> <span class="Comment"># white</span> + <span class="Comment"># rest of screen is empty</span> + <span class="Constant">17</span><span class="Special"> <- </span><span class="Constant">0</span> ] ] |