diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-12-12 10:01:12 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-12-12 10:07:59 -0800 |
commit | 49620728e805a3bbc3477c14b8b6ef7e2b5d3ead (patch) | |
tree | c80ecf970ec78dfc0c40944a4b9e827c0eb77078 /html/020run.cc.html | |
parent | d81fcff20567a1d5e793e813bc761222885660b1 (diff) | |
download | mu-49620728e805a3bbc3477c14b8b6ef7e2b5d3ead.tar.gz |
3707
Be more disciplined about tagging 2 different concepts in the codebase: a) Use the phrase "later layers" to highlight places where a layer doesn't have the simplest possible self-contained implementation. b) Use the word "hook" to point out functions that exist purely to provide waypoints for extension by future layers. Since both these only make sense in the pre-tangled representation of the codebase, using '//:' and '#:' comments to get them stripped out of tangled output. (Though '#:' comments still make it to tangled output at the moment. Let's see if we use it enough to be worth supporting. Scenarios are pretty unreadable in tangled output anyway.)
Diffstat (limited to 'html/020run.cc.html')
-rw-r--r-- | html/020run.cc.html | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/html/020run.cc.html b/html/020run.cc.html index cd31ef09..e8c4d98e 100644 --- a/html/020run.cc.html +++ b/html/020run.cc.html @@ -102,7 +102,7 @@ Current_routine = <span class="Constant">NULL</span><span class="Delimiter">;</s <span class="Delimiter">}</span> <span class="Normal">void</span> run_current_routine<span class="Delimiter">()</span> <span class="Delimiter">{</span> - <span class="Normal">while</span> <span class="Delimiter">(</span>should_continue_running<span class="Delimiter">(</span>Current_routine<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// beware: later layers modify Current_routine here</span> + <span class="Normal">while</span> <span class="Delimiter">(</span>should_continue_running<span class="Delimiter">(</span>Current_routine<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// beware: may modify Current_routine</span> <span class="Comment">// Running One Instruction</span> <span class="Normal">if</span> <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 + Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << to_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << end<span class="Delimiter">();</span> @@ -145,6 +145,7 @@ Current_routine = <span class="Constant">NULL</span><span class="Delimiter">;</s <span class="Normal">stop_running_current_routine</span>:<span class="Delimiter">;</span> <span class="Delimiter">}</span> +<span class="Comment">//: hook replaced in a later layer</span> <span class="Normal">bool</span> should_continue_running<span class="Delimiter">(</span><span class="Normal">const</span> routine* current_routine<span class="Delimiter">)</span> <span class="Delimiter">{</span> assert<span class="Delimiter">(</span>current_routine == Current_routine<span class="Delimiter">);</span> <span class="Comment">// argument passed in just to make caller readable above</span> <span class="Identifier">return</span> !Current_routine<span class="Delimiter">-></span>completed<span class="Delimiter">();</span> @@ -156,29 +157,34 @@ Current_routine = <span class="Constant">NULL</span><span class="Delimiter">;</s <span class="Delimiter">}</span> <span class="Comment">//: Some helpers.</span> -<span class="Comment">//: We'll need to override these later as we change the definition of routine.</span> -<span class="Comment">//: Important that they return referrences into the routine.</span> +<span class="Comment">//: Important that they return references into the current routine.</span> +<span class="Comment">//: hook replaced in a later layer</span> <span class="Normal">int</span>& current_step_index<span class="Delimiter">()</span> <span class="Delimiter">{</span> <span class="Identifier">return</span> Current_routine<span class="Delimiter">-></span>running_step_index<span class="Delimiter">;</span> <span class="Delimiter">}</span> +<span class="Comment">//: hook replaced in a later layer</span> <span class="Normal">const</span> string& current_recipe_name<span class="Delimiter">()</span> <span class="Delimiter">{</span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> Current_routine<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name<span class="Delimiter">;</span> <span class="Delimiter">}</span> +<span class="Comment">//: hook replaced in a later layer</span> <span class="Normal">const</span> recipe& current_recipe<span class="Delimiter">()</span> <span class="Delimiter">{</span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> Current_routine<span class="Delimiter">-></span>running_recipe<span class="Delimiter">);</span> <span class="Delimiter">}</span> +<span class="Comment">//: hook replaced in a later layer</span> <span class="Normal">const</span> instruction& current_instruction<span class="Delimiter">()</span> <span class="Delimiter">{</span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> Current_routine<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>running_step_index<span class="Delimiter">);</span> <span class="Delimiter">}</span> +<span class="Comment">//: hook replaced in a later layer</span> <span class="Normal">bool</span> routine::completed<span class="Delimiter">()</span> <span class="Normal">const</span> <span class="Delimiter">{</span> <span class="Identifier">return</span> running_step_index >= SIZE<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> <span class="Delimiter">}</span> +<span class="Comment">//: hook replaced in a later layer</span> <span class="Normal">const</span> vector<instruction>& routine::steps<span class="Delimiter">()</span> <span class="Normal">const</span> <span class="Delimiter">{</span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">;</span> <span class="Delimiter">}</span> |