diff options
Diffstat (limited to 'html/072scheduler.cc.html')
-rw-r--r-- | html/072scheduler.cc.html | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/html/072scheduler.cc.html b/html/072scheduler.cc.html index 746d808c..811770b5 100644 --- a/html/072scheduler.cc.html +++ b/html/072scheduler.cc.html @@ -86,9 +86,9 @@ if ('onhashchange' in window) { <span id="L25" class="LineNr"> 25 </span><span class="Delimiter">:(before "Running One Instruction")</span> <span id="L26" class="LineNr"> 26 </span> ++Current_routine<span class="Delimiter">-></span>instructions_run_this_scheduling_slice<span class="Delimiter">;</span> <span id="L27" class="LineNr"> 27 </span><span class="Delimiter">:(replace{} "bool should_continue_running(const routine* current_routine)")</span> -<span id="L28" class="LineNr"> 28 </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> +<span id="L28" class="LineNr"> 28 </span><span class="Normal">bool</span> <a href='072scheduler.cc.html#L28'>should_continue_running</a><span class="Delimiter">(</span><span class="Normal">const</span> routine* current_routine<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L29" class="LineNr"> 29 </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 id="L30" class="LineNr"> 30 </span> <span class="Identifier">return</span> Current_routine<span class="Delimiter">-></span>state == RUNNING +<span id="L30" class="LineNr"> 30 </span> <span class="Identifier">return</span> Current_routine<span class="Delimiter">-></span>state == <a href='072scheduler.cc.html#L41'>RUNNING</a> <span id="L31" class="LineNr"> 31 </span> && Current_routine<span class="Delimiter">-></span>instructions_run_this_scheduling_slice < Scheduling_interval<span class="Delimiter">;</span> <span id="L32" class="LineNr"> 32 </span><span class="Delimiter">}</span> <span id="L33" class="LineNr"> 33 </span><span class="Delimiter">:(after "stop_running_current_routine:")</span> @@ -98,24 +98,24 @@ if ('onhashchange' in window) { <span id="L37" class="LineNr"> 37 </span><span class="Comment">//: now the rest of the scheduler is clean</span> <span id="L38" class="LineNr"> 38 </span> <span id="L39" class="LineNr"> 39 </span><span class="Delimiter">:(before "struct routine")</span> -<span id="L40" class="LineNr"> 40 </span><span class="Normal">enum</span> routine_state <span class="Delimiter">{</span> -<span id="L41" class="LineNr"> 41 </span> RUNNING<span class="Delimiter">,</span> -<span id="L42" class="LineNr"> 42 </span> COMPLETED<span class="Delimiter">,</span> +<span id="L40" class="LineNr"> 40 </span><span class="Normal">enum</span> <a href='072scheduler.cc.html#L40'>routine_state</a> <span class="Delimiter">{</span> +<span id="L41" class="LineNr"> 41 </span> <a href='072scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">,</span> +<span id="L42" class="LineNr"> 42 </span> <a href='072scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">,</span> <span id="L43" class="LineNr"> 43 </span> <span class="Comment">// End routine States</span> <span id="L44" class="LineNr"> 44 </span><span class="Delimiter">};</span> <span id="L45" class="LineNr"> 45 </span><span class="Delimiter">:(before "End routine Fields")</span> -<span id="L46" class="LineNr"> 46 </span><span class="Normal">enum</span> routine_state state<span class="Delimiter">;</span> +<span id="L46" class="LineNr"> 46 </span><span class="Normal">enum</span> <a href='072scheduler.cc.html#L40'>routine_state</a> state<span class="Delimiter">;</span> <span id="L47" class="LineNr"> 47 </span><span class="Delimiter">:(before "End routine Constructor")</span> -<span id="L48" class="LineNr"> 48 </span>state = RUNNING<span class="Delimiter">;</span> +<span id="L48" class="LineNr"> 48 </span>state = <a href='072scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">;</span> <span id="L49" class="LineNr"> 49 </span> <span id="L50" class="LineNr"> 50 </span><span class="Delimiter">:(before "End Globals")</span> <span id="L51" class="LineNr"> 51 </span>vector<routine*> Routines<span class="Delimiter">;</span> <span id="L52" class="LineNr"> 52 </span><span class="Normal">int</span> Current_routine_index = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L53" class="LineNr"> 53 </span><span class="Delimiter">:(before "End Setup")</span> <span id="L54" class="LineNr"> 54 </span>Scheduling_interval = <span class="Constant">500</span><span class="Delimiter">;</span> -<span id="L55" class="LineNr"> 55 </span>Routines<span class="Delimiter">.</span>clear<span class="Delimiter">();</span> -<span id="L56" class="LineNr"> 56 </span><span class="Delimiter">:(replace{} "void run(const recipe_ordinal r)")</span> -<span id="L57" class="LineNr"> 57 </span><span class="Normal">void</span> run<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L55" class="LineNr"> 55 </span>Routines<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L56" class="LineNr"> 56 </span><span class="Delimiter">:(replace{} "void run(const <a href='010vm.cc.html#L14'>recipe_ordinal</a> r)")</span> +<span id="L57" class="LineNr"> 57 </span><span class="Normal">void</span> run<span class="Delimiter">(</span><span class="Normal">const</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L58" class="LineNr"> 58 </span> run<span class="Delimiter">(</span><span class="Normal">new</span> routine<span class="Delimiter">(</span>r<span class="Delimiter">));</span> <span id="L59" class="LineNr"> 59 </span><span class="Delimiter">}</span> <span id="L60" class="LineNr"> 60 </span> @@ -124,14 +124,14 @@ if ('onhashchange' in window) { <span id="L63" class="LineNr"> 63 </span> Routines<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>rr<span class="Delimiter">);</span> <span id="L64" class="LineNr"> 64 </span> Current_routine_index = <span class="Constant">0</span><span class="Delimiter">,</span> Current_routine = Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L65" class="LineNr"> 65 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>!all_routines_done<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L66" class="LineNr"> 66 </span> skip_to_next_routine<span class="Delimiter">();</span> +<span id="L66" class="LineNr"> 66 </span> <a href='072scheduler.cc.html#L91'>skip_to_next_routine</a><span class="Delimiter">();</span> <span id="L67" class="LineNr"> 67 </span> assert<span class="Delimiter">(</span>Current_routine<span class="Delimiter">);</span> -<span id="L68" class="LineNr"> 68 </span> assert<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>state == RUNNING<span class="Delimiter">);</span> -<span id="L69" class="LineNr"> 69 </span> trace<span class="Delimiter">(</span><span class="Constant">9990</span><span class="Delimiter">,</span> <span class="Constant">"schedule"</span><span class="Delimiter">)</span> << current_routine_label<span class="Delimiter">()</span> << end<span class="Delimiter">();</span> +<span id="L68" class="LineNr"> 68 </span> assert<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>state == <a href='072scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">);</span> +<span id="L69" class="LineNr"> 69 </span> <a href='003trace.cc.html#L171'>trace</a><span class="Delimiter">(</span><span class="Constant">9990</span><span class="Delimiter">,</span> <span class="Constant">"schedule"</span><span class="Delimiter">)</span> << <a href='072scheduler.cc.html#L103'>current_routine_label</a><span class="Delimiter">()</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L70" class="LineNr"> 70 </span> run_current_routine<span class="Delimiter">();</span> <span id="L71" class="LineNr"> 71 </span> <span class="Comment">// Scheduler State Transitions</span> <span id="L72" class="LineNr"> 72 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>completed<span class="Delimiter">())</span> -<span id="L73" class="LineNr"> 73 </span> Current_routine<span class="Delimiter">-></span>state = COMPLETED<span class="Delimiter">;</span> +<span id="L73" class="LineNr"> 73 </span> Current_routine<span class="Delimiter">-></span>state = <a href='072scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">;</span> <span id="L74" class="LineNr"> 74 </span> <span class="Comment">// End Scheduler State Transitions</span> <span id="L75" class="LineNr"> 75 </span> <span id="L76" class="LineNr"> 76 </span> <span class="Comment">// Scheduler Cleanup</span> @@ -140,20 +140,20 @@ if ('onhashchange' in window) { <span id="L79" class="LineNr"> 79 </span> <span class="Comment">// End Run Routine</span> <span id="L80" class="LineNr"> 80 </span><span class="Delimiter">}</span> <span id="L81" class="LineNr"> 81 </span> -<span id="L82" class="LineNr"> 82 </span><span class="Normal">bool</span> all_routines_done<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L83" class="LineNr"> 83 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L84" class="LineNr"> 84 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state == RUNNING<span class="Delimiter">)</span> +<span id="L82" class="LineNr"> 82 </span><span class="Normal">bool</span> <a href='072scheduler.cc.html#L82'>all_routines_done</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> +<span id="L83" class="LineNr"> 83 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L84" class="LineNr"> 84 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state == <a href='072scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">)</span> <span id="L85" class="LineNr"> 85 </span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L86" class="LineNr"> 86 </span> <span class="Delimiter">}</span> <span id="L87" class="LineNr"> 87 </span> <span class="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span> <span id="L88" class="LineNr"> 88 </span><span class="Delimiter">}</span> <span id="L89" class="LineNr"> 89 </span> <span id="L90" class="LineNr"> 90 </span><span class="Comment">// skip Current_routine_index past non-RUNNING routines</span> -<span id="L91" class="LineNr"> 91 </span><span class="Normal">void</span> skip_to_next_routine<span class="Delimiter">()</span> <span class="Delimiter">{</span> +<span id="L91" class="LineNr"> 91 </span><span class="Normal">void</span> <a href='072scheduler.cc.html#L91'>skip_to_next_routine</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> <span id="L92" class="LineNr"> 92 </span> assert<span class="Delimiter">(</span>!Routines<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L93" class="LineNr"> 93 </span> assert<span class="Delimiter">(</span>Current_routine_index < SIZE<span class="Delimiter">(</span>Routines<span class="Delimiter">));</span> +<span id="L93" class="LineNr"> 93 </span> assert<span class="Delimiter">(</span>Current_routine_index < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">));</span> <span id="L94" class="LineNr"> 94 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Delimiter">(</span>Current_routine_index+<span class="Constant">1</span><span class="Delimiter">)</span>%SIZE<span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> i != Current_routine_index<span class="Delimiter">;</span> i = <span class="Delimiter">(</span>i+<span class="Constant">1</span><span class="Delimiter">)</span>%SIZE<span class="Delimiter">(</span>Routines<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L95" class="LineNr"> 95 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state == RUNNING<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L95" class="LineNr"> 95 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state == <a href='072scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L96" class="LineNr"> 96 </span> Current_routine_index = i<span class="Delimiter">;</span> <span id="L97" class="LineNr"> 97 </span> Current_routine = Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L98" class="LineNr"> 98 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> @@ -161,14 +161,14 @@ if ('onhashchange' in window) { <span id="L100" class="LineNr">100 </span> <span class="Delimiter">}</span> <span id="L101" class="LineNr">101 </span><span class="Delimiter">}</span> <span id="L102" class="LineNr">102 </span> -<span id="L103" class="LineNr">103 </span>string current_routine_label<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L104" class="LineNr">104 </span> <span class="Identifier">return</span> routine_label<span class="Delimiter">(</span>Current_routine<span class="Delimiter">);</span> +<span id="L103" class="LineNr">103 </span>string <a href='072scheduler.cc.html#L103'>current_routine_label</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> +<span id="L104" class="LineNr">104 </span> <span class="Identifier">return</span> <a href='072scheduler.cc.html#L107'>routine_label</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">);</span> <span id="L105" class="LineNr">105 </span><span class="Delimiter">}</span> <span id="L106" class="LineNr">106 </span> -<span id="L107" class="LineNr">107 </span>string routine_label<span class="Delimiter">(</span>routine* r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L107" class="LineNr">107 </span>string <a href='072scheduler.cc.html#L107'>routine_label</a><span class="Delimiter">(</span>routine* r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L108" class="LineNr">108 </span> ostringstream result<span class="Delimiter">;</span> <span id="L109" class="LineNr">109 </span> <span class="Normal">const</span> call_stack& calls = r<span class="Delimiter">-></span>calls<span class="Delimiter">;</span> -<span id="L110" class="LineNr">110 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::const_iterator p = calls<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != calls<span class="Delimiter">.</span>end<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L110" class="LineNr">110 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::const_iterator p = calls<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != calls<span class="Delimiter">.</span><a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L111" class="LineNr">111 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>p != calls<span class="Delimiter">.</span>begin<span class="Delimiter">())</span> result << <span class="Constant">'/'</span><span class="Delimiter">;</span> <span id="L112" class="LineNr">112 </span> result << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name<span class="Delimiter">;</span> <span id="L113" class="LineNr">113 </span> <span class="Delimiter">}</span> @@ -176,15 +176,15 @@ if ('onhashchange' in window) { <span id="L115" class="LineNr">115 </span><span class="Delimiter">}</span> <span id="L116" class="LineNr">116 </span> <span id="L117" class="LineNr">117 </span><span class="Delimiter">:(before "End Teardown")</span> -<span id="L118" class="LineNr">118 </span><span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> +<span id="L118" class="LineNr">118 </span><span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L119" class="LineNr">119 </span> <span class="Normal">delete</span> Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L120" class="LineNr">120 </span>Routines<span class="Delimiter">.</span>clear<span class="Delimiter">();</span> +<span id="L120" class="LineNr">120 </span>Routines<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L121" class="LineNr">121 </span>Current_routine = <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L122" class="LineNr">122 </span> <span id="L123" class="LineNr">123 </span><span class="Comment">//: special case for the very first routine</span> <span id="L124" class="LineNr">124 </span><span class="Delimiter">:(replace{} "void run_main(int argc, char* argv[])")</span> -<span id="L125" class="LineNr">125 </span><span class="Normal">void</span> run_main<span class="Delimiter">(</span><span class="Normal">int</span> argc<span class="Delimiter">,</span> <span class="Normal">char</span>* argv[]<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L126" class="LineNr">126 </span> recipe_ordinal r = get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">);</span> +<span id="L125" class="LineNr">125 </span><span class="Normal">void</span> <a href='072scheduler.cc.html#L125'>run_main</a><span class="Delimiter">(</span><span class="Normal">int</span> argc<span class="Delimiter">,</span> <span class="Normal">char</span>* argv[]<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L126" class="LineNr">126 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r = get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">);</span> <span id="L127" class="LineNr">127 </span> assert<span class="Delimiter">(</span>r<span class="Delimiter">);</span> <span id="L128" class="LineNr">128 </span> routine* main_routine = <span class="Normal">new</span> routine<span class="Delimiter">(</span>r<span class="Delimiter">);</span> <span id="L129" class="LineNr">129 </span> <span class="Comment">// pass in commandline args as ingredients to main</span> @@ -192,9 +192,9 @@ if ('onhashchange' in window) { <span id="L131" class="LineNr">131 </span> Current_routine = main_routine<span class="Delimiter">;</span> <span id="L132" class="LineNr">132 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">1</span><span class="Delimiter">;</span> i < argc<span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L133" class="LineNr">133 </span> vector<<span class="Normal">double</span>> arg<span class="Delimiter">;</span> -<span id="L134" class="LineNr">134 </span> arg<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>new_mu_text<span class="Delimiter">(</span>argv[i]<span class="Delimiter">));</span> +<span id="L134" class="LineNr">134 </span> arg<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='038new_text.cc.html#L38'>new_mu_text</a><span class="Delimiter">(</span>argv[i]<span class="Delimiter">));</span> <span id="L135" class="LineNr">135 </span> assert<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> arg<span class="Delimiter">.</span>back<span class="Delimiter">())</span> == <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L136" class="LineNr">136 </span> put<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> arg<span class="Delimiter">.</span>back<span class="Delimiter">(),</span> <span class="Constant">1</span><span class="Delimiter">);</span> <span class="Comment">// update refcount</span> +<span id="L136" class="LineNr">136 </span> <a href='001help.cc.html#L218'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> arg<span class="Delimiter">.</span>back<span class="Delimiter">(),</span> <span class="Constant">1</span><span class="Delimiter">);</span> <span class="Comment">// update refcount</span> <span id="L137" class="LineNr">137 </span> current_call<span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>arg<span class="Delimiter">);</span> <span id="L138" class="LineNr">138 </span> <span class="Delimiter">}</span> <span id="L139" class="LineNr">139 </span> run<span class="Delimiter">(</span>main_routine<span class="Delimiter">);</span> @@ -224,15 +224,15 @@ if ('onhashchange' in window) { <span id="L163" class="LineNr">163 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L164" class="LineNr">164 </span>START_RUNNING<span class="Delimiter">,</span> <span id="L165" class="LineNr">165 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L166" class="LineNr">166 </span>put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"start-running"</span><span class="Delimiter">,</span> START_RUNNING<span class="Delimiter">);</span> +<span id="L166" class="LineNr">166 </span><a href='001help.cc.html#L218'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"start-running"</span><span class="Delimiter">,</span> START_RUNNING<span class="Delimiter">);</span> <span id="L167" class="LineNr">167 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L168" class="LineNr">168 </span><span class="Normal">case</span> START_RUNNING: <span class="Delimiter">{</span> <span id="L169" class="LineNr">169 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L170" class="LineNr">170 </span> raise << maybe<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">"'start-running' requires at least one ingredient: the recipe to start running</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L170" class="LineNr">170 </span> <a href='003trace.cc.html#L178'>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">"'start-running' requires at least one ingredient: the <a href='010vm.cc.html#L19'>recipe</a> to start running</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L171" class="LineNr">171 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L172" class="LineNr">172 </span> <span class="Delimiter">}</span> <span id="L173" class="LineNr">173 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_recipe<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L174" class="LineNr">174 </span> raise << maybe<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">"first ingredient of 'start-running' should be a recipe, but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L174" class="LineNr">174 </span> <a href='003trace.cc.html#L178'>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">"first ingredient of 'start-running' should be a <a href='010vm.cc.html#L19'>recipe</a>, but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L175" class="LineNr">175 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L176" class="LineNr">176 </span> <span class="Delimiter">}</span> <span id="L177" class="LineNr">177 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -242,7 +242,7 @@ if ('onhashchange' in window) { <span id="L181" class="LineNr">181 </span> routine* new_routine = <span class="Normal">new</span> routine<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> <span id="L182" class="LineNr">182 </span> new_routine<span class="Delimiter">-></span>parent_index = Current_routine_index<span class="Delimiter">;</span> <span id="L183" class="LineNr">183 </span> <span class="Comment">// populate ingredients</span> -<span id="L184" class="LineNr">184 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">1</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L184" class="LineNr">184 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">1</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L185" class="LineNr">185 </span> new_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span id="L186" class="LineNr">186 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> ingredient = current_instruction<span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L187" class="LineNr">187 </span> canonize_type<span class="Delimiter">(</span>ingredient<span class="Delimiter">);</span> @@ -314,14 +314,14 @@ if ('onhashchange' in window) { <span id="L253" class="LineNr">253 </span><span class="traceContains">+error: f1: ingredient 0 has the wrong type at 'start-running f2, 3'</span> <span id="L254" class="LineNr">254 </span> <span id="L255" class="LineNr">255 </span><span class="Comment">// 'start-running' only uses the ingredients of the callee, not its products</span> -<span id="L256" class="LineNr">256 </span><span class="Delimiter">:(before "End is_indirect_call_with_ingredients Special-cases")</span> +<span id="L256" class="LineNr">256 </span><span class="Delimiter">:(before "End <a href='071recipe.cc.html#L189'>is_indirect_call_with_ingredients</a> Special-cases")</span> <span id="L257" class="LineNr">257 </span><span class="Normal">if</span> <span class="Delimiter">(</span>r == START_RUNNING<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span> <span id="L258" class="LineNr">258 </span> <span id="L259" class="LineNr">259 </span><span class="Comment">//: more complex: refcounting management when starting up new routines</span> <span id="L260" class="LineNr">260 </span> <span id="L261" class="LineNr">261 </span><span class="Delimiter">:(scenario start_running_immediately_updates_refcounts_of_ingredients)</span> <span id="L262" class="LineNr">262 </span><span class="Special">% Scheduling_interval = 1;</span> -<span id="L263" class="LineNr">263 </span><span class="muRecipe">def</span> main [ +<span id="L263" class="LineNr">263 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ <span id="L264" class="LineNr">264 </span> local-scope <span id="L265" class="LineNr">265 </span> create-<span class="Normal">new</span>-routine <span id="L266" class="LineNr">266 </span> <span class="Comment"># padding to make sure we run new-routine before returning</span> @@ -347,12 +347,12 @@ if ('onhashchange' in window) { <span id="L286" class="LineNr">286 </span><span class="Comment">//: ingredients right at call time, and stop incrementing refcounts inside</span> <span id="L287" class="LineNr">287 </span><span class="Comment">//: next-ingredient</span> <span id="L288" class="LineNr">288 </span><span class="Delimiter">:(before "End Populate Call Ingredient")</span> -<span id="L289" class="LineNr">289 </span>increment_any_refcounts<span class="Delimiter">(</span>ingredient<span class="Delimiter">,</span> ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> +<span id="L289" class="LineNr">289 </span><a href='036refcount.cc.html#L34'>increment_any_refcounts</a><span class="Delimiter">(</span>ingredient<span class="Delimiter">,</span> ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span id="L290" class="LineNr">290 </span><span class="Delimiter">:(before "End Populate start-running Ingredient")</span> -<span id="L291" class="LineNr">291 </span>increment_any_refcounts<span class="Delimiter">(</span>ingredient<span class="Delimiter">,</span> ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> -<span id="L292" class="LineNr">292 </span><span class="Delimiter">:(before "End should_update_refcounts_in_write_memory Special-cases For Primitives")</span> +<span id="L291" class="LineNr">291 </span><a href='036refcount.cc.html#L34'>increment_any_refcounts</a><span class="Delimiter">(</span>ingredient<span class="Delimiter">,</span> ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> +<span id="L292" class="LineNr">292 </span><span class="Delimiter">:(before "End <a href='043space.cc.html#L285'>should_update_refcounts_in_write_memory</a> Special-cases For Primitives")</span> <span id="L293" class="LineNr">293 </span><span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation == NEXT_INGREDIENT || inst<span class="Delimiter">.</span>operation == NEXT_INGREDIENT_WITHOUT_TYPECHECKING<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L294" class="LineNr">294 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>space_index<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<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="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span> +<span id="L294" class="LineNr">294 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='044space_surround.cc.html#L52'>space_index</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<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="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span> <span id="L295" class="LineNr">295 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>has_property<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">),</span> <span class="Constant">"raw"</span><span class="Delimiter">))</span> <span class="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span> <span id="L296" class="LineNr">296 </span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L297" class="LineNr">297 </span><span class="Delimiter">}</span> @@ -360,7 +360,7 @@ if ('onhashchange' in window) { <span id="L299" class="LineNr">299 </span><span class="Comment">// ensure this works with indirect calls using 'call' as well</span> <span id="L300" class="LineNr">300 </span><span class="Delimiter">:(scenario start_running_immediately_updates_refcounts_of_ingredients_of_indirect_calls)</span> <span id="L301" class="LineNr">301 </span><span class="Special">% Scheduling_interval = 1;</span> -<span id="L302" class="LineNr">302 </span><span class="muRecipe">def</span> main [ +<span id="L302" class="LineNr">302 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ <span id="L303" class="LineNr">303 </span> local-scope <span id="L304" class="LineNr">304 </span> <span class="Normal">n</span>:&:num<span class="Special"> <- </span><span class="Normal">new</span> <span class="Constant">number:type</span> <span id="L305" class="LineNr">305 </span> *n<span class="Special"> <- </span>copy <span class="Constant">34</span> @@ -387,7 +387,7 @@ if ('onhashchange' in window) { <span id="L326" class="LineNr">326 </span> <span class="Normal">n2</span>:num<span class="Special"> <- </span>add *n/space:<span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">1</span> <span id="L327" class="LineNr">327 </span> <span class="Identifier">return</span> n2 <span id="L328" class="LineNr">328 </span>] -<span id="L329" class="LineNr">329 </span><span class="muRecipe">def</span> main [ +<span id="L329" class="LineNr">329 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ <span id="L330" class="LineNr">330 </span> local-scope <span id="L331" class="LineNr">331 </span> <span class="Normal">n</span>:&:num<span class="Special"> <- </span>copy <span class="Constant">12000</span>/unsafe <span class="Comment"># pretend allocation with a known address</span> <span id="L332" class="LineNr">332 </span> *n<span class="Special"> <- </span>copy <span class="Constant">23</span> @@ -413,8 +413,8 @@ if ('onhashchange' in window) { <span id="L352" class="LineNr">352 </span><span class="Comment">//: this scenario will require some careful setup in escaped C++</span> <span id="L353" class="LineNr">353 </span><span class="Comment">//: (straining our tangle capabilities to near-breaking point)</span> <span id="L354" class="LineNr">354 </span><span class="Delimiter">:(scenario scheduler_skips_completed_routines)</span> -<span id="L355" class="LineNr">355 </span><span class="Special">% recipe_ordinal f1 = load("recipe f1 [\n1:num <- copy 0\n]\n").front();</span> -<span id="L356" class="LineNr">356 </span><span class="Special">% recipe_ordinal f2 = load("recipe f2 [\n2:num <- copy 0\n]\n").front();</span> +<span id="L355" class="LineNr">355 </span><span class="Special">% <a href='010vm.cc.html#L14'>recipe_ordinal</a> f1 = load("recipe f1 [\n1:num <- copy 0\n]\n").front();</span> +<span id="L356" class="LineNr">356 </span><span class="Special">% <a href='010vm.cc.html#L14'>recipe_ordinal</a> f2 = load("recipe f2 [\n2:num <- copy 0\n]\n").front();</span> <span id="L357" class="LineNr">357 </span><span class="Special">% Routines.push_back(new routine(f1)); // f1 meant to run</span> <span id="L358" class="LineNr">358 </span><span class="Special">% Routines.push_back(new routine(f2));</span> <span id="L359" class="LineNr">359 </span><span class="Special">% Routines.back()->state = COMPLETED; // f2 not meant to run</span> @@ -459,15 +459,15 @@ if ('onhashchange' in window) { <span id="L398" class="LineNr">398 </span><span class="traceContains">+error: f2: divide by zero in '3:num <- divide-with-remainder 4, 0'</span> <span id="L399" class="LineNr">399 </span><span class="traceAbsent">-error: f2: divide by zero in '4:num <- divide-with-remainder 4, 0'</span> <span id="L400" class="LineNr">400 </span> -<span id="L401" class="LineNr">401 </span><span class="Delimiter">:(after "operator<<(ostream& os, unused end)")</span> +<span id="L401" class="LineNr">401 </span><span class="Delimiter">:(after "operator<<(ostream& os, <a href='001help.cc.html#L255'>unused</a> end)")</span> <span id="L402" class="LineNr">402 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream && Trace_stream<span class="Delimiter">-></span>curr_label == <span class="Constant">"error"</span> && Current_routine<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L403" class="LineNr">403 </span> Current_routine<span class="Delimiter">-></span>state = COMPLETED<span class="Delimiter">;</span> +<span id="L403" class="LineNr">403 </span> Current_routine<span class="Delimiter">-></span>state = <a href='072scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">;</span> <span id="L404" class="LineNr">404 </span> <span class="Delimiter">}</span> <span id="L405" class="LineNr">405 </span> <span id="L406" class="LineNr">406 </span><span class="SalientComment">//:: Routines are marked completed when their parent completes.</span> <span id="L407" class="LineNr">407 </span> <span id="L408" class="LineNr">408 </span><span class="Delimiter">:(scenario scheduler_kills_orphans)</span> -<span id="L409" class="LineNr">409 </span><span class="muRecipe">def</span> main [ +<span id="L409" class="LineNr">409 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ <span id="L410" class="LineNr">410 </span> start-running f1 <span id="L411" class="LineNr">411 </span> <span class="Comment"># f1 never actually runs because its parent completes without waiting for it</span> <span id="L412" class="LineNr">412 </span>] @@ -477,19 +477,19 @@ if ('onhashchange' in window) { <span id="L416" class="LineNr">416 </span><span class="traceAbsent">-schedule: f1</span> <span id="L417" class="LineNr">417 </span> <span id="L418" class="LineNr">418 </span><span class="Delimiter">:(before "End Scheduler Cleanup")</span> -<span id="L419" class="LineNr">419 </span><span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L420" class="LineNr">420 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state == COMPLETED<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L419" class="LineNr">419 </span><span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L420" class="LineNr">420 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state == <a href='072scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L421" class="LineNr">421 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>parent_index < <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// root thread</span> <span id="L422" class="LineNr">422 </span> <span class="Comment">// structured concurrency: <a href="http://250bpm.com/blog:71">http://250bpm.com/blog:71</a></span> <span id="L423" class="LineNr">423 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>has_completed_parent<span class="Delimiter">(</span>i<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L424" class="LineNr">424 </span> Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state = COMPLETED<span class="Delimiter">;</span> +<span id="L424" class="LineNr">424 </span> Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state = <a href='072scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">;</span> <span id="L425" class="LineNr">425 </span> <span class="Delimiter">}</span> <span id="L426" class="LineNr">426 </span><span class="Delimiter">}</span> <span id="L427" class="LineNr">427 </span> <span id="L428" class="LineNr">428 </span><span class="Delimiter">:(code)</span> <span id="L429" class="LineNr">429 </span><span class="Normal">bool</span> has_completed_parent<span class="Delimiter">(</span><span class="Normal">int</span> routine_index<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L430" class="LineNr">430 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> j = routine_index<span class="Delimiter">;</span> j >= <span class="Constant">0</span><span class="Delimiter">;</span> j = Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">)-></span>parent_index<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L431" class="LineNr">431 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">)-></span>state == COMPLETED<span class="Delimiter">)</span> +<span id="L431" class="LineNr">431 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">)-></span>state == <a href='072scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">)</span> <span id="L432" class="LineNr">432 </span> <span class="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span> <span id="L433" class="LineNr">433 </span> <span class="Delimiter">}</span> <span id="L434" class="LineNr">434 </span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> @@ -515,15 +515,15 @@ if ('onhashchange' in window) { <span id="L454" class="LineNr">454 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L455" class="LineNr">455 </span>ROUTINE_STATE<span class="Delimiter">,</span> <span id="L456" class="LineNr">456 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L457" class="LineNr">457 </span>put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"routine-state"</span><span class="Delimiter">,</span> ROUTINE_STATE<span class="Delimiter">);</span> +<span id="L457" class="LineNr">457 </span><a href='001help.cc.html#L218'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"routine-state"</span><span class="Delimiter">,</span> ROUTINE_STATE<span class="Delimiter">);</span> <span id="L458" class="LineNr">458 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L459" class="LineNr">459 </span><span class="Normal">case</span> ROUTINE_STATE: <span class="Delimiter">{</span> -<span id="L460" class="LineNr">460 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L461" class="LineNr">461 </span> raise << maybe<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">"'routine-state' requires exactly one ingredient, but got '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L460" class="LineNr">460 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L461" class="LineNr">461 </span> <a href='003trace.cc.html#L178'>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">"'routine-state' requires exactly one ingredient, but got '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L462" class="LineNr">462 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L463" class="LineNr">463 </span> <span class="Delimiter">}</span> <span id="L464" class="LineNr">464 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_number<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L465" class="LineNr">465 </span> raise << maybe<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">"first ingredient of 'routine-state' should be a routine id generated by 'start-running', but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L465" class="LineNr">465 </span> <a href='003trace.cc.html#L178'>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">"first ingredient of 'routine-state' should be a routine id generated by 'start-running', but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L466" class="LineNr">466 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L467" class="LineNr">467 </span> <span class="Delimiter">}</span> <span id="L468" class="LineNr">468 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -532,7 +532,7 @@ if ('onhashchange' in window) { <span id="L471" class="LineNr">471 </span><span class="Normal">case</span> ROUTINE_STATE: <span class="Delimiter">{</span> <span id="L472" class="LineNr">472 </span> <span class="Normal">int</span> id = ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L473" class="LineNr">473 </span> <span class="Normal">int</span> result = -<span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L474" class="LineNr">474 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L474" class="LineNr">474 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L475" class="LineNr">475 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>id == id<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L476" class="LineNr">476 </span> result = Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state<span class="Delimiter">;</span> <span id="L477" class="LineNr">477 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -548,15 +548,15 @@ if ('onhashchange' in window) { <span id="L487" class="LineNr">487 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L488" class="LineNr">488 </span>STOP<span class="Delimiter">,</span> <span id="L489" class="LineNr">489 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L490" class="LineNr">490 </span>put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"stop"</span><span class="Delimiter">,</span> STOP<span class="Delimiter">);</span> +<span id="L490" class="LineNr">490 </span><a href='001help.cc.html#L218'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"stop"</span><span class="Delimiter">,</span> STOP<span class="Delimiter">);</span> <span id="L491" class="LineNr">491 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L492" class="LineNr">492 </span><span class="Normal">case</span> STOP: <span class="Delimiter">{</span> -<span id="L493" class="LineNr">493 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L494" class="LineNr">494 </span> raise << maybe<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">"'stop' requires exactly one ingredient, but got '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L493" class="LineNr">493 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L494" class="LineNr">494 </span> <a href='003trace.cc.html#L178'>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">"'stop' requires exactly one ingredient, but got '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L495" class="LineNr">495 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L496" class="LineNr">496 </span> <span class="Delimiter">}</span> <span id="L497" class="LineNr">497 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_number<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L498" class="LineNr">498 </span> raise << maybe<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">"first ingredient of 'stop' should be a routine id generated by 'start-running', but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L498" class="LineNr">498 </span> <a href='003trace.cc.html#L178'>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">"first ingredient of 'stop' should be a routine id generated by 'start-running', but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L499" class="LineNr">499 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L500" class="LineNr">500 </span> <span class="Delimiter">}</span> <span id="L501" class="LineNr">501 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -564,9 +564,9 @@ if ('onhashchange' in window) { <span id="L503" class="LineNr">503 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L504" class="LineNr">504 </span><span class="Normal">case</span> STOP: <span class="Delimiter">{</span> <span id="L505" class="LineNr">505 </span> <span class="Normal">int</span> id = ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L506" class="LineNr">506 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L506" class="LineNr">506 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L507" class="LineNr">507 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>id == id<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L508" class="LineNr">508 </span> Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state = COMPLETED<span class="Delimiter">;</span> +<span id="L508" class="LineNr">508 </span> Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state = <a href='072scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">;</span> <span id="L509" class="LineNr">509 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L510" class="LineNr">510 </span> <span class="Delimiter">}</span> <span id="L511" class="LineNr">511 </span> <span class="Delimiter">}</span> @@ -576,14 +576,14 @@ if ('onhashchange' in window) { <span id="L515" class="LineNr">515 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L516" class="LineNr">516 </span>_DUMP_ROUTINES<span class="Delimiter">,</span> <span id="L517" class="LineNr">517 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L518" class="LineNr">518 </span>put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$dump-routines"</span><span class="Delimiter">,</span> _DUMP_ROUTINES<span class="Delimiter">);</span> +<span id="L518" class="LineNr">518 </span><a href='001help.cc.html#L218'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$dump-routines"</span><span class="Delimiter">,</span> _DUMP_ROUTINES<span class="Delimiter">);</span> <span id="L519" class="LineNr">519 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L520" class="LineNr">520 </span><span class="Normal">case</span> _DUMP_ROUTINES: <span class="Delimiter">{</span> <span id="L521" class="LineNr">521 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L522" class="LineNr">522 </span><span class="Delimiter">}</span> <span id="L523" class="LineNr">523 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L524" class="LineNr">524 </span><span class="Normal">case</span> _DUMP_ROUTINES: <span class="Delimiter">{</span> -<span id="L525" class="LineNr">525 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L525" class="LineNr">525 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L526" class="LineNr">526 </span> cerr << i << <span class="Constant">": "</span> << Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>id << <span class="Constant">' '</span> << Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state << <span class="Constant">' '</span> << Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>parent_index << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L527" class="LineNr">527 </span> <span class="Delimiter">}</span> <span id="L528" class="LineNr">528 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -613,7 +613,7 @@ if ('onhashchange' in window) { <span id="L552" class="LineNr">552 </span><span class="Delimiter">:(before "End Scheduler State Transitions")</span> <span id="L553" class="LineNr">553 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>limit >= <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L554" class="LineNr">554 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>limit <= Scheduling_interval<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L555" class="LineNr">555 </span> trace<span class="Delimiter">(</span><span class="Constant">9999</span><span class="Delimiter">,</span> <span class="Constant">"schedule"</span><span class="Delimiter">)</span> << <span class="Constant">"discontinuing routine "</span> << Current_routine<span class="Delimiter">-></span>id << end<span class="Delimiter">();</span> +<span id="L555" class="LineNr">555 </span> <a href='003trace.cc.html#L171'>trace</a><span class="Delimiter">(</span><span class="Constant">9999</span><span class="Delimiter">,</span> <span class="Constant">"schedule"</span><span class="Delimiter">)</span> << <span class="Constant">"discontinuing routine "</span> << Current_routine<span class="Delimiter">-></span>id << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L556" class="LineNr">556 </span> Current_routine<span class="Delimiter">-></span>state = DISCONTINUED<span class="Delimiter">;</span> <span id="L557" class="LineNr">557 </span> Current_routine<span class="Delimiter">-></span>limit = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L558" class="LineNr">558 </span> <span class="Delimiter">}</span> @@ -624,14 +624,14 @@ if ('onhashchange' in window) { <span id="L563" class="LineNr">563 </span> <span id="L564" class="LineNr">564 </span><span class="Delimiter">:(before "End Test Teardown")</span> <span id="L565" class="LineNr">565 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Passed && any_routines_with_error<span class="Delimiter">())</span> -<span id="L566" class="LineNr">566 </span> raise << <span class="Constant">"some routines died with errors</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L566" class="LineNr">566 </span> <a href='003trace.cc.html#L178'>raise</a> << <span class="Constant">"some routines died with errors</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L567" class="LineNr">567 </span><span class="Delimiter">:(before "End Mu Test Teardown")</span> <span id="L568" class="LineNr">568 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Passed && any_routines_with_error<span class="Delimiter">())</span> -<span id="L569" class="LineNr">569 </span> raise << Current_scenario<span class="Delimiter">-></span>name << <span class="Constant">": some routines died with errors</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L569" class="LineNr">569 </span> <a href='003trace.cc.html#L178'>raise</a> << Current_scenario<span class="Delimiter">-></span>name << <span class="Constant">": some routines died with errors</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L570" class="LineNr">570 </span> <span id="L571" class="LineNr">571 </span><span class="Delimiter">:(code)</span> <span id="L572" class="LineNr">572 </span><span class="Normal">bool</span> any_routines_with_error<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L573" class="LineNr">573 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L573" class="LineNr">573 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L574" class="LineNr">574 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state == DISCONTINUED<span class="Delimiter">)</span> <span id="L575" class="LineNr">575 </span> <span class="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span> <span id="L576" class="LineNr">576 </span> <span class="Delimiter">}</span> @@ -646,19 +646,19 @@ if ('onhashchange' in window) { <span id="L585" class="LineNr">585 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L586" class="LineNr">586 </span>LIMIT_TIME<span class="Delimiter">,</span> <span id="L587" class="LineNr">587 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L588" class="LineNr">588 </span>put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"limit-time"</span><span class="Delimiter">,</span> LIMIT_TIME<span class="Delimiter">);</span> +<span id="L588" class="LineNr">588 </span><a href='001help.cc.html#L218'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"limit-time"</span><span class="Delimiter">,</span> LIMIT_TIME<span class="Delimiter">);</span> <span id="L589" class="LineNr">589 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L590" class="LineNr">590 </span><span class="Normal">case</span> LIMIT_TIME: <span class="Delimiter">{</span> -<span id="L591" class="LineNr">591 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">2</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L592" class="LineNr">592 </span> raise << maybe<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">"'limit-time' requires exactly two ingredient, but got '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L591" class="LineNr">591 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">2</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L592" class="LineNr">592 </span> <a href='003trace.cc.html#L178'>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">"'limit-time' requires exactly two ingredient, but got '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L593" class="LineNr">593 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L594" class="LineNr">594 </span> <span class="Delimiter">}</span> <span id="L595" class="LineNr">595 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_number<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L596" class="LineNr">596 </span> raise << maybe<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">"first ingredient of 'limit-time' should be a routine id generated by 'start-running', but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L596" class="LineNr">596 </span> <a href='003trace.cc.html#L178'>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">"first ingredient of 'limit-time' should be a routine id generated by 'start-running', but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L597" class="LineNr">597 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L598" class="LineNr">598 </span> <span class="Delimiter">}</span> <span id="L599" class="LineNr">599 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_number<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L600" class="LineNr">600 </span> raise << maybe<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">"second ingredient of 'limit-time' should be a number (of instructions to run for), but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L600" class="LineNr">600 </span> <a href='003trace.cc.html#L178'>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">"second ingredient of 'limit-time' should be a number (of instructions to run for), but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L601" class="LineNr">601 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L602" class="LineNr">602 </span> <span class="Delimiter">}</span> <span id="L603" class="LineNr">603 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -666,7 +666,7 @@ if ('onhashchange' in window) { <span id="L605" class="LineNr">605 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L606" class="LineNr">606 </span><span class="Normal">case</span> LIMIT_TIME: <span class="Delimiter">{</span> <span id="L607" class="LineNr">607 </span> <span class="Normal">int</span> id = ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L608" class="LineNr">608 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L608" class="LineNr">608 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L609" class="LineNr">609 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>id == id<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L610" class="LineNr">610 </span> Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>limit = ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L611" class="LineNr">611 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -684,15 +684,15 @@ if ('onhashchange' in window) { <span id="L623" class="LineNr">623 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L624" class="LineNr">624 </span>NUMBER_OF_INSTRUCTIONS<span class="Delimiter">,</span> <span id="L625" class="LineNr">625 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L626" class="LineNr">626 </span>put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"number-of-instructions"</span><span class="Delimiter">,</span> NUMBER_OF_INSTRUCTIONS<span class="Delimiter">);</span> +<span id="L626" class="LineNr">626 </span><a href='001help.cc.html#L218'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"number-of-instructions"</span><span class="Delimiter">,</span> NUMBER_OF_INSTRUCTIONS<span class="Delimiter">);</span> <span id="L627" class="LineNr">627 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L628" class="LineNr">628 </span><span class="Normal">case</span> NUMBER_OF_INSTRUCTIONS: <span class="Delimiter">{</span> -<span id="L629" class="LineNr">629 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L630" class="LineNr">630 </span> raise << maybe<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">"'number-of-instructions' requires exactly one ingredient, but got '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L629" class="LineNr">629 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L630" class="LineNr">630 </span> <a href='003trace.cc.html#L178'>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">"'number-of-instructions' requires exactly one ingredient, but got '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L631" class="LineNr">631 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L632" class="LineNr">632 </span> <span class="Delimiter">}</span> <span id="L633" class="LineNr">633 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_number<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L634" class="LineNr">634 </span> raise << maybe<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">"first ingredient of 'number-of-instructions' should be a routine id generated by 'start-running', but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L634" class="LineNr">634 </span> <a href='003trace.cc.html#L178'>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">"first ingredient of 'number-of-instructions' should be a routine id generated by 'start-running', but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L195'>end</a><span class="Delimiter">();</span> <span id="L635" class="LineNr">635 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L636" class="LineNr">636 </span> <span class="Delimiter">}</span> <span id="L637" class="LineNr">637 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -701,7 +701,7 @@ if ('onhashchange' in window) { <span id="L640" class="LineNr">640 </span><span class="Normal">case</span> NUMBER_OF_INSTRUCTIONS: <span class="Delimiter">{</span> <span id="L641" class="LineNr">641 </span> <span class="Normal">int</span> id = ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L642" class="LineNr">642 </span> <span class="Normal">int</span> result = -<span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L643" class="LineNr">643 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L643" class="LineNr">643 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L644" class="LineNr">644 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>id == id<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L645" class="LineNr">645 </span> result = Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>instructions_run<span class="Delimiter">;</span> <span id="L646" class="LineNr">646 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> |