diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2018-03-15 23:29:08 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2018-03-15 23:29:08 -0700 |
commit | 7452d0525ecfc12c11fe005c31b089a5b4d7a102 (patch) | |
tree | b4e661de29b33bdfa5b476d0fa4e45f51e5bf9f5 /html/026call.cc.html | |
parent | 9b4f4b3e1c28efed457bbae50f23c1737a94450d (diff) | |
download | mu-7452d0525ecfc12c11fe005c31b089a5b4d7a102.tar.gz |
4228
Diffstat (limited to 'html/026call.cc.html')
-rw-r--r-- | html/026call.cc.html | 190 |
1 files changed, 99 insertions, 91 deletions
diff --git a/html/026call.cc.html b/html/026call.cc.html index 84581ebc..12ff47c9 100644 --- a/html/026call.cc.html +++ b/html/026call.cc.html @@ -198,97 +198,105 @@ if ('onhashchange' in window) { <span id="L133" class="LineNr">133 </span><span class="CommentedCode">//? return get(Recipe, call.running_recipe).steps.at(call.running_step_index);</span> <span id="L134" class="LineNr">134 </span><span class="CommentedCode">//? }</span> <span id="L135" class="LineNr">135 </span> -<span id="L136" class="LineNr">136 </span><span class="Delimiter">:(after "Defined Recipe Checks")</span> -<span id="L137" class="LineNr">137 </span><span class="Comment">// not a primitive; check that it's present in the book of recipes</span> -<span id="L138" class="LineNr">138 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L139" class="LineNr">139 </span> <a href='003trace.cc.html#L174'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"undefined operation in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L203'>end</a><span class="Delimiter">();</span> -<span id="L140" class="LineNr">140 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L141" class="LineNr">141 </span><span class="Delimiter">}</span> -<span id="L142" class="LineNr">142 </span><span class="Delimiter">:(replace{} "default:" following "End Primitive Recipe Implementations")</span> -<span id="L143" class="LineNr">143 </span><span class="Normal">default</span>: <span class="Delimiter">{</span> -<span id="L144" class="LineNr">144 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// error already raised in Checks above</span> -<span id="L145" class="LineNr">145 </span> <span class="Comment">// not a primitive; look up the book of recipes</span> -<span id="L146" class="LineNr">146 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L147" class="LineNr">147 </span> ++Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> -<span id="L148" class="LineNr">148 </span> <a href='003trace.cc.html#L167'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"incrementing callstack depth to "</span> << Trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L203'>end</a><span class="Delimiter">();</span> -<span id="L149" class="LineNr">149 </span> assert<span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> -<span id="L150" class="LineNr">150 </span> <span class="Delimiter">}</span> -<span id="L151" class="LineNr">151 </span> <span class="Normal">const</span> call& caller_frame = <a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">();</span> -<span id="L152" class="LineNr">152 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>call<span class="Delimiter">(</span><a href='026call.cc.html#L88'>to_instruction</a><span class="Delimiter">(</span>caller_frame<span class="Delimiter">).</span>operation<span class="Delimiter">));</span> -<span id="L153" class="LineNr">153 </span> finish_call_housekeeping<span class="Delimiter">(</span><a href='026call.cc.html#L88'>to_instruction</a><span class="Delimiter">(</span>caller_frame<span class="Delimiter">),</span> ingredients<span class="Delimiter">);</span> -<span id="L154" class="LineNr">154 </span> <span class="Comment">// not done with caller</span> -<span id="L155" class="LineNr">155 </span> write_products = <span class="Constant">false</span><span class="Delimiter">;</span> -<span id="L156" class="LineNr">156 </span> fall_through_to_next_instruction = <span class="Constant">false</span><span class="Delimiter">;</span> -<span id="L157" class="LineNr">157 </span> <span class="Comment">// End Non-primitive Call(caller_frame)</span> -<span id="L158" class="LineNr">158 </span> <span class="Delimiter">}</span> -<span id="L159" class="LineNr">159 </span><span class="Delimiter">}</span> -<span id="L160" class="LineNr">160 </span><span class="Delimiter">:(code)</span> -<span id="L161" class="LineNr">161 </span><span class="Normal">void</span> finish_call_housekeeping<span class="Delimiter">(</span><span class="Normal">const</span> instruction& call_instruction<span class="Delimiter">,</span> <span class="Normal">const</span> vector<vector<<span class="Normal">double</span>> >& ingredients<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L162" class="LineNr">162 </span> <span class="Comment">// End Call Housekeeping</span> -<span id="L163" class="LineNr">163 </span><span class="Delimiter">}</span> -<span id="L164" class="LineNr">164 </span> -<span id="L165" class="LineNr">165 </span><span class="Delimiter">:(scenario calling_undefined_recipe_fails)</span> -<span id="L166" class="LineNr">166 </span><span class="Special">% Hide_errors = true;</span> -<span id="L167" class="LineNr">167 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L168" class="LineNr">168 </span> foo -<span id="L169" class="LineNr">169 </span>] -<span id="L170" class="LineNr">170 </span><span class="traceContains">+error: <a href='000organization.cc.html#L113'>main</a>: undefined operation in 'foo'</span> -<span id="L171" class="LineNr">171 </span> -<span id="L172" class="LineNr">172 </span><span class="Delimiter">:(scenario calling_undefined_recipe_handles_missing_result)</span> -<span id="L173" class="LineNr">173 </span><span class="Special">% Hide_errors = true;</span> -<span id="L174" class="LineNr">174 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L175" class="LineNr">175 </span> <span class="Normal">x</span>:num<span class="Special"> <- </span>foo -<span id="L176" class="LineNr">176 </span>] -<span id="L177" class="LineNr">177 </span><span class="traceContains">+error: <a href='000organization.cc.html#L113'>main</a>: undefined operation in 'x:num <- foo'</span> -<span id="L178" class="LineNr">178 </span> -<span id="L179" class="LineNr">179 </span><span class="SalientComment">//:: finally, we need to fix the termination conditions for the run loop</span> -<span id="L180" class="LineNr">180 </span> -<span id="L181" class="LineNr">181 </span><span class="Delimiter">:(replace{} "bool routine::completed() const")</span> -<span id="L182" class="LineNr">182 </span><span class="Normal">bool</span> routine::completed<span class="Delimiter">()</span> <span class="Normal">const</span> <span class="Delimiter">{</span> -<span id="L183" class="LineNr">183 </span> <span class="Identifier">return</span> calls<span class="Delimiter">.</span>empty<span class="Delimiter">();</span> -<span id="L184" class="LineNr">184 </span><span class="Delimiter">}</span> -<span id="L185" class="LineNr">185 </span> -<span id="L186" class="LineNr">186 </span><span class="Delimiter">:(replace{} "const vector<instruction>& routine::steps() const")</span> -<span id="L187" class="LineNr">187 </span><span class="Normal">const</span> vector<instruction>& routine::steps<span class="Delimiter">()</span> <span class="Normal">const</span> <span class="Delimiter">{</span> -<span id="L188" class="LineNr">188 </span> assert<span class="Delimiter">(</span>!calls<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L189" class="LineNr">189 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">;</span> -<span id="L190" class="LineNr">190 </span><span class="Delimiter">}</span> -<span id="L191" class="LineNr">191 </span> -<span id="L192" class="LineNr">192 </span><span class="Delimiter">:(after "Running One Instruction")</span> -<span id="L193" class="LineNr">193 </span><span class="Comment">// when we reach the end of one call, we may reach the end of the one below</span> -<span id="L194" class="LineNr">194 </span><span class="Comment">// it, and the one below that, and so on</span> -<span id="L195" class="LineNr">195 </span><span class="Normal">while</span> <span class="Delimiter">(</span><a href='026call.cc.html#L84'>current_step_index</a><span class="Delimiter">()</span> >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>steps<span class="Delimiter">()))</span> <span class="Delimiter">{</span> -<span id="L196" class="LineNr">196 </span> <span class="Comment">// Falling Through End Of Recipe</span> -<span id="L197" class="LineNr">197 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L198" class="LineNr">198 </span> <a href='003trace.cc.html#L167'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"fall-through: exiting "</span> << <a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">()</span> << <span class="Constant">"; decrementing callstack depth from "</span> << Trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L203'>end</a><span class="Delimiter">();</span> -<span id="L199" class="LineNr">199 </span> --Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> -<span id="L200" class="LineNr">200 </span> assert<span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth >= <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L201" class="LineNr">201 </span> <span class="Delimiter">}</span> -<span id="L202" class="LineNr">202 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> -<span id="L203" class="LineNr">203 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">goto</span> stop_running_current_routine<span class="Delimiter">;</span> -<span id="L204" class="LineNr">204 </span> <span class="Comment">// Complete Call Fallthrough</span> -<span id="L205" class="LineNr">205 </span> <span class="Comment">// todo: fail if no products returned</span> -<span id="L206" class="LineNr">206 </span> ++current_step_index<span class="Delimiter">();</span> -<span id="L207" class="LineNr">207 </span><span class="Delimiter">}</span> -<span id="L208" class="LineNr">208 </span> -<span id="L209" class="LineNr">209 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> -<span id="L210" class="LineNr">210 </span>_DUMP_CALL_STACK<span class="Delimiter">,</span> -<span id="L211" class="LineNr">211 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L212" class="LineNr">212 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$dump-call-stack"</span><span class="Delimiter">,</span> _DUMP_CALL_STACK<span class="Delimiter">);</span> -<span id="L213" class="LineNr">213 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> -<span id="L214" class="LineNr">214 </span><span class="Normal">case</span> _DUMP_CALL_STACK: <span class="Delimiter">{</span> -<span id="L215" class="LineNr">215 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L216" class="LineNr">216 </span><span class="Delimiter">}</span> -<span id="L217" class="LineNr">217 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> -<span id="L218" class="LineNr">218 </span><span class="Normal">case</span> _DUMP_CALL_STACK: <span class="Delimiter">{</span> -<span id="L219" class="LineNr">219 </span> <a href='003trace.cc.html#L120'>dump</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">);</span> -<span id="L220" class="LineNr">220 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L221" class="LineNr">221 </span><span class="Delimiter">}</span> -<span id="L222" class="LineNr">222 </span><span class="Delimiter">:(code)</span> -<span id="L223" class="LineNr">223 </span><span class="Normal">void</span> <a href='003trace.cc.html#L120'>dump</a><span class="Delimiter">(</span><span class="Normal">const</span> call_stack& calls<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L224" class="LineNr">224 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::const_reverse_iterator p = calls<span class="Delimiter">.</span>rbegin<span class="Delimiter">();</span> p != calls<span class="Delimiter">.</span>rend<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> -<span id="L225" class="LineNr">225 </span> cerr << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name << <span class="Constant">":"</span> << p<span class="Delimiter">-></span>running_step_index << <span class="Constant">" -- "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L88'>to_instruction</a><span class="Delimiter">(</span>*p<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L226" class="LineNr">226 </span><span class="Delimiter">}</span> +<span id="L136" class="LineNr">136 </span><span class="Delimiter">:(code)</span> +<span id="L137" class="LineNr">137 </span><span class="Normal">void</span> dump_callstack<span class="Delimiter">()</span> <span class="Delimiter">{</span> +<span id="L138" class="LineNr">138 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Current_routine<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L139" class="LineNr">139 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>size<span class="Delimiter">()</span> <= <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L140" class="LineNr">140 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::const_iterator p = ++Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span><a href='003trace.cc.html#L203'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> +<span id="L141" class="LineNr">141 </span> <a href='003trace.cc.html#L174'>raise</a> << <span class="Constant">" called from "</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name << <span class="Constant">": "</span> << to_original_string<span class="Delimiter">(</span><a href='026call.cc.html#L88'>to_instruction</a><span class="Delimiter">(</span>*p<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L203'>end</a><span class="Delimiter">();</span> +<span id="L142" class="LineNr">142 </span><span class="Delimiter">}</span> +<span id="L143" class="LineNr">143 </span> +<span id="L144" class="LineNr">144 </span><span class="Delimiter">:(after "Defined Recipe Checks")</span> +<span id="L145" class="LineNr">145 </span><span class="Comment">// not a primitive; check that it's present in the book of recipes</span> +<span id="L146" class="LineNr">146 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L147" class="LineNr">147 </span> <a href='003trace.cc.html#L174'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"undefined operation in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L203'>end</a><span class="Delimiter">();</span> +<span id="L148" class="LineNr">148 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L149" class="LineNr">149 </span><span class="Delimiter">}</span> +<span id="L150" class="LineNr">150 </span><span class="Delimiter">:(replace{} "default:" following "End Primitive Recipe Implementations")</span> +<span id="L151" class="LineNr">151 </span><span class="Normal">default</span>: <span class="Delimiter">{</span> +<span id="L152" class="LineNr">152 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// error already raised in Checks above</span> +<span id="L153" class="LineNr">153 </span> <span class="Comment">// not a primitive; look up the book of recipes</span> +<span id="L154" class="LineNr">154 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L155" class="LineNr">155 </span> ++Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> +<span id="L156" class="LineNr">156 </span> <a href='003trace.cc.html#L167'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"incrementing callstack depth to "</span> << Trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L203'>end</a><span class="Delimiter">();</span> +<span id="L157" class="LineNr">157 </span> assert<span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> +<span id="L158" class="LineNr">158 </span> <span class="Delimiter">}</span> +<span id="L159" class="LineNr">159 </span> <span class="Normal">const</span> call& caller_frame = <a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">();</span> +<span id="L160" class="LineNr">160 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>call<span class="Delimiter">(</span><a href='026call.cc.html#L88'>to_instruction</a><span class="Delimiter">(</span>caller_frame<span class="Delimiter">).</span>operation<span class="Delimiter">));</span> +<span id="L161" class="LineNr">161 </span> finish_call_housekeeping<span class="Delimiter">(</span><a href='026call.cc.html#L88'>to_instruction</a><span class="Delimiter">(</span>caller_frame<span class="Delimiter">),</span> ingredients<span class="Delimiter">);</span> +<span id="L162" class="LineNr">162 </span> <span class="Comment">// not done with caller</span> +<span id="L163" class="LineNr">163 </span> write_products = <span class="Constant">false</span><span class="Delimiter">;</span> +<span id="L164" class="LineNr">164 </span> fall_through_to_next_instruction = <span class="Constant">false</span><span class="Delimiter">;</span> +<span id="L165" class="LineNr">165 </span> <span class="Comment">// End Non-primitive Call(caller_frame)</span> +<span id="L166" class="LineNr">166 </span> <span class="Delimiter">}</span> +<span id="L167" class="LineNr">167 </span><span class="Delimiter">}</span> +<span id="L168" class="LineNr">168 </span><span class="Delimiter">:(code)</span> +<span id="L169" class="LineNr">169 </span><span class="Normal">void</span> finish_call_housekeeping<span class="Delimiter">(</span><span class="Normal">const</span> instruction& call_instruction<span class="Delimiter">,</span> <span class="Normal">const</span> vector<vector<<span class="Normal">double</span>> >& ingredients<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L170" class="LineNr">170 </span> <span class="Comment">// End Call Housekeeping</span> +<span id="L171" class="LineNr">171 </span><span class="Delimiter">}</span> +<span id="L172" class="LineNr">172 </span> +<span id="L173" class="LineNr">173 </span><span class="Delimiter">:(scenario calling_undefined_recipe_fails)</span> +<span id="L174" class="LineNr">174 </span><span class="Special">% Hide_errors = true;</span> +<span id="L175" class="LineNr">175 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L176" class="LineNr">176 </span> foo +<span id="L177" class="LineNr">177 </span>] +<span id="L178" class="LineNr">178 </span><span class="traceContains">+error: <a href='000organization.cc.html#L113'>main</a>: undefined operation in 'foo'</span> +<span id="L179" class="LineNr">179 </span> +<span id="L180" class="LineNr">180 </span><span class="Delimiter">:(scenario calling_undefined_recipe_handles_missing_result)</span> +<span id="L181" class="LineNr">181 </span><span class="Special">% Hide_errors = true;</span> +<span id="L182" class="LineNr">182 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ +<span id="L183" class="LineNr">183 </span> <span class="Normal">x</span>:num<span class="Special"> <- </span>foo +<span id="L184" class="LineNr">184 </span>] +<span id="L185" class="LineNr">185 </span><span class="traceContains">+error: <a href='000organization.cc.html#L113'>main</a>: undefined operation in 'x:num <- foo'</span> +<span id="L186" class="LineNr">186 </span> +<span id="L187" class="LineNr">187 </span><span class="SalientComment">//:: finally, we need to fix the termination conditions for the run loop</span> +<span id="L188" class="LineNr">188 </span> +<span id="L189" class="LineNr">189 </span><span class="Delimiter">:(replace{} "bool routine::completed() const")</span> +<span id="L190" class="LineNr">190 </span><span class="Normal">bool</span> routine::completed<span class="Delimiter">()</span> <span class="Normal">const</span> <span class="Delimiter">{</span> +<span id="L191" class="LineNr">191 </span> <span class="Identifier">return</span> calls<span class="Delimiter">.</span>empty<span class="Delimiter">();</span> +<span id="L192" class="LineNr">192 </span><span class="Delimiter">}</span> +<span id="L193" class="LineNr">193 </span> +<span id="L194" class="LineNr">194 </span><span class="Delimiter">:(replace{} "const vector<instruction>& routine::steps() const")</span> +<span id="L195" class="LineNr">195 </span><span class="Normal">const</span> vector<instruction>& routine::steps<span class="Delimiter">()</span> <span class="Normal">const</span> <span class="Delimiter">{</span> +<span id="L196" class="LineNr">196 </span> assert<span class="Delimiter">(</span>!calls<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L197" class="LineNr">197 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">;</span> +<span id="L198" class="LineNr">198 </span><span class="Delimiter">}</span> +<span id="L199" class="LineNr">199 </span> +<span id="L200" class="LineNr">200 </span><span class="Delimiter">:(after "Running One Instruction")</span> +<span id="L201" class="LineNr">201 </span><span class="Comment">// when we reach the end of one call, we may reach the end of the one below</span> +<span id="L202" class="LineNr">202 </span><span class="Comment">// it, and the one below that, and so on</span> +<span id="L203" class="LineNr">203 </span><span class="Normal">while</span> <span class="Delimiter">(</span><a href='026call.cc.html#L84'>current_step_index</a><span class="Delimiter">()</span> >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>steps<span class="Delimiter">()))</span> <span class="Delimiter">{</span> +<span id="L204" class="LineNr">204 </span> <span class="Comment">// Falling Through End Of Recipe</span> +<span id="L205" class="LineNr">205 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L206" class="LineNr">206 </span> <a href='003trace.cc.html#L167'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"fall-through: exiting "</span> << <a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">()</span> << <span class="Constant">"; decrementing callstack depth from "</span> << Trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L203'>end</a><span class="Delimiter">();</span> +<span id="L207" class="LineNr">207 </span> --Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> +<span id="L208" class="LineNr">208 </span> assert<span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth >= <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L209" class="LineNr">209 </span> <span class="Delimiter">}</span> +<span id="L210" class="LineNr">210 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> +<span id="L211" class="LineNr">211 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">goto</span> stop_running_current_routine<span class="Delimiter">;</span> +<span id="L212" class="LineNr">212 </span> <span class="Comment">// Complete Call Fallthrough</span> +<span id="L213" class="LineNr">213 </span> <span class="Comment">// todo: fail if no products returned</span> +<span id="L214" class="LineNr">214 </span> ++current_step_index<span class="Delimiter">();</span> +<span id="L215" class="LineNr">215 </span><span class="Delimiter">}</span> +<span id="L216" class="LineNr">216 </span> +<span id="L217" class="LineNr">217 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> +<span id="L218" class="LineNr">218 </span>_DUMP_CALL_STACK<span class="Delimiter">,</span> +<span id="L219" class="LineNr">219 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> +<span id="L220" class="LineNr">220 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$dump-call-stack"</span><span class="Delimiter">,</span> _DUMP_CALL_STACK<span class="Delimiter">);</span> +<span id="L221" class="LineNr">221 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> +<span id="L222" class="LineNr">222 </span><span class="Normal">case</span> _DUMP_CALL_STACK: <span class="Delimiter">{</span> +<span id="L223" class="LineNr">223 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L224" class="LineNr">224 </span><span class="Delimiter">}</span> +<span id="L225" class="LineNr">225 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> +<span id="L226" class="LineNr">226 </span><span class="Normal">case</span> _DUMP_CALL_STACK: <span class="Delimiter">{</span> +<span id="L227" class="LineNr">227 </span> <a href='003trace.cc.html#L120'>dump</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">);</span> +<span id="L228" class="LineNr">228 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L229" class="LineNr">229 </span><span class="Delimiter">}</span> +<span id="L230" class="LineNr">230 </span><span class="Delimiter">:(code)</span> +<span id="L231" class="LineNr">231 </span><span class="Normal">void</span> <a href='003trace.cc.html#L120'>dump</a><span class="Delimiter">(</span><span class="Normal">const</span> call_stack& calls<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L232" class="LineNr">232 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::const_reverse_iterator p = calls<span class="Delimiter">.</span>rbegin<span class="Delimiter">();</span> p != calls<span class="Delimiter">.</span>rend<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> +<span id="L233" class="LineNr">233 </span> cerr << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name << <span class="Constant">":"</span> << p<span class="Delimiter">-></span>running_step_index << <span class="Constant">" -- "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L88'>to_instruction</a><span class="Delimiter">(</span>*p<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L234" class="LineNr">234 </span><span class="Delimiter">}</span> </pre> </body> </html> |