diff options
Diffstat (limited to 'html')
-rw-r--r-- | html/036refcount.cc.html | 7 | ||||
-rw-r--r-- | html/042name.cc.html | 12 | ||||
-rw-r--r-- | html/083scenario_screen_test.mu.html | 10 | ||||
-rw-r--r-- | html/chessboard.mu.html | 192 |
4 files changed, 120 insertions, 101 deletions
diff --git a/html/036refcount.cc.html b/html/036refcount.cc.html index 66136c91..e456934b 100644 --- a/html/036refcount.cc.html +++ b/html/036refcount.cc.html @@ -169,15 +169,12 @@ element<span class="Delimiter">.</span>value = address<span class="Delimiter">;< <span class="Delimiter">:(scenario refcounts_put_index)</span> def main [ <span class="Constant">1</span>:address:number<span class="Special"> <- </span><span class="Normal">new</span> number:type - <span class="Comment"># fake array because we can't yet create an array of addresses (wait for the</span> - <span class="Comment"># support for dilated reagents and parsing more complex type trees)</span> - <span class="Constant">1003</span>:number/<span class="Special">raw <- </span>copy <span class="Constant">3</span> <span class="Comment"># skip refcount at 1002</span> - <span class="Constant">2</span>:address:array:address:number<span class="Special"> <- </span>copy <span class="Constant">1002</span>/unsafe + <span class="Constant">2</span>:address:array:address:number<span class="Special"> <- </span><span class="Normal">new</span> <span class="Delimiter">{(</span>address number<span class="Delimiter">)</span>: type<span class="Delimiter">},</span> <span class="Constant">3</span> *<span class="Constant">2</span>:address:array:address:number<span class="Special"> <- </span>put-index *<span class="Constant">2</span>:address:array:address:number<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">1</span>:address:number ] <span class="traceContains">+run: {1: ("address" "number")} <- new {number: "type"}</span> <span class="traceContains">+mem: incrementing refcount of 1000: 0 -> 1</span> -<span class="traceContains">+run: {2: ("address" "array" "address" "number")} <- copy {1002: "literal", "unsafe": ()}</span> +<span class="traceContains">+run: {2: ("address" "array" "address" "number")} <- new {(address number): "type"}, {3: "literal"}</span> <span class="traceContains">+mem: incrementing refcount of 1002: 0 -> 1</span> <span class="traceContains">+run: {2: ("address" "array" "address" "number"), "lookup": ()} <- put-index {2: ("address" "array" "address" "number"), "lookup": ()}, {0: "literal"}, {1: ("address" "number")}</span> <span class="Comment"># put-index increments refcount</span> diff --git a/html/042name.cc.html b/html/042name.cc.html index 6067e28c..5b8dc773 100644 --- a/html/042name.cc.html +++ b/html/042name.cc.html @@ -96,6 +96,12 @@ Name = Name_snapshot<span class="Delimiter">;</span> <span class="Normal">int</span> v = lookup_name<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>in<span class="Delimiter">),</span> r<span class="Delimiter">);</span> <span class="Normal">if</span> <span class="Delimiter">(</span>v >= <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>in<span class="Delimiter">).</span>set_value<span class="Delimiter">(</span>v<span class="Delimiter">);</span> + <span class="Comment">// HACK: belongs in a later layer, either in the scenario layer which</span> + <span class="Comment">// introduces the 'run' pseudo-instruction which is translated to</span> + <span class="Comment">// run_* recipes, or later when we start using screens and consoles in</span> + <span class="Comment">// scenarios.</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>is_special_name<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>in<span class="Delimiter">).</span>name<span class="Delimiter">)</span> && caller<span class="Delimiter">.</span>name<span class="Delimiter">.</span>substr<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">4</span><span class="Delimiter">)</span> == <span class="Constant">"run_"</span><span class="Delimiter">)</span> + inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>in<span class="Delimiter">).</span>properties<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>pair<string<span class="Delimiter">,</span> string_tree*><span class="Delimiter">(</span><span class="Constant">"raw"</span><span class="Delimiter">,</span> <span class="Constant">NULL</span><span class="Delimiter">));</span> <span class="Delimiter">}</span> <span class="Normal">else</span> <span class="Delimiter">{</span> raise << maybe<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"can't find a place to store '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>in<span class="Delimiter">).</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> @@ -115,6 +121,12 @@ Name = Name_snapshot<span class="Delimiter">;</span> <span class="Normal">int</span> v = lookup_name<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>out<span class="Delimiter">),</span> r<span class="Delimiter">);</span> <span class="Normal">if</span> <span class="Delimiter">(</span>v >= <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>out<span class="Delimiter">).</span>set_value<span class="Delimiter">(</span>v<span class="Delimiter">);</span> + <span class="Comment">// HACK: belongs in a later layer, either in the scenario layer which</span> + <span class="Comment">// introduces the 'run' pseudo-instruction which is translated to</span> + <span class="Comment">// run_* recipes, or later when we start using screens and consoles in</span> + <span class="Comment">// scenarios.</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>is_special_name<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>out<span class="Delimiter">).</span>name<span class="Delimiter">)</span> && caller<span class="Delimiter">.</span>name<span class="Delimiter">.</span>substr<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">4</span><span class="Delimiter">)</span> == <span class="Constant">"run_"</span><span class="Delimiter">)</span> + inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>out<span class="Delimiter">).</span>properties<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>pair<string<span class="Delimiter">,</span> string_tree*><span class="Delimiter">(</span><span class="Constant">"raw"</span><span class="Delimiter">,</span> <span class="Constant">NULL</span><span class="Delimiter">));</span> <span class="Delimiter">}</span> <span class="Normal">else</span> <span class="Delimiter">{</span> raise << maybe<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"can't find a place to store '"</span> << inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>out<span class="Delimiter">).</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> diff --git a/html/083scenario_screen_test.mu.html b/html/083scenario_screen_test.mu.html index 63afa9bf..adeb5b93 100644 --- a/html/083scenario_screen_test.mu.html +++ b/html/083scenario_screen_test.mu.html @@ -33,8 +33,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> print-character-at-top-left-2 [ assume-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span> run [ - <span class="Constant">1</span>:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> - screen:address:screen<span class="Special"> <- </span>print screen:address:screen, <span class="Constant">1</span>:character/a + <span class="Constant">local-scope</span> + a:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> + screen:address:screen<span class="Special"> <- </span>print screen:address:screen, a ] screen-should-contain [ <span class="Constant"> .a .</span> @@ -45,9 +46,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> clear-line-erases-printed-characters-2 [ assume-screen <span class="Constant">5/width</span>, <span class="Constant">3/height</span> run [ + <span class="Constant">local-scope</span> <span class="Comment"># print a character</span> - <span class="Constant">1</span>:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> - screen:address:screen<span class="Special"> <- </span>print screen:address:screen, <span class="Constant">1</span>:character/a + a:character<span class="Special"> <- </span>copy <span class="Constant">97/a</span> + screen:address:screen<span class="Special"> <- </span>print screen:address:screen, a <span class="Comment"># move cursor to start of line</span> screen:address:screen<span class="Special"> <- </span>move-cursor screen:address:screen, <span class="Constant">0/row</span>, <span class="Constant">0/column</span> <span class="Comment"># clear line</span> diff --git a/html/chessboard.mu.html b/html/chessboard.mu.html index aa237058..0b583444 100644 --- a/html/chessboard.mu.html +++ b/html/chessboard.mu.html @@ -64,10 +64,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">]</span> ] run [ + <span class="Constant">local-scope</span> screen:address:screen, console:address:console<span class="Special"> <- </span>chessboard screen:address:screen, console:address:console <span class="Comment"># icon for the cursor</span> - <span class="Constant">1</span>:character/cursor-icon<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - screen<span class="Special"> <- </span>print screen, <span class="Constant">1</span>:character/cursor-icon + cursor-icon:character<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + screen<span class="Special"> <- </span>print screen, cursor-icon ] screen-should-contain [ <span class="Comment"># 1 2 3 4 5 6 7 8 9 10 11</span> @@ -234,8 +235,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> printing-the-board [ assume-screen <span class="Constant">30/width</span>, <span class="Constant">12/height</span> run [ - <span class="Constant">1</span>:address:array:address:array:character/board<span class="Special"> <- </span>initial-position - screen:address:screen<span class="Special"> <- </span>print-board screen:address:screen, <span class="Constant">1</span>:address:array:address:array:character/board + <span class="Constant">local-scope</span> + board:address:array:address:array:character<span class="Special"> <- </span>initial-position + screen:address:screen<span class="Special"> <- </span>print-board screen:address:screen, board ] screen-should-contain [ <span class="Comment"># 012345678901234567890123456789</span> @@ -398,67 +400,68 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> read-move-blocking [ assume-screen <span class="Constant">20/width</span>, <span class="Constant">2/height</span> run [ - <span class="Constant">1</span>:address:source:character, <span class="Constant">2</span>:address:sink:character<span class="Special"> <- </span>new-channel <span class="Constant">2/capacity</span> - <span class="Constant">3</span>:number/routine<span class="Special"> <- </span>start-running read-move, <span class="Constant">1</span>:address:source:character, screen:address:screen + <span class="Constant">local-scope</span> + source:address:source:character, sink:address:sink:character<span class="Special"> <- </span>new-channel <span class="Constant">2/capacity</span> + read-move-routine:number/routine<span class="Special"> <- </span>start-running read-move, source, screen:address:screen <span class="Comment"># 'read-move' is waiting for input</span> - wait-for-routine <span class="Constant">3</span>:number - <span class="Constant">4</span>:number<span class="Special"> <- </span>routine-state <span class="Constant">3</span>:number/id - <span class="Constant">5</span>:boolean/waiting?<span class="Special"> <- </span>equal <span class="Constant">4</span>:number/routine-state, <span class="Constant">3/waiting</span> - assert <span class="Constant">5</span>:boolean/waiting?, <span class="Constant">[ </span> + wait-for-routine read-move-routine + read-move-state:number<span class="Special"> <- </span>routine-state read-move-routine + waiting?:boolean<span class="Special"> <- </span>equal read-move-state, <span class="Constant">3/waiting</span> + assert waiting?, <span class="Constant">[ </span> <span class="Constant">F read-move-blocking: routine failed to pause after coming up (before any keys were pressed)]</span> <span class="Comment"># press '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">3</span>:number/routine + sink<span class="Special"> <- </span>write sink, <span class="Constant">97/a</span> + restart read-move-routine <span class="Comment"># 'read-move' still waiting for input</span> - wait-for-routine <span class="Constant">3</span>:number - <span class="Constant">4</span>:number<span class="Special"> <- </span>routine-state <span class="Constant">3</span>:number/id - <span class="Constant">5</span>:boolean/waiting?<span class="Special"> <- </span>equal <span class="Constant">4</span>:number/routine-state, <span class="Constant">3/waiting</span> - assert <span class="Constant">5</span>:boolean/waiting?, <span class="Constant">[ </span> + wait-for-routine read-move-routine + read-move-state<span class="Special"> <- </span>routine-state read-move-routine + waiting?<span class="Special"> <- </span>equal read-move-state, <span class="Constant">3/waiting</span> + assert waiting?, <span class="Constant">[ </span> <span class="Constant">F read-move-blocking: routine failed to pause after rank 'a']</span> <span class="Comment"># press '2'</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">50/'2'</span> - restart <span class="Constant">3</span>:number/routine + sink<span class="Special"> <- </span>write sink, <span class="Constant">50/'2'</span> + restart read-move-routine <span class="Comment"># 'read-move' still waiting for input</span> - wait-for-routine <span class="Constant">3</span>:number - <span class="Constant">4</span>:number<span class="Special"> <- </span>routine-state <span class="Constant">3</span>:number/id - <span class="Constant">5</span>:boolean/waiting?<span class="Special"> <- </span>equal <span class="Constant">4</span>:number/routine-state, <span class="Constant">3/waiting</span> - assert <span class="Constant">5</span>:boolean/waiting?, <span class="Constant">[ </span> + wait-for-routine read-move-routine + read-move-state<span class="Special"> <- </span>routine-state read-move-routine + waiting?<span class="Special"> <- </span>equal read-move-state, <span class="Constant">3/waiting</span> + assert waiting?, <span class="Constant">[ </span> <span class="Constant">F read-move-blocking: routine failed to pause after file 'a2']</span> <span class="Comment"># press '-'</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">45/'-'</span> - restart <span class="Constant">3</span>:number/routine + sink<span class="Special"> <- </span>write sink, <span class="Constant">45/'-'</span> + restart read-move-routine <span class="Comment"># 'read-move' still waiting for input</span> - wait-for-routine <span class="Constant">3</span>:number - <span class="Constant">4</span>:number<span class="Special"> <- </span>routine-state <span class="Constant">3</span>:number - <span class="Constant">5</span>:boolean/waiting?<span class="Special"> <- </span>equal <span class="Constant">4</span>:number/routine-state, <span class="Constant">3/waiting</span> - assert <span class="Constant">5</span>:boolean/waiting?/routine-state, <span class="Constant">[ </span> + wait-for-routine read-move-routine + read-move-state<span class="Special"> <- </span>routine-state read-move-routine + waiting?<span class="Special"> <- </span>equal read-move-state, <span class="Constant">3/waiting</span> + assert waiting?, <span class="Constant">[ </span> <span class="Constant">F read-move-blocking: routine failed to pause after hyphen 'a2-']</span> <span class="Comment"># press '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">3</span>:number/routine + sink<span class="Special"> <- </span>write sink, <span class="Constant">97/a</span> + restart read-move-routine <span class="Comment"># 'read-move' still waiting for input</span> - wait-for-routine <span class="Constant">3</span>:number - <span class="Constant">4</span>:number<span class="Special"> <- </span>routine-state <span class="Constant">3</span>:number - <span class="Constant">5</span>:boolean/waiting?<span class="Special"> <- </span>equal <span class="Constant">4</span>:number/routine-state, <span class="Constant">3/waiting</span> - assert <span class="Constant">5</span>:boolean/waiting?/routine-state, <span class="Constant">[ </span> + wait-for-routine read-move-routine + read-move-state<span class="Special"> <- </span>routine-state read-move-routine + waiting?<span class="Special"> <- </span>equal read-move-state, <span class="Constant">3/waiting</span> + assert waiting?, <span class="Constant">[ </span> <span class="Constant">F read-move-blocking: routine failed to pause after rank 'a2-a']</span> <span class="Comment"># press '4'</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">52/'4'</span> - restart <span class="Constant">3</span>:number/routine + sink<span class="Special"> <- </span>write sink, <span class="Constant">52/'4'</span> + restart read-move-routine <span class="Comment"># 'read-move' still waiting for input</span> - wait-for-routine <span class="Constant">3</span>:number - <span class="Constant">4</span>:number<span class="Special"> <- </span>routine-state <span class="Constant">3</span>:number - <span class="Constant">5</span>:boolean/waiting?<span class="Special"> <- </span>equal <span class="Constant">4</span>:number/routine-state, <span class="Constant">3/waiting</span> - assert <span class="Constant">5</span>:boolean/waiting?, <span class="Constant">[ </span> + wait-for-routine read-move-routine + read-move-state<span class="Special"> <- </span>routine-state read-move-routine + waiting?<span class="Special"> <- </span>equal read-move-state, <span class="Constant">3/waiting</span> + assert waiting?, <span class="Constant">[ </span> <span class="Constant">F read-move-blocking: routine failed to pause after file 'a2-a4']</span> <span class="Comment"># press '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</span> <span class="Comment"># newline</span> - restart <span class="Constant">3</span>:number/routine + sink<span class="Special"> <- </span>write sink, <span class="Constant">10</span> <span class="Comment"># newline</span> + restart read-move-routine <span class="Comment"># 'read-move' now completes</span> - wait-for-routine <span class="Constant">3</span>:number - <span class="Constant">4</span>:number<span class="Special"> <- </span>routine-state <span class="Constant">3</span>:number - <span class="Constant">5</span>:boolean/completed?<span class="Special"> <- </span>equal <span class="Constant">4</span>:number/routine-state, <span class="Constant">1/completed</span> - assert <span class="Constant">5</span>:boolean/completed?, <span class="Constant">[ </span> + wait-for-routine read-move-routine + read-move-state<span class="Special"> <- </span>routine-state read-move-routine + completed?:boolean<span class="Special"> <- </span>equal read-move-state, <span class="Constant">1/completed</span> + assert completed?, <span class="Constant">[ </span> <span class="Constant">F read-move-blocking: routine failed to terminate on newline]</span> trace <span class="Constant">1</span>, <span class="Constant">[test]</span>, <span class="Constant">[reached end]</span> ] @@ -470,22 +473,23 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> read-move-quit [ assume-screen <span class="Constant">20/width</span>, <span class="Constant">2/height</span> run [ - <span class="Constant">1</span>:address:source:character, <span class="Constant">2</span>:address:sink:character<span class="Special"> <- </span>new-channel <span class="Constant">2/capacity</span> - <span class="Constant">3</span>:number/routine<span class="Special"> <- </span>start-running read-move, <span class="Constant">1</span>:address:channel:character, screen:address:screen + <span class="Constant">local-scope</span> + source:address:source:character, sink:address:sink:character<span class="Special"> <- </span>new-channel <span class="Constant">2/capacity</span> + read-move-routine:number<span class="Special"> <- </span>start-running read-move, source, screen:address:screen <span class="Comment"># 'read-move' is waiting for input</span> - wait-for-routine <span class="Constant">3</span>:number - <span class="Constant">4</span>:number<span class="Special"> <- </span>routine-state <span class="Constant">3</span>:number/id - <span class="Constant">5</span>:boolean/waiting?<span class="Special"> <- </span>equal <span class="Constant">4</span>:number/routine-state, <span class="Constant">3/waiting</span> - assert <span class="Constant">5</span>:boolean/waiting?, <span class="Constant">[ </span> + wait-for-routine read-move-routine + read-move-state:number<span class="Special"> <- </span>routine-state read-move-routine + waiting?:boolean<span class="Special"> <- </span>equal read-move-state, <span class="Constant">3/waiting</span> + assert waiting?, <span class="Constant">[ </span> <span class="Constant">F read-move-quit: routine failed to pause after coming up (before any keys were pressed)]</span> <span class="Comment"># press 'q'</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">113/q</span> - restart <span class="Constant">3</span>:number/routine + sink<span class="Special"> <- </span>write sink, <span class="Constant">113/q</span> + restart read-move-routine <span class="Comment"># 'read-move' completes</span> - wait-for-routine <span class="Constant">3</span>:number - <span class="Constant">4</span>:number<span class="Special"> <- </span>routine-state <span class="Constant">3</span>:number/id - <span class="Constant">5</span>:boolean/completed?<span class="Special"> <- </span>equal <span class="Constant">4</span>:number/routine-state, <span class="Constant">1/completed</span> - assert <span class="Constant">5</span>:boolean/completed?, <span class="Constant">[ </span> + wait-for-routine read-move-routine + read-move-state<span class="Special"> <- </span>routine-state read-move-routine + completed?:boolean<span class="Special"> <- </span>equal read-move-state, <span class="Constant">1/completed</span> + assert completed?, <span class="Constant">[ </span> <span class="Constant">F read-move-quit: routine failed to terminate on 'q']</span> trace <span class="Constant">1</span>, <span class="Constant">[test]</span>, <span class="Constant">[reached end]</span> ] @@ -497,17 +501,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> read-move-illegal-file [ assume-screen <span class="Constant">20/width</span>, <span class="Constant">2/height</span> run [ - <span class="Constant">1</span>:address:source:character, <span class="Constant">2</span>:address:sink:character<span class="Special"> <- </span>new-channel <span class="Constant">2/capacity</span> - <span class="Constant">3</span>:number/routine<span class="Special"> <- </span>start-running read-move, <span class="Constant">1</span>:address:source:character, screen:address:screen + <span class="Constant">local-scope</span> + source:address:source:character, sink:address:sink:character<span class="Special"> <- </span>new-channel <span class="Constant">2/capacity</span> + read-move-routine:number<span class="Special"> <- </span>start-running read-move, source, screen:address:screen <span class="Comment"># 'read-move' is waiting for input</span> - wait-for-routine <span class="Constant">3</span>:number - <span class="Constant">4</span>:number<span class="Special"> <- </span>routine-state <span class="Constant">3</span>:number/id - <span class="Constant">5</span>:boolean/waiting?<span class="Special"> <- </span>equal <span class="Constant">4</span>:number/routine-state, <span class="Constant">3/waiting</span> - assert <span class="Constant">5</span>:boolean/waiting?, <span class="Constant">[ </span> + wait-for-routine read-move-routine + read-move-state:number<span class="Special"> <- </span>routine-state read-move-routine + waiting?:boolean<span class="Special"> <- </span>equal read-move-state, <span class="Constant">3/waiting</span> + assert waiting?, <span class="Constant">[ </span> <span class="Constant">F read-move-file: routine failed to pause after coming up (before any keys were pressed)]</span> - <span class="Constant">1</span>:address:sink:character<span class="Special"> <- </span>write <span class="Constant">1</span>:address:sink:character, <span class="Constant">50/'2'</span> - restart <span class="Constant">3</span>:number/routine - wait-for-routine <span class="Constant">3</span>:number + sink<span class="Special"> <- </span>write sink, <span class="Constant">50/'2'</span> + restart read-move-routine + wait-for-routine read-move-routine ] screen-should-contain [ <span class="Constant"> .file too low: 2 .</span> @@ -518,18 +523,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> read-move-illegal-rank [ assume-screen <span class="Constant">20/width</span>, <span class="Constant">2/height</span> run [ - <span class="Constant">1</span>:address:source:character, <span class="Constant">2</span>:address:sink:character<span class="Special"> <- </span>new-channel <span class="Constant">2/capacity</span> - <span class="Constant">3</span>:number/routine<span class="Special"> <- </span>start-running read-move, <span class="Constant">1</span>:address:source:character, screen:address:screen + <span class="Constant">local-scope</span> + source:address:source:character, sink:address:sink:character<span class="Special"> <- </span>new-channel <span class="Constant">2/capacity</span> + read-move-routine:number<span class="Special"> <- </span>start-running read-move, source, screen:address:screen <span class="Comment"># 'read-move' is waiting for input</span> - wait-for-routine <span class="Constant">3</span>:number - <span class="Constant">4</span>:number<span class="Special"> <- </span>routine-state <span class="Constant">3</span>:number/id - <span class="Constant">5</span>:boolean/waiting?<span class="Special"> <- </span>equal <span class="Constant">4</span>:number/routine-state, <span class="Constant">3/waiting</span> - assert <span class="Constant">5</span>:boolean/waiting?, <span class="Constant">[ </span> + wait-for-routine read-move-routine + read-move-state:number<span class="Special"> <- </span>routine-state read-move-routine + waiting?:boolean<span class="Special"> <- </span>equal read-move-state, <span class="Constant">3/waiting</span> + assert waiting?, <span class="Constant">[ </span> <span class="Constant">F read-move-file: routine failed to pause after coming up (before any keys were pressed)]</span> - <span class="Constant">1</span>:address:sink:character<span class="Special"> <- </span>write <span class="Constant">1</span>:address:sink:character, <span class="Constant">97/a</span> - <span class="Constant">1</span>:address:sink:character<span class="Special"> <- </span>write <span class="Constant">1</span>:address:sink:character, <span class="Constant">97/a</span> - restart <span class="Constant">3</span>:number/routine - wait-for-routine <span class="Constant">3</span>:number + sink<span class="Special"> <- </span>write sink, <span class="Constant">97/a</span> + sink<span class="Special"> <- </span>write sink, <span class="Constant">97/a</span> + restart read-move-routine + wait-for-routine read-move-routine ] screen-should-contain [ <span class="Constant"> .rank too high: a .</span> @@ -540,18 +546,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> read-move-empty [ assume-screen <span class="Constant">20/width</span>, <span class="Constant">2/height</span> run [ - <span class="Constant">1</span>:address:source:character, <span class="Constant">2</span>:address:sink:character<span class="Special"> <- </span>new-channel <span class="Constant">2/capacity</span> - <span class="Constant">3</span>:number/routine<span class="Special"> <- </span>start-running read-move, <span class="Constant">1</span>:address:source:character, screen:address:screen + <span class="Constant">local-scope</span> + source:address:source:character, sink:address:sink:character<span class="Special"> <- </span>new-channel <span class="Constant">2/capacity</span> + read-move-routine:number<span class="Special"> <- </span>start-running read-move, source, screen:address:screen <span class="Comment"># 'read-move' is waiting for input</span> - wait-for-routine <span class="Constant">3</span>:number - <span class="Constant">4</span>:number<span class="Special"> <- </span>routine-state <span class="Constant">3</span>:number/id - <span class="Constant">5</span>:boolean/waiting?<span class="Special"> <- </span>equal <span class="Constant">4</span>:number/routine-state, <span class="Constant">3/waiting</span> - assert <span class="Constant">5</span>:boolean/waiting?, <span class="Constant">[ </span> + wait-for-routine read-move-routine + read-move-state:number<span class="Special"> <- </span>routine-state read-move-routine + waiting?:boolean<span class="Special"> <- </span>equal read-move-state, <span class="Constant">3/waiting</span> + assert waiting?, <span class="Constant">[ </span> <span class="Constant">F read-move-file: routine failed to pause after coming up (before any keys were pressed)]</span> - <span class="Constant">1</span>:address:sink:character<span class="Special"> <- </span>write <span class="Constant">1</span>:address:sink:character, <span class="Constant">10/newline</span> - <span class="Constant">1</span>:address:sink:character<span class="Special"> <- </span>write <span class="Constant">1</span>:address:sink:character, <span class="Constant">97/a</span> - restart <span class="Constant">3</span>:number/routine - wait-for-routine <span class="Constant">3</span>:number + sink<span class="Special"> <- </span>write sink, <span class="Constant">10/newline</span> + sink<span class="Special"> <- </span>write sink, <span class="Constant">97/a</span> + restart read-move-routine + wait-for-routine read-move-routine ] screen-should-contain [ <span class="Constant"> .that's not enough .</span> @@ -576,11 +583,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> making-a-move [ assume-screen <span class="Constant">30/width</span>, <span class="Constant">12/height</span> run [ - <span class="Constant">2</span>:address:array:address:array:character/board<span class="Special"> <- </span>initial-position - <span class="Constant">3</span>:address:move<span class="Special"> <- </span>new <span class="Constant">move:type</span> - *<span class="Constant">3</span>:address:move<span class="Special"> <- </span>merge <span class="Constant">6/g</span>, <span class="Constant">1/'2'</span>, <span class="Constant">6/g</span>, <span class="Constant">3/'4'</span> - <span class="Constant">2</span>:address:array:address:array:character/board<span class="Special"> <- </span>make-move <span class="Constant">2</span>:address:array:address:array:character/board, <span class="Constant">3</span>:address:move - screen:address:screen<span class="Special"> <- </span>print-board screen:address:screen, <span class="Constant">2</span>:address:array:address:array:character/board + <span class="Constant">local-scope</span> + board:address:array:address:array:character<span class="Special"> <- </span>initial-position + move:address:move<span class="Special"> <- </span>new <span class="Constant">move:type</span> + *move<span class="Special"> <- </span>merge <span class="Constant">6/g</span>, <span class="Constant">1/'2'</span>, <span class="Constant">6/g</span>, <span class="Constant">3/'4'</span> + board<span class="Special"> <- </span>make-move board, move + screen:address:screen<span class="Special"> <- </span>print-board screen:address:screen, board ] screen-should-contain [ <span class="Comment"># 012345678901234567890123456789</span> |