diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-06-23 14:02:12 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-06-23 14:02:12 -0700 |
commit | dbe124108b7a3529feeeba91339928c4ac737072 (patch) | |
tree | 6da7f748b04ec70cf5f778863ae4f86403943eb2 /html/020run.cc.html | |
parent | fedebaf5dbc1b39347ad3e3a1580fa0190c320b6 (diff) | |
download | mu-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.html | 45 |
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 << "AAA 6\n"; //? 2</span> +<span class="CommentedCode">//? cerr << "AAA 6\n"; //? 3</span> while <span class="Delimiter">(</span>!Current_routine<span class="Delimiter">-></span>completed<span class="Delimiter">())</span> <span class="Comment">// later layers will modify condition</span> <span class="Delimiter">{</span> <span class="CommentedCode">//? cerr << "AAA 7: " << current_step_index() << '\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">"run"</span><span class="Delimiter">)</span> << 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<vector<double> > products<span class="Delimiter">;</span> <span class="CommentedCode">//? cerr << "AAA 8: " << current_instruction().operation << " ^" << Recipe[current_instruction().operation].name << "$\n"; //? 1</span> +<span class="CommentedCode">//? cerr << "% " << current_recipe_name() << "/" << current_step_index() << ": " << Memory[1013] << ' ' << Memory[1014] << '\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 < 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 << "AAA 9\n"; //? 1</span> +<span class="CommentedCode">//? cerr << "AAA 9\n"; //? 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">"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 << "AAA 2\n"; //? 1</span> +<span class="CommentedCode">//? cerr << "AAA 2\n"; //? 2</span> +<span class="CommentedCode">//? cerr << form << '\n'; //? 1</span> vector<recipe_number> 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 << "AAA 3\n"; //? 1</span> +<span class="CommentedCode">//? cerr << "AAA 3\n"; //? 2</span> run<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>front<span class="Delimiter">());</span> -<span class="CommentedCode">//? cerr << "YYY\n"; //? 1</span> +<span class="CommentedCode">//? cerr << "YYY\n"; //? 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<double> read_memory<span class="Delimiter">(</span>reagent x<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="CommentedCode">//? cout << "read_memory: " << x.to_string() << '\n'; //? 2</span> vector<double> 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<double> read_memory<span class="Delimiter">(</span>reagent x<span c void write_memory<span class="Delimiter">(</span>reagent x<span class="Delimiter">,</span> vector<double> 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 << <span class="Constant">"size mismatch in storing to "</span> << x<span class="Delimiter">.</span>to_string<span class="Delimiter">()</span> << <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 << current_recipe_name<span class="Delimiter">()</span> << <span class="Constant">": size mismatch in storing to "</span> << x<span class="Delimiter">.</span>to_string<span class="Delimiter">()</span> << <span class="Constant">" at "</span> << current_instruction<span class="Delimiter">().</span>to_string<span class="Delimiter">()</span> << <span class="cSpecial">'\n'</span> << 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 < 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">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing "</span> << data<span class="Delimiter">.</span>at<span class="Delimiter">(</span>offset<span class="Delimiter">)</span> << <span class="Constant">" in location "</span> << 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<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& x<span class="Delimiter">,</span> const vector<double>& 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& x<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Identifier">return</span> x<span class="Delimiter">.</span>name == <span class="Constant">"_"</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> -bool isa_literal<span class="Delimiter">(</span>const reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +bool is_literal<span class="Delimiter">(</span>const reagent& 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> && 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"> <- </span>copy <span class="Constant">0</span>:literal ] <span class="traceContains">+run: _ <- copy 0:literal</span> + +<span class="Delimiter">:(scenario run_literal)</span> +recipe main [ + <span class="Constant">0</span>:literal/screen<span class="Special"> <- </span>copy <span class="Constant">0</span>:literal +] +<span class="traceAbsent">-mem: storing 0 in location 0</span> </pre> </body> </html> |