diff options
Diffstat (limited to 'html/edit/002-typing.mu.html')
-rw-r--r-- | html/edit/002-typing.mu.html | 91 |
1 files changed, 41 insertions, 50 deletions
diff --git a/html/edit/002-typing.mu.html b/html/edit/002-typing.mu.html index e36c71db..5b7d7872 100644 --- a/html/edit/002-typing.mu.html +++ b/html/edit/002-typing.mu.html @@ -3,41 +3,33 @@ <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Mu - edit/002-typing.mu</title> -<meta name="Generator" content="Vim/7.4"> -<meta name="plugin-version" content="vim7.4_v1"> +<meta name="Generator" content="Vim/7.3"> +<meta name="plugin-version" content="vim7.3_v6"> <meta name="syntax" content="none"> -<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy="> -<meta name="colorscheme" content="minimal"> +<meta name="settings" content="use_css"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } +pre { font-family: monospace; color: #eeeeee; background-color: #080808; } body { font-family: monospace; color: #eeeeee; background-color: #080808; } -* { font-size: 1.05em; } +.muData { color: #ffff00; } +.muScenario { color: #00af00; } .muControl { color: #c0a020; } -.muRecipe { color: #ff8700; } +.Delimiter { color: #a04060; } .Special { color: #ff6060; } -.muData { color: #ffff00; } -.Comment { color: #9090ff; } .Constant { color: #00a0a0; } +.muRecipe { color: #ff8700; } +.Comment { color: #9090ff; } .SalientComment { color: #00ffff; } -.Delimiter { color: #a04060; } -.muScenario { color: #00af00; } --> </style> - -<script type='text/javascript'> -<!-- - ---> -</script> </head> <body> -<pre id='vimCodeElement'> +<pre> <span class="SalientComment">## handling events from the keyboard, mouse, touch screen, ...</span> <span class="Comment"># temporary main: interactive editor</span> <span class="Comment"># hit ctrl-c to exit</span> -<span class="muRecipe">recipe!</span> main text:address:shared:array:character [ +<span class="muRecipe">def!</span> main text:address:shared:array:character [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> open-console @@ -46,7 +38,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } close-console ] -<span class="muRecipe">recipe</span> editor-event-loop screen:address:shared:screen, console:address:shared:console, editor:address:shared:editor-data<span class="muRecipe"> -> </span>screen:address:shared:screen, console:address:shared:console, editor:address:shared:editor-data [ +<span class="muRecipe">def</span> editor-event-loop screen:address:shared:screen, console:address:shared:console, editor:address:shared:editor-data<span class="muRecipe"> -> </span>screen:address:shared:screen, console:address:shared:console, editor:address:shared:editor-data [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Delimiter">{</span> @@ -80,35 +72,35 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } ] <span class="Comment"># process click, return if it was on current editor</span> -<span class="muRecipe">recipe</span> move-cursor-in-editor screen:address:shared:screen, editor:address:shared:editor-data, t:touch-event<span class="muRecipe"> -> </span>in-focus?:boolean, editor:address:shared:editor-data [ +<span class="muRecipe">def</span> move-cursor-in-editor screen:address:shared:screen, editor:address:shared:editor-data, t:touch-event<span class="muRecipe"> -> </span>in-focus?:boolean, editor:address:shared:editor-data [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - <span class="muControl">reply-unless</span> editor, <span class="Constant">0/false</span> + <span class="muControl">return-unless</span> editor, <span class="Constant">0/false</span> click-row:number<span class="Special"> <- </span>get t, <span class="Constant">row:offset</span> - <span class="muControl">reply-unless</span> click-row, <span class="Constant">0/false</span> <span class="Comment"># ignore clicks on 'menu'</span> + <span class="muControl">return-unless</span> click-row, <span class="Constant">0/false</span> <span class="Comment"># ignore clicks on 'menu'</span> click-column:number<span class="Special"> <- </span>get t, <span class="Constant">column:offset</span> left:number<span class="Special"> <- </span>get *editor, <span class="Constant">left:offset</span> too-far-left?:boolean<span class="Special"> <- </span>lesser-than click-column, left - <span class="muControl">reply-if</span> too-far-left?, <span class="Constant">0/false</span> + <span class="muControl">return-if</span> too-far-left?, <span class="Constant">0/false</span> right:number<span class="Special"> <- </span>get *editor, <span class="Constant">right:offset</span> too-far-right?:boolean<span class="Special"> <- </span>greater-than click-column, right - <span class="muControl">reply-if</span> too-far-right?, <span class="Constant">0/false</span> + <span class="muControl">return-if</span> too-far-right?, <span class="Constant">0/false</span> <span class="Comment"># position cursor</span> <span class="Constant"> <move-cursor-begin></span> editor<span class="Special"> <- </span>snap-cursor screen, editor, click-row, click-column undo-coalesce-tag:number<span class="Special"> <- </span>copy <span class="Constant">0/never</span> <span class="Constant"> <move-cursor-end></span> <span class="Comment"># gain focus</span> - <span class="muControl">reply</span> <span class="Constant">1/true</span> + <span class="muControl">return</span> <span class="Constant">1/true</span> ] <span class="Comment"># Variant of 'render' that only moves the cursor (coordinates and</span> <span class="Comment"># before-cursor). If it's past the end of a line, it 'slides' it left. If it's</span> <span class="Comment"># past the last line it positions at end of last line.</span> -<span class="muRecipe">recipe</span> snap-cursor screen:address:shared:screen, editor:address:shared:editor-data, target-row:number, target-column:number<span class="muRecipe"> -> </span>editor:address:shared:editor-data [ +<span class="muRecipe">def</span> snap-cursor screen:address:shared:screen, editor:address:shared:editor-data, target-row:number, target-column:number<span class="muRecipe"> -> </span>editor:address:shared:editor-data [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - <span class="muControl">reply-unless</span> editor + <span class="muControl">return-unless</span> editor left:number<span class="Special"> <- </span>get *editor, <span class="Constant">left:offset</span> right:number<span class="Special"> <- </span>get *editor, <span class="Constant">right:offset</span> screen-height:number<span class="Special"> <- </span>screen-height screen @@ -190,11 +182,11 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="Comment"># Process an event 'e' and try to minimally update the screen.</span> <span class="Comment"># Set 'go-render?' to true to indicate the caller must perform a non-minimal update.</span> -<span class="muRecipe">recipe</span> handle-keyboard-event screen:address:shared:screen, editor:address:shared:editor-data, e:event<span class="muRecipe"> -> </span>screen:address:shared:screen, editor:address:shared:editor-data, go-render?:boolean [ +<span class="muRecipe">def</span> handle-keyboard-event screen:address:shared:screen, editor:address:shared:editor-data, e:event<span class="muRecipe"> -> </span>screen:address:shared:screen, editor:address:shared:editor-data, go-render?:boolean [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> go-render?<span class="Special"> <- </span>copy <span class="Constant">0/false</span> - <span class="muControl">reply-unless</span> editor + <span class="muControl">return-unless</span> editor screen-width:number<span class="Special"> <- </span>screen-width screen screen-height:number<span class="Special"> <- </span>screen-height screen left:number<span class="Special"> <- </span>get *editor, <span class="Constant">left:offset</span> @@ -214,12 +206,12 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="Comment"># ignore any other special characters</span> regular-character?:boolean<span class="Special"> <- </span>greater-or-equal *c, <span class="Constant">32/space</span> go-render?<span class="Special"> <- </span>copy <span class="Constant">0/false</span> - <span class="muControl">reply-unless</span> regular-character? + <span class="muControl">return-unless</span> regular-character? <span class="Comment"># otherwise type it in</span> <span class="Constant"> <insert-character-begin></span> editor, screen, go-render?:boolean<span class="Special"> <- </span>insert-at-cursor editor, *c, screen <span class="Constant"> <insert-character-end></span> - <span class="muControl">reply</span> + <span class="muControl">return</span> <span class="Delimiter">}</span> <span class="Comment"># special key to modify the text or move the cursor</span> k:address:number<span class="Special"> <- </span>maybe-convert e:event, <span class="Constant">keycode:variant</span> @@ -227,10 +219,10 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="Comment"># handlers for each special key will go here</span> <span class="Constant"> <handle-special-key></span> go-render?<span class="Special"> <- </span>copy <span class="Constant">1/true</span> - <span class="muControl">reply</span> + <span class="muControl">return</span> ] -<span class="muRecipe">recipe</span> insert-at-cursor editor:address:shared:editor-data, c:character, screen:address:shared:screen<span class="muRecipe"> -> </span>editor:address:shared:editor-data, screen:address:shared:screen, go-render?:boolean [ +<span class="muRecipe">def</span> insert-at-cursor editor:address:shared:editor-data, c:character, screen:address:shared:screen<span class="muRecipe"> -> </span>editor:address:shared:editor-data, screen:address:shared:screen, go-render?:boolean [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> before-cursor:address:address:shared:duplex-list:character<span class="Special"> <- </span>get-address *editor, <span class="Constant">before-cursor:offset</span> @@ -261,7 +253,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } move-cursor screen, save-row, save-column print screen, c go-render?<span class="Special"> <- </span>copy <span class="Constant">0/false</span> - <span class="muControl">reply</span> + <span class="muControl">return</span> <span class="Delimiter">}</span> <span class="Delimiter">{</span> <span class="Comment"># not at right margin? print the character and rest of line</span> @@ -275,7 +267,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="Comment"># hit right margin? give up and let caller render</span> go-render?<span class="Special"> <- </span>copy <span class="Constant">1/true</span> at-right?:boolean<span class="Special"> <- </span>greater-than curr-column, right - <span class="muControl">reply-if</span> at-right? + <span class="muControl">return-if</span> at-right? <span class="muControl">break-unless</span> curr <span class="Comment"># newline? done.</span> currc:character<span class="Special"> <- </span>get *curr, <span class="Constant">value:offset</span> @@ -287,14 +279,14 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="muControl">loop</span> <span class="Delimiter">}</span> go-render?<span class="Special"> <- </span>copy <span class="Constant">0/false</span> - <span class="muControl">reply</span> + <span class="muControl">return</span> <span class="Delimiter">}</span> go-render?<span class="Special"> <- </span>copy <span class="Constant">1/true</span> - <span class="muControl">reply</span> + <span class="muControl">return</span> ] <span class="Comment"># helper for tests</span> -<span class="muRecipe">recipe</span> editor-render screen:address:shared:screen, editor:address:shared:editor-data<span class="muRecipe"> -> </span>screen:address:shared:screen, editor:address:shared:editor-data [ +<span class="muRecipe">def</span> editor-render screen:address:shared:screen, editor:address:shared:editor-data<span class="muRecipe"> -> </span>screen:address:shared:screen, editor:address:shared:editor-data [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> left:number<span class="Special"> <- </span>get *editor, <span class="Constant">left:offset</span> @@ -732,7 +724,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="Constant"> <scroll-down></span> <span class="Delimiter">}</span> go-render?<span class="Special"> <- </span>copy <span class="Constant">1/true</span> - <span class="muControl">reply</span> + <span class="muControl">return</span> <span class="Delimiter">}</span> ] @@ -853,11 +845,11 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } editor<span class="Special"> <- </span>insert-new-line-and-indent editor, screen <span class="Constant"> <insert-enter-end></span> go-render?<span class="Special"> <- </span>copy <span class="Constant">1/true</span> - <span class="muControl">reply</span> + <span class="muControl">return</span> <span class="Delimiter">}</span> ] -<span class="muRecipe">recipe</span> insert-new-line-and-indent editor:address:shared:editor-data, screen:address:shared:screen<span class="muRecipe"> -> </span>editor:address:shared:editor-data, screen:address:shared:screen, go-render?:boolean [ +<span class="muRecipe">def</span> insert-new-line-and-indent editor:address:shared:editor-data, screen:address:shared:screen<span class="muRecipe"> -> </span>editor:address:shared:editor-data, screen:address:shared:screen, go-render?:boolean [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> cursor-row:address:number<span class="Special"> <- </span>get-address *editor, <span class="Constant">cursor-row:offset</span> @@ -881,7 +873,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="Delimiter">}</span> <span class="Comment"># indent if necessary</span> indent?:boolean<span class="Special"> <- </span>get *editor, <span class="Constant">indent?:offset</span> - <span class="muControl">reply-unless</span> indent? + <span class="muControl">return-unless</span> indent? d:address:shared:duplex-list:character<span class="Special"> <- </span>get *editor, <span class="Constant">data:offset</span> end-of-previous-line:address:shared:duplex-list:character<span class="Special"> <- </span>prev *before-cursor indent:number<span class="Special"> <- </span>line-indent end-of-previous-line, d @@ -897,13 +889,13 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="Comment"># takes a pointer 'curr' into the doubly-linked list and its sentinel, counts</span> <span class="Comment"># the number of spaces at the start of the line containing 'curr'.</span> -<span class="muRecipe">recipe</span> line-indent curr:address:shared:duplex-list:character, start:address:shared:duplex-list:character<span class="muRecipe"> -> </span>result:number [ +<span class="muRecipe">def</span> line-indent curr:address:shared:duplex-list:character, start:address:shared:duplex-list:character<span class="muRecipe"> -> </span>result:number [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> result:number<span class="Special"> <- </span>copy <span class="Constant">0</span> - <span class="muControl">reply-unless</span> curr + <span class="muControl">return-unless</span> curr at-start?:boolean<span class="Special"> <- </span>equal curr, start - <span class="muControl">reply-if</span> at-start? + <span class="muControl">return-if</span> at-start? <span class="Delimiter">{</span> curr<span class="Special"> <- </span>prev curr <span class="muControl">break-unless</span> curr @@ -1030,7 +1022,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } indent?:address:boolean<span class="Special"> <- </span>get-address *editor, <span class="Constant">indent?:offset</span> *indent?<span class="Special"> <- </span>copy <span class="Constant">0/false</span> go-render?<span class="Special"> <- </span>copy <span class="Constant">1/true</span> - <span class="muControl">reply</span> + <span class="muControl">return</span> <span class="Delimiter">}</span> ] @@ -1041,13 +1033,13 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } indent?:address:boolean<span class="Special"> <- </span>get-address *editor, <span class="Constant">indent?:offset</span> *indent?<span class="Special"> <- </span>copy <span class="Constant">1/true</span> go-render?<span class="Special"> <- </span>copy <span class="Constant">1/true</span> - <span class="muControl">reply</span> + <span class="muControl">return</span> <span class="Delimiter">}</span> ] <span class="SalientComment">## helpers</span> -<span class="muRecipe">recipe</span> draw-horizontal screen:address:shared:screen, row:number, x:number, right:number<span class="muRecipe"> -> </span>screen:address:shared:screen [ +<span class="muRecipe">def</span> draw-horizontal screen:address:shared:screen, row:number, x:number, right:number<span class="muRecipe"> -> </span>screen:address:shared:screen [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> style:character, style-found?:boolean<span class="Special"> <- </span><span class="Constant">next-ingredient</span> @@ -1078,4 +1070,3 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } </pre> </body> </html> -<!-- vim: set foldmethod=manual : --> |