about summary refs log tree commit diff stats
path: root/html/062array.mu.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-06 00:19:03 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-06 00:19:03 -0700
commit672e3e50c6ed6de161e40aa256c3fc0f2b1f7cf9 (patch)
tree5fa3d82e40137b15dec2941a3446e838ce43d3e5 /html/062array.mu.html
parent20d1c9057a559ce8db83bbc2787ca91348bcb16f (diff)
downloadmu-672e3e50c6ed6de161e40aa256c3fc0f2b1f7cf9.tar.gz
1279 - colorized rendering of the source files
Diffstat (limited to 'html/062array.mu.html')
-rw-r--r--html/062array.mu.html74
1 files changed, 74 insertions, 0 deletions
diff --git a/html/062array.mu.html b/html/062array.mu.html
new file mode 100644
index 00000000..e765ca2a
--- /dev/null
+++ b/html/062array.mu.html
@@ -0,0 +1,74 @@
+<!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>~/Desktop/s/mu/062array.mu.html</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: #d0d0d0; background-color: #000000; }
+body { font-family: monospace; color: #d0d0d0; background-color: #000000; }
+* { font-size: 1em; }
+.Comment { color: #8080ff; }
+.Delimiter { color: #c000c0; }
+.Special { color: #ff6060; }
+.Identifier { color: #008080; }
+-->
+</style>
+
+<script type='text/javascript'>
+<!--
+
+-->
+</script>
+</head>
+<body>
+<pre id='vimCodeElement'>
+scenario array-from-args <span class="Delimiter">[</span>
+  run <span class="Delimiter">[</span>
+    1:address:array:location<span class="Special"> &lt;- </span>init-array 0:literal, 1:literal, 2:literal
+    2:array:location<span class="Special"> &lt;- </span>copy 1:address:array:location/deref
+  <span class="Delimiter">]</span>
+  memory-should-contain <span class="Delimiter">[</span>
+    2<span class="Special"> &lt;- </span>3  <span class="Comment"># array length</span>
+    3<span class="Special"> &lt;- </span>0
+    4<span class="Special"> &lt;- </span>1
+    5<span class="Special"> &lt;- </span>2
+  <span class="Delimiter">]</span>
+<span class="Delimiter">]</span>
+
+<span class="Comment"># create an array out of a list of scalar args</span>
+recipe init-array <span class="Delimiter">[</span>
+  default-space:address:array:location<span class="Special"> &lt;- </span>new location:type, 30:literal
+  capacity:integer<span class="Special"> &lt;- </span>copy 0:literal
+  <span class="Delimiter">{</span>
+    <span class="Comment"># while read curr-value</span>
+    curr-value:location, exists?:boolean<span class="Special"> &lt;- </span>next-ingredient
+    <span class="Identifier">break-unless</span> exists?:boolean
+    capacity:integer<span class="Special"> &lt;- </span>add capacity:integer, 1:literal
+    <span class="Identifier">loop</span>
+  <span class="Delimiter">}</span>
+  result:address:array:location<span class="Special"> &lt;- </span>new location:type, capacity:integer
+  rewind-ingredients
+  i:integer<span class="Special"> &lt;- </span>copy 0:literal
+  <span class="Delimiter">{</span>
+    <span class="Comment"># while read curr-value</span>
+    done?:boolean<span class="Special"> &lt;- </span>greater-or-equal i:integer, capacity:integer
+    <span class="Identifier">break-if</span> done?:boolean
+    curr-value:location, exists?:boolean<span class="Special"> &lt;- </span>next-ingredient
+    assert exists?:boolean, <span class="Delimiter">[</span>error in rewinding ingredients to init-array<span class="Delimiter">]</span>
+    tmp:address:location<span class="Special"> &lt;- </span>index-address result:address:array:location/deref, i:integer
+    tmp:address:location/deref<span class="Special"> &lt;- </span>copy curr-value:location
+    i:integer<span class="Special"> &lt;- </span>add i:integer, 1:literal
+    <span class="Identifier">loop</span>
+  <span class="Delimiter">}</span>
+  <span class="Identifier">reply</span> result:address:array:location
+<span class="Delimiter">]</span>
+</pre>
+</body>
+</html>
+<!-- vim: set foldmethod=manual : -->