<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Mu - edit.mu</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="none">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="minimal">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; }
body { font-family: monospace; color: #eeeeee; background-color: #080808; }
* { font-size: 1em; }
.Delimiter { color: #c000c0; }
.Comment { color: #8080ff; }
.Constant { color: #008080; }
.Special { color: #ff6060; }
.Identifier { color: #008080; }
.muRecipe { color: #ff8700; }
.CommentedCode { color: #6c6c6c; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="muRecipe">recipe</span> main [
<span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span>
switch-to-display
draw-bounding-box <span class="Constant">0:literal/screen</span>, <span class="Constant">5:literal</span>, <span class="Constant">5:literal</span>, <span class="Constant">30:literal</span>, <span class="Constant">45:literal</span>
wait-for-key-from-keyboard
return-to-console
]
<span class="muRecipe">recipe</span> draw-bounding-box [
<span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span>
screen:address<span class="Special"> <- </span><span class="Identifier">next-ingredient</span>
<span class="Comment"># sanity-check the box bounds</span>
top:number<span class="Special"> <- </span><span class="Identifier">next-ingredient</span>
<span class="Delimiter">{</span>
out?:boolean<span class="Special"> <- </span>lesser-than top:number, <span class="Constant">0:literal</span>
<span class="Identifier">break-unless</span> out?:boolean
top:number<span class="Special"> <- </span>copy <span class="Constant">0:literal</span>
<span class="Delimiter">}</span>
left:number<span class="Special"> <- </span><span class="Identifier">next-ingredient</span>
<span class="Delimiter">{</span>
out?:boolean<span class="Special"> <- </span>lesser-than left:number, <span class="Constant">0:literal</span>
<span class="Identifier">break-unless</span> out?:boolean
left:number<span class="Special"> <- </span>copy <span class="Constant">0:literal</span>
<span class="Delimiter">}</span>
bottom:number<span class="Special"> <- </span><span class="Identifier">next-ingredient</span>
<span class="Delimiter">{</span>
height:number<span class="Special"> <- </span>screen-height screen:address
out?:boolean<span class="Special"> <- </span>greater-or-equal bottom:number, height:number
<span class="Identifier">break-unless</span> out?:boolean
bottom:number<span class="Special"> <- </span>subtract height:number, <span class="Constant">1:literal</span>
<span class="Delimiter">}</span>
right:number<span class="Special"> <- </span><span class="Identifier">next-ingredient</span>
<span class="Delimiter">{</span>
width:number<span class="Special"> <- </span>screen-width screen:address
out?:boolean<span class="Special"> <- </span>greater-or-equal right:number, width:number
<span class="Identifier">break-unless</span> out?:boolean
right:number<span class="Special"> <- </span>subtract width:number, <span class="Constant">1:literal</span>
<span class="Delimiter">}</span>
<span class="CommentedCode">#? print-integer screen:address, bottom:number</span>
<span class="CommentedCode">#? print-character screen:address, 32:literal/space</span>
<span class="CommentedCode">#? print-integer screen:address, right:number</span>
<span class="Comment"># top border</span>
move-cursor screen:address, top:number, left:number
print-character screen:address, <span class="Constant">9484:literal/down-right</span>, <span class="Constant">245:literal/grey</span>
x:number<span class="Special"> <- </span>add left:number, <span class="Constant">1:literal</span> <span class="Comment"># exclude corner</span>
<span class="Delimiter">{</span>
continue?:boolean<span class="Special"> <- </span>lesser-than x:number, right:number
<span class="Identifier">break-unless</span> continue?:boolean
print-character screen:address, <span class="Constant">9472:literal/horizontal</span>, <span class="Constant">245:literal/grey</span>
x:number<span class="Special"> <- </span>add x:number, <span class="Constant">1:literal</span>
<span class="Identifier">loop</span>
<span class="Delimiter">}</span>
print-character screen:address, <span class="Constant">9488:literal/down-left</span>, <span class="Constant">245:literal/grey</span>
<span class="Comment"># bottom border</span>
move-cursor screen:address, bottom:number, left:number
print-character screen:address, <span class="Constant">9492:literal/up-right</span>, <span class="Constant">245:literal/grey</span>
x:number<span class="Special"> <- </span>add left:number, <span class="Constant">1:literal</span> <span class="Comment"># exclude corner</span>
<span class="Delimiter">{</span>
continue?:boolean<span class="Special"> <- </span>lesser-than x:number, right:number
<span class="Identifier">break-unless</span> continue?:boolean
print-character screen:address, <span class="Constant">9472:literal/horizontal</span>, <span class="Constant">245:literal/grey</span>
x:number<span class="Special"> <- </span>add x:number, <span class="Constant">1:literal</span>
<span class="Identifier">loop</span>
<span class="Delimiter">}</span>
print-character screen:address, <span class="Constant">9496:literal/up-left</span>, <span class="Constant">245:literal/grey</span>
<span class="Comment"># left and right borders</span>
x:number<span class="Special"> <- </span>add top:number, <span class="Constant">1:literal</span> <span class="Comment"># exclude corner</span>
<span class="Delimiter">{</span>
continue?:boolean<span class="Special"> <- </span>lesser-than x:number, bottom:number
<span class="Identifier">break-unless</span> continue?:boolean
move-cursor screen:address, x:number, left:number
print-character screen:address, <span class="Constant">9474:literal/vertical</span>, <span class="Constant">245:literal/grey</span>
move-cursor screen:address, x:number, right:number
print-character screen:address, <span class="Constant">9474:literal/vertical</span>, <span class="Constant">245:literal/grey</span>
x:number<span class="Special"> <- </span>add x:number, <span class="Constant">1:literal</span>
<span class="Identifier">loop</span>
<span class="Delimiter">}</span>
<span class="Comment"># position cursor inside box</span>
move-cursor screen:address, top:number, left:number
cursor-down screen:address
cursor-right screen:address
]
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->