about summary refs log tree commit diff stats
path: root/html/043space.cc.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-25 22:27:19 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-25 22:27:19 -0700
commitc5ffb6e1cc9c5ff880d037c53b8ebc8562be0008 (patch)
tree2d05d987ec3c81bfbb0c1f598966d9d1b16e9b1f /html/043space.cc.html
parentb2757892d553352feb59d70b1e7241ccdafa6905 (diff)
downloadmu-c5ffb6e1cc9c5ff880d037c53b8ebc8562be0008.tar.gz
1459
Diffstat (limited to 'html/043space.cc.html')
-rw-r--r--html/043space.cc.html46
1 files changed, 31 insertions, 15 deletions
diff --git a/html/043space.cc.html b/html/043space.cc.html
index 66e073b3..0007e765 100644
--- a/html/043space.cc.html
+++ b/html/043space.cc.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-<title>~/Desktop/s/mu/043space.cc</title>
+<title>043space.cc</title>
 <meta name="Generator" content="Vim/7.4">
 <meta name="plugin-version" content="vim7.4_v1">
 <meta name="syntax" content="cpp">
@@ -13,14 +13,15 @@
 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; }
-.cSpecial { color: #008000; }
-.Identifier { color: #008080; }
+.traceAbsent { color: #c00000; }
+.CommentedCode { color: #6c6c6c; }
 .Constant { color: #008080; }
 .Comment { color: #8080ff; }
 .Delimiter { color: #c000c0; }
 .Special { color: #ff6060; }
-.CommentedCode { color: #6c6c6c; }
+.Identifier { color: #008080; }
 .SalientComment { color: #00ffff; }
+.cSpecial { color: #008000; }
 .traceContains { color: #008000; }
 -->
 </style>
@@ -33,7 +34,7 @@ body { font-family: monospace; color: #d0d0d0; background-color: #000000; }
 </head>
 <body>
 <pre id='vimCodeElement'>
-<span class="Comment">//: Spaces help isolate functions from each other. You can create them at will,</span>
+<span class="Comment">//: Spaces help isolate recipes from each other. You can create them at will,</span>
 <span class="Comment">//: and all addresses in arguments are implicitly based on the 'default-space'</span>
 <span class="Comment">//: (unless they have the /raw property)</span>
 
@@ -53,17 +54,32 @@ recipe main [
   <span class="Constant">3</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>:literal
   <span class="Comment"># pretend array</span>
   <span class="Constant">1000</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">5</span>:literal
-  <span class="Comment"># actual start of this function</span>
+  <span class="Comment"># actual start of this recipe</span>
   default-space:address:array:location<span class="Special"> &lt;- </span>copy <span class="Constant">1000</span>:literal
   <span class="Constant">1</span>:address:number<span class="Special"> &lt;- </span>copy <span class="Constant">3</span>:literal
   <span class="Constant">8</span>:number/<span class="Special">raw &lt;- </span>copy <span class="Constant">1</span>:address:number/deref
 ]
 <span class="traceContains">+mem: storing 34 in location 8</span>
 
+<span class="SalientComment">//:: first disable name conversion for 'default-space'</span>
+<span class="Delimiter">:(scenario convert_names_passes_default_space)</span>
+recipe main [
+  default-space:number<span class="Delimiter">,</span> x:number<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>:literal<span class="Delimiter">,</span> <span class="Constant">1</span>:literal
+]
+<span class="traceContains">+name: assign x 1</span>
+<span class="traceAbsent">-name: assign default-space 1</span>
+
+<span class="Delimiter">:(before &quot;End Disqualified Reagents&quot;)</span>
+if <span class="Delimiter">(</span>x<span class="Delimiter">.</span>name == <span class="Constant">&quot;default-space&quot;</span><span class="Delimiter">)</span>
+  x<span class="Delimiter">.</span>initialized = <span class="Constant">true</span><span class="Delimiter">;</span>
+<span class="Delimiter">:(before &quot;End is_special_name Cases&quot;)</span>
+if <span class="Delimiter">(</span>s == <span class="Constant">&quot;default-space&quot;</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span>
+
+<span class="SalientComment">//:: now implement space support</span>
 <span class="Delimiter">:(before &quot;End call Fields&quot;)</span>
-index_t default_space<span class="Delimiter">;</span>
-<span class="Delimiter">:(replace &quot;call(recipe_number r) :running_recipe(r)&quot;)</span>
-call<span class="Delimiter">(</span>recipe_number r<span class="Delimiter">)</span> :running_recipe<span class="Delimiter">(</span>r<span class="Delimiter">),</span> running_step_index<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">),</span> next_ingredient_to_process<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">),</span> default_space<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{}</span>
+long long int default_space<span class="Delimiter">;</span>
+<span class="Delimiter">:(before &quot;End call Constructor&quot;)</span>
+default_space = <span class="Constant">0</span><span class="Delimiter">;</span>
 
 <span class="Delimiter">:(replace &quot;reagent r = x&quot; following &quot;reagent canonize(reagent x)&quot;)</span>
 reagent r = absolutize<span class="Delimiter">(</span>x<span class="Delimiter">);</span>
@@ -95,7 +111,7 @@ recipe main [
   <span class="Constant">13</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">35</span>:literal
   <span class="Comment"># pretend array</span>
   <span class="Constant">1000</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">5</span>:literal
-  <span class="Comment"># actual start of this function</span>
+  <span class="Comment"># actual start of this recipe</span>
   default-space:address:array:location<span class="Special"> &lt;- </span>copy <span class="Constant">1000</span>:literal
   <span class="Constant">1</span>:address:point<span class="Special"> &lt;- </span>copy <span class="Constant">12</span>:literal
   <span class="Constant">9</span>:number/<span class="Special">raw &lt;- </span>get <span class="Constant">1</span>:address:point/deref<span class="Delimiter">,</span> <span class="Constant">1</span>:offset
@@ -115,7 +131,7 @@ recipe main [
   <span class="Constant">14</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">35</span>:literal
   <span class="Comment"># pretend array</span>
   <span class="Constant">1000</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">5</span>:literal
-  <span class="Comment"># actual start of this function</span>
+  <span class="Comment"># actual start of this recipe</span>
   default-space:address:array:location<span class="Special"> &lt;- </span>copy <span class="Constant">1000</span>:literal
   <span class="Constant">1</span>:address:array:number<span class="Special"> &lt;- </span>copy <span class="Constant">12</span>:literal
   <span class="Constant">9</span>:number/<span class="Special">raw &lt;- </span>index <span class="Constant">1</span>:address:array:number/deref<span class="Delimiter">,</span> <span class="Constant">1</span>:literal
@@ -128,14 +144,14 @@ tmp<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>pus
 <span class="SalientComment">//:: helpers</span>
 
 <span class="Delimiter">:(code)</span>
-index_t space_base<span class="Delimiter">(</span>const reagent&amp; x<span class="Delimiter">)</span> <span class="Delimiter">{</span>
+long long int space_base<span class="Delimiter">(</span>const reagent&amp; x<span class="Delimiter">)</span> <span class="Delimiter">{</span>
   <span class="Identifier">return</span> Current_routine<span class="Delimiter">-&gt;</span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>default_space<span class="Delimiter">;</span>
 <span class="Delimiter">}</span>
 
-index_t address<span class="Delimiter">(</span>index_t offset<span class="Delimiter">,</span> index_t base<span class="Delimiter">)</span> <span class="Delimiter">{</span>
+long long int address<span class="Delimiter">(</span>long long int offset<span class="Delimiter">,</span> long long int base<span class="Delimiter">)</span> <span class="Delimiter">{</span>
   if <span class="Delimiter">(</span>base == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span> offset<span class="Delimiter">;</span>  <span class="Comment">// raw</span>
 <span class="CommentedCode">//?   cout &lt;&lt; base &lt;&lt; '\n'; //? 2</span>
-  if <span class="Delimiter">(</span>offset &gt;= static_cast&lt;index_t&gt;<span class="Delimiter">(</span>Memory[base]<span class="Delimiter">))</span> <span class="Delimiter">{</span>
+  if <span class="Delimiter">(</span>offset &gt;= static_cast&lt;long long int&gt;<span class="Delimiter">(</span>Memory[base]<span class="Delimiter">))</span> <span class="Delimiter">{</span>
     <span class="Comment">// todo: test</span>
     raise &lt;&lt; <span class="Constant">&quot;location &quot;</span> &lt;&lt; offset &lt;&lt; <span class="Constant">&quot; is out of bounds &quot;</span> &lt;&lt; Memory[base] &lt;&lt; <span class="cSpecial">'\n'</span><span class="Delimiter">;</span>
   <span class="Delimiter">}</span>
@@ -144,7 +160,7 @@ index_t address<span class="Delimiter">(</span>index_t offset<span class="Delimi
 
 <span class="Delimiter">:(after &quot;void write_memory(reagent x, vector&lt;double&gt; data)&quot;)</span>
   if <span class="Delimiter">(</span>x<span class="Delimiter">.</span>name == <span class="Constant">&quot;default-space&quot;</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
-    assert<span class="Delimiter">(</span>data<span class="Delimiter">.</span>size<span class="Delimiter">()</span> == <span class="Constant">1</span><span class="Delimiter">);</span>
+    assert<span class="Delimiter">(</span>scalar<span class="Delimiter">(</span>data<span class="Delimiter">));</span>
     Current_routine<span class="Delimiter">-&gt;</span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>default_space = data<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span>
 <span class="CommentedCode">//?     cout &lt;&lt; &quot;AAA &quot; &lt;&lt; Current_routine-&gt;calls.front().default_space &lt;&lt; '\n'; //? 1</span>
     <span class="Identifier">return</span><span class="Delimiter">;</span>