diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-04-25 22:27:19 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-04-25 22:27:19 -0700 |
commit | 32b8fac2799ac7cec613e84a3eb9c009141b6a3a (patch) | |
tree | 11f56c1a235abf7b626ea8983fff3d2edb1fcf98 /html/edit/009-sandbox-trace.mu.html | |
parent | 224972ee9871fcb06ee285fa5f3d9528c034d414 (diff) | |
download | mu-32b8fac2799ac7cec613e84a3eb9c009141b6a3a.tar.gz |
2866
Diffstat (limited to 'html/edit/009-sandbox-trace.mu.html')
-rw-r--r-- | html/edit/009-sandbox-trace.mu.html | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/html/edit/009-sandbox-trace.mu.html b/html/edit/009-sandbox-trace.mu.html index 6464866c..c6d30308 100644 --- a/html/edit/009-sandbox-trace.mu.html +++ b/html/edit/009-sandbox-trace.mu.html @@ -39,17 +39,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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:shared:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> + <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> stash [abc]</span> ]] <span class="Comment"># run it</span> - <span class="Constant">2</span>:address:shared:array:character<span class="Special"> <- </span>new <span class="Constant">[foo]</span> + <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[foo]</span> assume-console [ press F4 ] - <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 + <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 screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -64,9 +64,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">4</span>, <span class="Constant">21</span> ] run [ - event-loop screen:address:shared:screen, console:address:shared:console, <span class="Constant">3</span>:address:shared:programming-environment-data + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data <span class="Constant">4</span>:character/cursor-icon<span class="Special"> <- </span>copy <span class="Constant">9251/␣</span> - print screen:address:shared:screen, <span class="Constant">4</span>:character/cursor-icon + print screen:address:screen, <span class="Constant">4</span>:character/cursor-icon ] <span class="Comment"># trace now printed and cursor shouldn't have budged</span> screen-should-contain [ @@ -94,8 +94,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">4</span>, <span class="Constant">25</span> ] run [ - event-loop screen:address:shared:screen, console:address:shared:console, <span class="Constant">3</span>:address:shared:programming-environment-data - print screen:address:shared:screen, <span class="Constant">4</span>:character/cursor-icon + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data + print screen:address:screen, <span class="Constant">4</span>:character/cursor-icon ] <span class="Comment"># trace hidden again</span> screen-should-contain [ @@ -113,18 +113,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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:shared:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> + <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ </span> <span class="Constant">recipe foo [</span> <span class="Constant"> stash [abc]</span> <span class="muControl">reply</span> <span class="Constant">4</span> ]] <span class="Comment"># run it</span> - <span class="Constant">2</span>:address:shared:array:character<span class="Special"> <- </span>new <span class="Constant">[foo]</span> + <span class="Constant">2</span>:address:array:character<span class="Special"> <- </span>new <span class="Constant">[foo]</span> assume-console [ press F4 ] - <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 + <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 screen-should-contain [ <span class="Constant"> . run (F4) .</span> <span class="Constant"> . ┊ .</span> @@ -140,7 +140,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color left-click <span class="Constant">4</span>, <span class="Constant">21</span> ] run [ - event-loop screen:address:shared:screen, console:address:shared:console, <span class="Constant">3</span>:address:shared:programming-environment-data + event-loop screen:address:screen, console:address:console, <span class="Constant">3</span>:address:programming-environment-data ] <span class="Comment"># trace now printed above result</span> screen-should-contain [ @@ -157,19 +157,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muData">container</span> sandbox-data [ - trace:address:shared:array:character + trace:address:array:character display-trace?:boolean ] <span class="Comment"># replaced in a later layer</span> -<span class="muRecipe">def!</span> update-sandbox sandbox:address:shared:sandbox-data, env:address:shared:programming-environment-data, idx:number<span class="muRecipe"> -> </span>sandbox:address:shared:sandbox-data, env:address:shared:programming-environment-data [ +<span class="muRecipe">def!</span> update-sandbox sandbox:address:sandbox-data, env:address:programming-environment-data, idx:number<span class="muRecipe"> -> </span>sandbox:address:sandbox-data, env:address:programming-environment-data [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - data:address:shared:array:character<span class="Special"> <- </span>get *sandbox, <span class="Constant">data:offset</span> - response:address:address:shared:array:character<span class="Special"> <- </span>get-address *sandbox, <span class="Constant">response:offset</span> - trace:address:address:shared:array:character<span class="Special"> <- </span>get-address *sandbox, <span class="Constant">trace:offset</span> - fake-screen:address:address:shared:screen<span class="Special"> <- </span>get-address *sandbox, <span class="Constant">screen:offset</span> - *response, _, *fake-screen, *trace<span class="Special"> <- </span>run-interactive data + data:address:array:character<span class="Special"> <- </span>get *sandbox, <span class="Constant">data:offset</span> + response:address:array:character, _, fake-screen:address:screen, trace:address:array:character<span class="Special"> <- </span>run-interactive data + *sandbox<span class="Special"> <- </span>put *sandbox, <span class="Constant">response:offset</span>, response + *sandbox<span class="Special"> <- </span>put *sandbox, <span class="Constant">screen:offset</span>, fake-screen + *sandbox<span class="Special"> <- </span>put *sandbox, <span class="Constant">trace:offset</span>, trace ] <span class="Comment"># clicks on sandbox code toggle its display-trace? flag</span> @@ -177,31 +177,32 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># check if it's inside the code of any sandbox</span> <span class="Delimiter">{</span> sandbox-left-margin:number<span class="Special"> <- </span>get *current-sandbox, <span class="Constant">left:offset</span> - click-column:number<span class="Special"> <- </span>get *t, <span class="Constant">column:offset</span> + 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:shared:sandbox-data<span class="Special"> <- </span>get *env, <span class="Constant">sandbox:offset</span> + first-sandbox:address: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> + 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 code is being clicked on</span> - sandbox:address:shared:sandbox-data<span class="Special"> <- </span>find-click-in-sandbox-code env, click-row + sandbox:address:sandbox-data<span class="Special"> <- </span>find-click-in-sandbox-code env, click-row <span class="muControl">break-unless</span> sandbox <span class="Comment"># toggle its display-trace? property</span> - x:address:boolean<span class="Special"> <- </span>get-address *sandbox, <span class="Constant">display-trace?:offset</span> - *x<span class="Special"> <- </span>not *x + x:boolean<span class="Special"> <- </span>get *sandbox, <span class="Constant">display-trace?:offset</span> + x<span class="Special"> <- </span>not x + *sandbox<span class="Special"> <- </span>put *sandbox, <span class="Constant">display-trace?:offset</span>, x 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?, env + 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">def</span> find-click-in-sandbox-code env:address:shared:programming-environment-data, click-row:number<span class="muRecipe"> -> </span>sandbox:address:shared:sandbox-data [ +<span class="muRecipe">def</span> find-click-in-sandbox-code env:address:programming-environment-data, click-row:number<span class="muRecipe"> -> </span>sandbox:address: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> @@ -211,7 +212,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color 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:shared:sandbox-data<span class="Special"> <- </span>get *sandbox, <span class="Constant">next-sandbox:offset</span> + next-sandbox:address: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 @@ -237,7 +238,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">{</span> display-trace?:boolean<span class="Special"> <- </span>get *sandbox, <span class="Constant">display-trace?:offset</span> <span class="muControl">break-unless</span> display-trace? - sandbox-trace:address:shared:array:character<span class="Special"> <- </span>get *sandbox, <span class="Constant">trace:offset</span> + sandbox-trace:address:array:character<span class="Special"> <- </span>get *sandbox, <span class="Constant">trace:offset</span> <span class="muControl">break-unless</span> sandbox-trace <span class="Comment"># nothing to print; move on</span> row, screen<span class="Special"> <- </span>render screen, sandbox-trace, left, right, <span class="Constant">245/grey</span>, row <span class="Delimiter">}</span> |