diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-01-26 23:47:23 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-01-26 23:47:23 -0800 |
commit | d009e158803956c76adbf8f58a62884c3e7affb3 (patch) | |
tree | b88198e28d15cd1fc064f5300365a190decc4c50 /html/edit/008-sandbox-test.mu.html | |
parent | 2da43c9462c7b7c1bb78d2f2826b3b97b4874973 (diff) | |
download | mu-d009e158803956c76adbf8f58a62884c3e7affb3.tar.gz |
2605
Diffstat (limited to 'html/edit/008-sandbox-test.mu.html')
-rw-r--r-- | html/edit/008-sandbox-test.mu.html | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/html/edit/008-sandbox-test.mu.html b/html/edit/008-sandbox-test.mu.html index bdf918e8..d5dbcfcb 100644 --- a/html/edit/008-sandbox-test.mu.html +++ b/html/edit/008-sandbox-test.mu.html @@ -38,22 +38,22 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } trace-until <span class="Constant">100/app</span> <span class="Comment"># trace too long</span> assume-screen <span class="Constant">40/width</span>, <span class="Constant">10/height</span> <span class="Comment"># basic recipe</span> - <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> + <span class="Constant">1</span>:address:shared:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> reply 4</span> <span class="Constant">]</span>] <span class="Comment"># run it</span> - <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[foo]</span> + <span class="Constant">2</span>:address:shared:array:character<span class="Special"> <- </span>new <span class="Constant">[foo]</span> assume-console [ press F4 ] - <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:screen, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + <span class="Constant">3</span>:address:shared:programming-environment-data<span class="Special"> <- </span>new-programming-environment screen:address:shared:screen, <span class="Constant">1</span>:address:shared:array:character, <span class="Constant">2</span>:address:shared:array:character + event-loop screen:address:shared:screen, console:address:shared:console, <span class="Constant">3</span>:address:shared:programming-environment-data screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . reply 4 ┊ x.</span> + <span class="Constant"> . reply 4 ┊0 x.</span> <span class="Constant"> .] ┊foo .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━.</span> @@ -64,7 +64,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } left-click <span class="Constant">5</span>, <span class="Constant">21</span> ] run [ - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + event-loop screen:address:shared:screen, console:address:shared:console, <span class="Constant">3</span>:address:shared:programming-environment-data ] <span class="Comment"># color toggles to green</span> screen-should-contain-in-color <span class="Constant">2/green</span>, [ @@ -79,13 +79,14 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } ] <span class="Comment"># cursor should remain unmoved</span> run [ - print screen:address:screen, <span class="Constant">9251/␣/cursor</span> + <span class="Constant">4</span>:character/cursor<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> + print screen:address:shared:screen, <span class="Constant">4</span>:character/cursor ] screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> .␣ ┊ .</span> <span class="Constant"> .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━.</span> - <span class="Constant"> . reply 4 ┊ x.</span> + <span class="Constant"> . reply 4 ┊0 x.</span> <span class="Constant"> .] ┊foo .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 .</span> <span class="Constant"> . ┊━━━━━━━━━━━━━━━━━━━.</span> @@ -100,7 +101,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } press F4 ] run [ - event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + event-loop screen:address:shared:screen, console:address:shared:console, <span class="Constant">3</span>:address:shared:programming-environment-data ] <span class="Comment"># result turns red</span> screen-should-contain-in-color <span class="Constant">1/red</span>, [ @@ -123,38 +124,38 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } click-column:number<span class="Special"> <- </span>get *t, <span class="Constant">column:offset</span> on-sandbox-side?:boolean<span class="Special"> <- </span>greater-or-equal click-column, sandbox-left-margin <span class="muControl">break-unless</span> on-sandbox-side? - first-sandbox:address:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + first-sandbox:address:shared:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> <span class="muControl">break-unless</span> first-sandbox first-sandbox-begins:number<span class="Special"> <- </span>get *first-sandbox, <span class="Constant">starting-row-on-screen:offset</span> click-row:number<span class="Special"> <- </span>get *t, <span class="Constant">row:offset</span> below-sandbox-editor?:boolean<span class="Special"> <- </span>greater-or-equal click-row, first-sandbox-begins <span class="muControl">break-unless</span> below-sandbox-editor? <span class="Comment"># identify the sandbox whose output is being clicked on</span> - sandbox:address:sandbox-data<span class="Special"> <- </span>find-click-in-sandbox-output env, click-row + sandbox:address:shared:sandbox-data<span class="Special"> <- </span>find-click-in-sandbox-output env, click-row <span class="muControl">break-unless</span> sandbox <span class="Comment"># toggle its expected-response, and save session</span> sandbox<span class="Special"> <- </span>toggle-expected-response sandbox save-sandboxes env hide-screen screen screen<span class="Special"> <- </span>render-sandbox-side screen, env, <span class="Constant">1/clear</span> - screen<span class="Special"> <- </span>update-cursor screen, recipes, current-sandbox, *sandbox-in-focus? + screen<span class="Special"> <- </span>update-cursor screen, recipes, current-sandbox, *sandbox-in-focus?, env <span class="Comment"># no change in cursor</span> show-screen screen <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> <span class="Delimiter">}</span> ] -<span class="muRecipe">recipe</span> find-click-in-sandbox-output env:address:programming-environment-data, click-row:number<span class="muRecipe"> -> </span>sandbox:address:sandbox-data [ +<span class="muRecipe">recipe</span> find-click-in-sandbox-output env:address:shared:programming-environment-data, click-row:number<span class="muRecipe"> -> </span>sandbox:address:shared:sandbox-data [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># assert click-row >= sandbox.starting-row-on-screen</span> - sandbox:address:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + sandbox:address:shared:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> start:number<span class="Special"> <- </span>get *sandbox, <span class="Constant">starting-row-on-screen:offset</span> clicked-on-sandboxes?:boolean<span class="Special"> <- </span>greater-or-equal click-row, start assert clicked-on-sandboxes?, <span class="Constant">[extract-sandbox called on click to sandbox editor]</span> <span class="Comment"># while click-row < sandbox.next-sandbox.starting-row-on-screen</span> <span class="Delimiter">{</span> - next-sandbox:address:sandbox-data<span class="Special"> <- </span>get *sandbox, <span class="Constant">next-sandbox:offset</span> + next-sandbox:address:shared:sandbox-data<span class="Special"> <- </span>get *sandbox, <span class="Constant">next-sandbox:offset</span> <span class="muControl">break-unless</span> next-sandbox next-start:number<span class="Special"> <- </span>get *next-sandbox, <span class="Constant">starting-row-on-screen:offset</span> found?:boolean<span class="Special"> <- </span>lesser-than click-row, next-start @@ -170,10 +171,10 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="muControl">reply</span> sandbox ] -<span class="muRecipe">recipe</span> toggle-expected-response sandbox:address:sandbox-data<span class="muRecipe"> -> </span>sandbox:address:sandbox-data [ +<span class="muRecipe">recipe</span> toggle-expected-response sandbox:address:shared:sandbox-data<span class="muRecipe"> -> </span>sandbox:address:shared:sandbox-data [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - expected-response:address:address:array:character<span class="Special"> <- </span>get-address *sandbox, <span class="Constant">expected-response:offset</span> + expected-response:address:address:shared:array:character<span class="Special"> <- </span>get-address *sandbox, <span class="Constant">expected-response:offset</span> <span class="Delimiter">{</span> <span class="Comment"># if expected-response is set, reset</span> <span class="muControl">break-unless</span> *expected-response @@ -181,7 +182,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="muControl">reply</span> sandbox/same-as-ingredient:<span class="Constant">0</span> <span class="Delimiter">}</span> <span class="Comment"># if not, current response is the expected response</span> - response:address:array:character<span class="Special"> <- </span>get *sandbox, <span class="Constant">response:offset</span> + response:address:shared:array:character<span class="Special"> <- </span>get *sandbox, <span class="Constant">response:offset</span> *expected-response<span class="Special"> <- </span>copy response ] @@ -189,7 +190,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="muRecipe">after</span> <span class="Constant"><render-sandbox-response></span> [ <span class="Delimiter">{</span> <span class="muControl">break-unless</span> sandbox-response - expected-response:address:array:character<span class="Special"> <- </span>get *sandbox, <span class="Constant">expected-response:offset</span> + expected-response:address:shared:array:character<span class="Special"> <- </span>get *sandbox, <span class="Constant">expected-response:offset</span> <span class="muControl">break-unless</span> expected-response <span class="Comment"># fall-through to print in grey</span> response-is-expected?:boolean<span class="Special"> <- </span>equal expected-response, sandbox-response <span class="Delimiter">{</span> |