about summary refs log tree commit diff stats
path: root/html/020run.cc.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-06-23 14:02:12 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-06-23 14:02:12 -0700
commitdbe124108b7a3529feeeba91339928c4ac737072 (patch)
tree6da7f748b04ec70cf5f778863ae4f86403943eb2 /html/020run.cc.html
parentfedebaf5dbc1b39347ad3e3a1580fa0190c320b6 (diff)
downloadmu-dbe124108b7a3529feeeba91339928c4ac737072.tar.gz
1631 - update html versions
Html is a little more readable thanks to feedback from J David Eisenberg
(https://news.ycombinator.com/item?id=9766330), in particular the
suggestion to use https://addons.mozilla.org/En-us/firefox/addon/wcag-contrast-checker.
Diffstat (limited to 'html/020run.cc.html')
-rw-r--r--html/020run.cc.html45
1 files changed, 30 insertions, 15 deletions
diff --git a/html/020run.cc.html b/html/020run.cc.html
index 497766fa..c9b0fa2e 100644
--- a/html/020run.cc.html
+++ b/html/020run.cc.html
@@ -12,16 +12,16 @@
 <!--
 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; }
+* { font-size: 1.05em; }
 .traceContains { color: #008000; }
 .cSpecial { color: #008000; }
-.Constant { color: #008080; }
+.Constant { color: #00a0a0; }
 .SalientComment { color: #00ffff; }
 .traceAbsent { color: #c00000; }
-.Comment { color: #8080ff; }
-.Delimiter { color: #c000c0; }
+.Comment { color: #9090ff; }
+.Delimiter { color: #a04060; }
 .Special { color: #ff6060; }
-.CommentedCode { color: #6c6c6c; }
+.Comment { color: #9090ff; }
 .Identifier { color: #804000; }
 -->
 </style>
@@ -90,11 +90,11 @@ void run<span class="Delimiter">(</span>recipe_number r<span class="Delimiter">)
 
 void run_current_routine<span class="Delimiter">()</span>
 <span class="Delimiter">{</span>  <span class="Comment">// curly on a separate line, because later layers will modify header</span>
-<span class="CommentedCode">//?   cerr &lt;&lt; &quot;AAA 6\n&quot;; //? 2</span>
+<span class="CommentedCode">//?   cerr &lt;&lt; &quot;AAA 6\n&quot;; //? 3</span>
   while <span class="Delimiter">(</span>!Current_routine<span class="Delimiter">-&gt;</span>completed<span class="Delimiter">())</span>  <span class="Comment">// later layers will modify condition</span>
   <span class="Delimiter">{</span>
 <span class="CommentedCode">//?     cerr &lt;&lt; &quot;AAA 7: &quot; &lt;&lt; current_step_index() &lt;&lt; '\n'; //? 1</span>
-    <span class="Comment">// Running One Instruction.</span>
+    <span class="Comment">// Running One Instruction</span>
     if <span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>is_label<span class="Delimiter">)</span> <span class="Delimiter">{</span> ++current_step_index<span class="Delimiter">();</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Delimiter">}</span>
     trace<span class="Delimiter">(</span>Initial_callstack_depth+Callstack_depth<span class="Delimiter">,</span> <span class="Constant">&quot;run&quot;</span><span class="Delimiter">)</span> &lt;&lt; current_instruction<span class="Delimiter">().</span>to_string<span class="Delimiter">();</span>
     assert<span class="Delimiter">(</span>Memory[<span class="Constant">0</span>] == <span class="Constant">0</span><span class="Delimiter">);</span>
@@ -108,6 +108,7 @@ void run_current_routine<span class="Delimiter">()</span>
     <span class="Comment">// Instructions below will write to 'products'.</span>
     vector&lt;vector&lt;double&gt; &gt; products<span class="Delimiter">;</span>
 <span class="CommentedCode">//?     cerr &lt;&lt; &quot;AAA 8: &quot; &lt;&lt; current_instruction().operation &lt;&lt; &quot; ^&quot; &lt;&lt; Recipe[current_instruction().operation].name &lt;&lt; &quot;$\n&quot;; //? 1</span>
+<span class="CommentedCode">//?     cerr &lt;&lt; &quot;% &quot; &lt;&lt; current_recipe_name() &lt;&lt; &quot;/&quot; &lt;&lt; current_step_index() &lt;&lt; &quot;: &quot; &lt;&lt; Memory[1013] &lt;&lt; ' ' &lt;&lt; Memory[1014] &lt;&lt; '\n'; //? 1</span>
     switch <span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>operation<span class="Delimiter">)</span> <span class="Delimiter">{</span>
       <span class="Comment">// Primitive Recipe Implementations</span>
       case COPY: <span class="Delimiter">{</span>
@@ -124,9 +125,10 @@ void run_current_routine<span class="Delimiter">()</span>
     for <span class="Delimiter">(</span>long long int i = <span class="Constant">0</span><span class="Delimiter">;</span> i &lt; SIZE<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span>
       write_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span>
     <span class="Delimiter">}</span>
+    <span class="Comment">// End of Instruction</span>
     ++current_step_index<span class="Delimiter">();</span>
   <span class="Delimiter">}</span>
-<span class="CommentedCode">//?   cerr &lt;&lt; &quot;AAA 9\n&quot;; //? 1</span>
+<span class="CommentedCode">//?   cerr &lt;&lt; &quot;AAA 9\n&quot;; //? 2</span>
   stop_running_current_routine:<span class="Delimiter">;</span>
 <span class="Delimiter">}</span>
 
@@ -198,13 +200,14 @@ load_permanently<span class="Delimiter">(</span><span class="Constant">&quot;cor
 <span class="Delimiter">:(code)</span>
 <span class="Comment">// helper for tests</span>
 void run<span class="Delimiter">(</span>string form<span class="Delimiter">)</span> <span class="Delimiter">{</span>
-<span class="CommentedCode">//?   cerr &lt;&lt; &quot;AAA 2\n&quot;; //? 1</span>
+<span class="CommentedCode">//?   cerr &lt;&lt; &quot;AAA 2\n&quot;; //? 2</span>
+<span class="CommentedCode">//?   cerr &lt;&lt; form &lt;&lt; '\n'; //? 1</span>
   vector&lt;recipe_number&gt; tmp = load<span class="Delimiter">(</span>form<span class="Delimiter">);</span>
   if <span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span><span class="Delimiter">;</span>
   transform_all<span class="Delimiter">();</span>
-<span class="CommentedCode">//?   cerr &lt;&lt; &quot;AAA 3\n&quot;; //? 1</span>
+<span class="CommentedCode">//?   cerr &lt;&lt; &quot;AAA 3\n&quot;; //? 2</span>
   run<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>front<span class="Delimiter">());</span>
-<span class="CommentedCode">//?   cerr &lt;&lt; &quot;YYY\n&quot;; //? 1</span>
+<span class="CommentedCode">//?   cerr &lt;&lt; &quot;YYY\n&quot;; //? 2</span>
 <span class="Delimiter">}</span>
 
 <span class="SalientComment">//:: Reading from memory, writing to memory.</span>
@@ -212,7 +215,7 @@ void run<span class="Delimiter">(</span>string form<span class="Delimiter">)</sp
 vector&lt;double&gt; read_memory<span class="Delimiter">(</span>reagent x<span class="Delimiter">)</span> <span class="Delimiter">{</span>
 <span class="CommentedCode">//?   cout &lt;&lt; &quot;read_memory: &quot; &lt;&lt; x.to_string() &lt;&lt; '\n'; //? 2</span>
   vector&lt;double&gt; result<span class="Delimiter">;</span>
-  if <span class="Delimiter">(</span>isa_literal<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span class="Delimiter">{</span>
+  if <span class="Delimiter">(</span>is_literal<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span class="Delimiter">{</span>
     result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>x<span class="Delimiter">.</span>value<span class="Delimiter">);</span>
     <span class="Identifier">return</span> result<span class="Delimiter">;</span>
   <span class="Delimiter">}</span>
@@ -228,9 +231,11 @@ vector&lt;double&gt; read_memory<span class="Delimiter">(</span>reagent x<span c
 
 void write_memory<span class="Delimiter">(</span>reagent x<span class="Delimiter">,</span> vector&lt;double&gt; data<span class="Delimiter">)</span> <span class="Delimiter">{</span>
   if <span class="Delimiter">(</span>is_dummy<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span>
+  if <span class="Delimiter">(</span>is_literal<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span>
   long long int base = x<span class="Delimiter">.</span>value<span class="Delimiter">;</span>
-  if <span class="Delimiter">(</span>size_of<span class="Delimiter">(</span>x<span class="Delimiter">)</span> != SIZE<span class="Delimiter">(</span>data<span class="Delimiter">))</span>
-    raise &lt;&lt; <span class="Constant">&quot;size mismatch in storing to &quot;</span> &lt;&lt; x<span class="Delimiter">.</span>to_string<span class="Delimiter">()</span> &lt;&lt; <span class="cSpecial">'\n'</span><span class="Delimiter">;</span>
+  if <span class="Delimiter">(</span>size_mismatch<span class="Delimiter">(</span>x<span class="Delimiter">,</span> data<span class="Delimiter">))</span> <span class="Delimiter">{</span>
+    raise &lt;&lt; current_recipe_name<span class="Delimiter">()</span> &lt;&lt; <span class="Constant">&quot;: size mismatch in storing to &quot;</span> &lt;&lt; x<span class="Delimiter">.</span>to_string<span class="Delimiter">()</span> &lt;&lt; <span class="Constant">&quot; at &quot;</span> &lt;&lt; current_instruction<span class="Delimiter">().</span>to_string<span class="Delimiter">()</span> &lt;&lt; <span class="cSpecial">'\n'</span> &lt;&lt; die<span class="Delimiter">();</span>
+  <span class="Delimiter">}</span>
   for <span class="Delimiter">(</span>long long int offset = <span class="Constant">0</span><span class="Delimiter">;</span> offset &lt; SIZE<span class="Delimiter">(</span>data<span class="Delimiter">);</span> ++offset<span class="Delimiter">)</span> <span class="Delimiter">{</span>
     trace<span class="Delimiter">(</span>Primitive_recipe_depth<span class="Delimiter">,</span> <span class="Constant">&quot;mem&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;storing &quot;</span> &lt;&lt; data<span class="Delimiter">.</span>at<span class="Delimiter">(</span>offset<span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot; in location &quot;</span> &lt;&lt; base+offset<span class="Delimiter">;</span>
     Memory[base+offset] = data<span class="Delimiter">.</span>at<span class="Delimiter">(</span>offset<span class="Delimiter">);</span>
@@ -246,11 +251,15 @@ long long int size_of<span class="Delimiter">(</span>const vector&lt;type_number
   <span class="Identifier">return</span> <span class="Constant">1</span><span class="Delimiter">;</span>
 <span class="Delimiter">}</span>
 
+bool size_mismatch<span class="Delimiter">(</span>const reagent&amp; x<span class="Delimiter">,</span> const vector&lt;double&gt;&amp; data<span class="Delimiter">)</span> <span class="Delimiter">{</span>
+  <span class="Identifier">return</span> size_of<span class="Delimiter">(</span>x<span class="Delimiter">)</span> != SIZE<span class="Delimiter">(</span>data<span class="Delimiter">);</span>
+<span class="Delimiter">}</span>
+
 bool is_dummy<span class="Delimiter">(</span>const reagent&amp; x<span class="Delimiter">)</span> <span class="Delimiter">{</span>
   <span class="Identifier">return</span> x<span class="Delimiter">.</span>name == <span class="Constant">&quot;_&quot;</span><span class="Delimiter">;</span>
 <span class="Delimiter">}</span>
 
-bool isa_literal<span class="Delimiter">(</span>const reagent&amp; r<span class="Delimiter">)</span> <span class="Delimiter">{</span>
+bool is_literal<span class="Delimiter">(</span>const reagent&amp; r<span class="Delimiter">)</span> <span class="Delimiter">{</span>
   <span class="Identifier">return</span> SIZE<span class="Delimiter">(</span>r<span class="Delimiter">.</span>types<span class="Delimiter">)</span> == <span class="Constant">1</span> &amp;&amp; r<span class="Delimiter">.</span>types<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">;</span>
 <span class="Delimiter">}</span>
 
@@ -269,6 +278,12 @@ recipe main [
   _<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>:literal
 ]
 <span class="traceContains">+run: _ &lt;- copy 0:literal</span>
+
+<span class="Delimiter">:(scenario run_literal)</span>
+recipe main [
+  <span class="Constant">0</span>:literal/screen<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>:literal
+]
+<span class="traceAbsent">-mem: storing 0 in location 0</span>
 </pre>
 </body>
 </html>