diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-03-02 05:48:01 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-03-02 05:48:01 -0800 |
commit | fd7d8138a4ff5515f9b79c584a98d5c26d8ddb8a (patch) | |
tree | ea6e8e1c988a67e302d9f6abe6fda46e1648dc72 /html/056shape_shifting_recipe.cc.html | |
parent | a802f0cedc7b5580d746f46ae62fcf8074ae3c49 (diff) | |
download | mu-fd7d8138a4ff5515f9b79c584a98d5c26d8ddb8a.tar.gz |
3750
Diffstat (limited to 'html/056shape_shifting_recipe.cc.html')
-rw-r--r-- | html/056shape_shifting_recipe.cc.html | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/html/056shape_shifting_recipe.cc.html b/html/056shape_shifting_recipe.cc.html index a2519c1b..fb3bb405 100644 --- a/html/056shape_shifting_recipe.cc.html +++ b/html/056shape_shifting_recipe.cc.html @@ -102,7 +102,7 @@ if ('onhashchange' in window) { <span id="L37" class="LineNr"> 37 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>running_step_index == <span class="Constant">0</span> <span id="L38" class="LineNr"> 38 </span> && <a href='056shape_shifting_recipe.cc.html#L157'>any_type_ingredient_in_header</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>running_recipe<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L39" class="LineNr"> 39 </span><span class="CommentedCode">//? DUMP("");</span> -<span id="L40" class="LineNr"> 40 </span> <a href='003trace.cc.html#L176'>raise</a> << <span class="Constant">"ran into unspecialized shape-shifting <a href='010vm.cc.html#L19'>recipe</a> "</span> << current_recipe_name<span class="Delimiter">()</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L40" class="LineNr"> 40 </span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"ran into unspecialized shape-shifting <a href='010vm.cc.html#L19'>recipe</a> "</span> << current_recipe_name<span class="Delimiter">()</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L41" class="LineNr"> 41 </span><span class="CommentedCode">//? exit(0);</span> <span id="L42" class="LineNr"> 42 </span><span class="Delimiter">}</span> <span id="L43" class="LineNr"> 43 </span> @@ -122,14 +122,14 @@ if ('onhashchange' in window) { <span id="L57" class="LineNr"> 57 </span>candidates = <a href='056shape_shifting_recipe.cc.html#L100'>strictly_matching_shape_shifting_variants</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> variants<span class="Delimiter">);</span> <span id="L58" class="LineNr"> 58 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!candidates<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L59" class="LineNr"> 59 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> exemplar = <a href='056shape_shifting_recipe.cc.html#L129'>best_shape_shifting_variant</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> candidates<span class="Delimiter">);</span> -<span id="L60" class="LineNr"> 60 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"found variant to specialize: "</span> << exemplar << <span class="Constant">' '</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> exemplar<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L60" class="LineNr"> 60 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"found variant to specialize: "</span> << exemplar << <span class="Constant">' '</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> exemplar<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L61" class="LineNr"> 61 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> new_recipe_ordinal = <a href='056shape_shifting_recipe.cc.html#L227'>new_variant</a><span class="Delimiter">(</span>exemplar<span class="Delimiter">,</span> inst<span class="Delimiter">,</span> caller_recipe<span class="Delimiter">);</span> <span id="L62" class="LineNr"> 62 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>new_recipe_ordinal == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">goto</span> skip_shape_shifting_variants<span class="Delimiter">;</span> <span id="L63" class="LineNr"> 63 </span> variants<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>new_recipe_ordinal<span class="Delimiter">);</span> <span class="Comment">// side-effect</span> <span id="L64" class="LineNr"> 64 </span> recipe& variant = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> new_recipe_ordinal<span class="Delimiter">);</span> <span id="L65" class="LineNr"> 65 </span> <span class="Comment">// perform all transforms on the new specialization</span> <span id="L66" class="LineNr"> 66 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!variant<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L67" class="LineNr"> 67 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"transforming new specialization: "</span> << variant<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L67" class="LineNr"> 67 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"transforming new specialization: "</span> << variant<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L68" class="LineNr"> 68 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> t = <span class="Constant">0</span><span class="Delimiter">;</span> t < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>Transform<span class="Delimiter">);</span> ++t<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L69" class="LineNr"> 69 </span> <span class="Comment">// one exception: skip tangle, which would have already occurred inside new_variant above</span> <span id="L70" class="LineNr"> 70 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Transform<span class="Delimiter">.</span>at<span class="Delimiter">(</span>t<span class="Delimiter">)</span> == <span class="Comment">/*</span><span class="Comment">disambiguate overloading</span><span class="Comment">*/</span><span class="Normal">static_cast</span><transform_fn><span class="Delimiter">(</span>insert_fragments<span class="Delimiter">))</span> @@ -138,7 +138,7 @@ if ('onhashchange' in window) { <span id="L73" class="LineNr"> 73 </span> <span class="Delimiter">}</span> <span id="L74" class="LineNr"> 74 </span> <span class="Delimiter">}</span> <span id="L75" class="LineNr"> 75 </span> variant<span class="Delimiter">.</span>transformed_until = <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>Transform<span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L76" class="LineNr"> 76 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"new specialization: "</span> << variant<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L76" class="LineNr"> 76 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"new specialization: "</span> << variant<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L77" class="LineNr"> 77 </span> <span class="Identifier">return</span> variant<span class="Delimiter">.</span>name<span class="Delimiter">;</span> <span id="L78" class="LineNr"> 78 </span><span class="Delimiter">}</span> <span id="L79" class="LineNr"> 79 </span><span class="Normal">skip_shape_shifting_variants</span>:<span class="Delimiter">;</span> @@ -149,7 +149,7 @@ if ('onhashchange' in window) { <span id="L84" class="LineNr"> 84 </span><span class="Delimiter">:(before "End Instruction Operation Checks")</span> <span id="L85" class="LineNr"> 85 </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> && inst<span class="Delimiter">.</span>operation >= <a href='010vm.cc.html#L191'>MAX_PRIMITIVE_RECIPES</a> <span id="L86" class="LineNr"> 86 </span> && <a href='056shape_shifting_recipe.cc.html#L157'>any_type_ingredient_in_header</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L87" class="LineNr"> 87 </span> <a href='003trace.cc.html#L176'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"instruction '"</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">"' has no valid specialization</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L87" class="LineNr"> 87 </span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"instruction '"</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">"' has no valid specialization</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L88" class="LineNr"> 88 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L89" class="LineNr"> 89 </span><span class="Delimiter">}</span> <span id="L90" class="LineNr"> 90 </span> @@ -176,14 +176,14 @@ if ('onhashchange' in window) { <span id="L111" class="LineNr"> 111 </span><span class="Normal">bool</span> <a href='056shape_shifting_recipe.cc.html#L111'>all_concrete_header_reagents_strictly_match</a><span class="Delimiter">(</span><span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& variant<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L112" class="LineNr"> 112 </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 < min<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> <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>variant<span class="Delimiter">.</span>ingredients<span class="Delimiter">));</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L113" class="LineNr"> 113 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!concrete_type_names_strictly_match<span class="Delimiter">(</span>variant<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L114" class="LineNr"> 114 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"concrete-type match failed: ingredient "</span> << i << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L114" class="LineNr"> 114 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"concrete-type match failed: ingredient "</span> << i << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L115" class="LineNr"> 115 </span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L116" class="LineNr"> 116 </span> <span class="Delimiter">}</span> <span id="L117" class="LineNr"> 117 </span> <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 < min<span class="Delimiter">(</span><a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">),</span> <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>variant<span class="Delimiter">.</span>ingredients<span class="Delimiter">));</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L119" class="LineNr"> 119 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_dummy<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L120" class="LineNr"> 120 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!concrete_type_names_strictly_match<span class="Delimiter">(</span>variant<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L121" class="LineNr"> 121 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"concrete-type match failed: product "</span> << i << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L121" class="LineNr"> 121 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"concrete-type match failed: product "</span> << i << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L122" class="LineNr"> 122 </span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L123" class="LineNr"> 123 </span> <span class="Delimiter">}</span> <span id="L124" class="LineNr"> 124 </span> <span class="Delimiter">}</span> @@ -251,9 +251,9 @@ if ('onhashchange' in window) { <span id="L186" class="LineNr"> 186 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>from<span class="Delimiter">-></span>atom != to<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L187" class="LineNr"> 187 </span> <span class="Comment">// both from and to are atoms</span> <span id="L188" class="LineNr"> 188 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>from<span class="Delimiter">-></span>name == <span class="Constant">"literal"</span><span class="Delimiter">)</span> -<span id="L189" class="LineNr"> 189 </span> <span class="Identifier">return</span> Literal_type_names<span class="Delimiter">.</span>find<span class="Delimiter">(</span>to<span class="Delimiter">-></span>name<span class="Delimiter">)</span> != Literal_type_names<span class="Delimiter">.</span><a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L189" class="LineNr"> 189 </span> <span class="Identifier">return</span> Literal_type_names<span class="Delimiter">.</span>find<span class="Delimiter">(</span>to<span class="Delimiter">-></span>name<span class="Delimiter">)</span> != Literal_type_names<span class="Delimiter">.</span><a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L190" class="LineNr"> 190 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>to<span class="Delimiter">-></span>name == <span class="Constant">"literal"</span><span class="Delimiter">)</span> -<span id="L191" class="LineNr"> 191 </span> <span class="Identifier">return</span> Literal_type_names<span class="Delimiter">.</span>find<span class="Delimiter">(</span>from<span class="Delimiter">-></span>name<span class="Delimiter">)</span> != Literal_type_names<span class="Delimiter">.</span><a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L191" class="LineNr"> 191 </span> <span class="Identifier">return</span> Literal_type_names<span class="Delimiter">.</span>find<span class="Delimiter">(</span>from<span class="Delimiter">-></span>name<span class="Delimiter">)</span> != Literal_type_names<span class="Delimiter">.</span><a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L192" class="LineNr"> 192 </span> <span class="Identifier">return</span> to<span class="Delimiter">-></span>name == from<span class="Delimiter">-></span>name<span class="Delimiter">;</span> <span id="L193" class="LineNr"> 193 </span><span class="Delimiter">}</span> <span id="L194" class="LineNr"> 194 </span> @@ -299,7 +299,7 @@ if ('onhashchange' in window) { <span id="L234" class="LineNr"> 234 </span> <a href='010vm.cc.html#L19'>recipe</a> new_recipe = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> exemplar<span class="Delimiter">);</span> <span id="L235" class="LineNr"> 235 </span> new_recipe<span class="Delimiter">.</span>name = new_name<span class="Delimiter">;</span> <span id="L236" class="LineNr"> 236 </span> new_recipe<span class="Delimiter">.</span>is_autogenerated = <span class="Constant">true</span><span class="Delimiter">;</span> -<span id="L237" class="LineNr"> 237 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"switching "</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">" to specialized "</span> << header_label<span class="Delimiter">(</span>new_recipe<span class="Delimiter">)</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L237" class="LineNr"> 237 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"switching "</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">" to specialized "</span> << header_label<span class="Delimiter">(</span>new_recipe<span class="Delimiter">)</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L238" class="LineNr"> 238 </span> <span id="L239" class="LineNr"> 239 </span> <span class="Comment">// Replace type ingredients with concrete types in new_recipe.</span> <span id="L240" class="LineNr"> 240 </span> <span class="Comment">//</span> @@ -318,7 +318,7 @@ if ('onhashchange' in window) { <span id="L253" class="LineNr"> 253 </span> <a href='056shape_shifting_recipe.cc.html#L299'>compute_type_ingredient_mappings</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> exemplar<span class="Delimiter">),</span> inst<span class="Delimiter">,</span> mappings<span class="Delimiter">,</span> caller_recipe<span class="Delimiter">,</span> &error<span class="Delimiter">);</span> <span id="L254" class="LineNr"> 254 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!error<span class="Delimiter">)</span> error = <span class="Delimiter">(</span><a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>mappings<span class="Delimiter">)</span> != <a href='056shape_shifting_recipe.cc.html#L437'>type_ingredient_count_in_header</a><span class="Delimiter">(</span>exemplar<span class="Delimiter">));</span> <span id="L255" class="LineNr"> 255 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!error<span class="Delimiter">)</span> replace_type_ingredients<span class="Delimiter">(</span>new_recipe<span class="Delimiter">,</span> mappings<span class="Delimiter">);</span> -<span id="L256" class="LineNr"> 256 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<string<span class="Delimiter">,</span> <span class="Normal">const</span> type_tree*>::iterator p = mappings<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != mappings<span class="Delimiter">.</span><a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> +<span id="L256" class="LineNr"> 256 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<string<span class="Delimiter">,</span> <span class="Normal">const</span> type_tree*>::iterator p = mappings<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != mappings<span class="Delimiter">.</span><a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span id="L257" class="LineNr"> 257 </span> <span class="Normal">delete</span> p<span class="Delimiter">-></span>second<span class="Delimiter">;</span> <span id="L258" class="LineNr"> 258 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>error<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L259" class="LineNr"> 259 </span> <span class="Delimiter">}</span> @@ -328,7 +328,7 @@ if ('onhashchange' in window) { <span id="L263" class="LineNr"> 263 </span><span class="Delimiter">}</span> <span id="L264" class="LineNr"> 264 </span> <span id="L265" class="LineNr"> 265 </span><span class="Normal">void</span> <a href='056shape_shifting_recipe.cc.html#L265'>compute_type_names</a><span class="Delimiter">(</span>recipe& variant<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L266" class="LineNr"> 266 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"-- compute type names: "</span> << variant<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L266" class="LineNr"> 266 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"-- compute type names: "</span> << variant<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L267" class="LineNr"> 267 </span> map<string<span class="Delimiter">,</span> type_tree*> type_names<span class="Delimiter">;</span> <span id="L268" class="LineNr"> 268 </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>variant<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L269" class="LineNr"> 269 </span> <a href='056shape_shifting_recipe.cc.html#L282'>save_or_deduce_type_name</a><span class="Delimiter">(</span>variant<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> type_names<span class="Delimiter">,</span> variant<span class="Delimiter">,</span> <span class="Constant">""</span><span class="Delimiter">);</span> @@ -336,7 +336,7 @@ if ('onhashchange' in window) { <span id="L271" class="LineNr"> 271 </span> <a href='056shape_shifting_recipe.cc.html#L282'>save_or_deduce_type_name</a><span class="Delimiter">(</span>variant<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> type_names<span class="Delimiter">,</span> variant<span class="Delimiter">,</span> <span class="Constant">""</span><span class="Delimiter">);</span> <span id="L272" class="LineNr"> 272 </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>variant<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L273" class="LineNr"> 273 </span> instruction& inst = variant<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L274" class="LineNr"> 274 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">" <a href='010vm.cc.html#L32'>instruction</a>: "</span> << <a href='028call_return.cc.html#L158'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L274" class="LineNr"> 274 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">" <a href='010vm.cc.html#L32'>instruction</a>: "</span> << <a href='028call_return.cc.html#L158'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L275" class="LineNr"> 275 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> in = <span class="Constant">0</span><span class="Delimiter">;</span> in < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++in<span class="Delimiter">)</span> <span id="L276" class="LineNr"> 276 </span> <a href='056shape_shifting_recipe.cc.html#L282'>save_or_deduce_type_name</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>in<span class="Delimiter">),</span> type_names<span class="Delimiter">,</span> variant<span class="Delimiter">,</span> <span class="Constant">" in '"</span> + inst<span class="Delimiter">.</span>original_string + <span class="Constant">"'"</span><span class="Delimiter">);</span> <span id="L277" class="LineNr"> 277 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> out = <span class="Constant">0</span><span class="Delimiter">;</span> out < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++out<span class="Delimiter">)</span> @@ -345,20 +345,20 @@ if ('onhashchange' in window) { <span id="L280" class="LineNr"> 280 </span><span class="Delimiter">}</span> <span id="L281" class="LineNr"> 281 </span> <span id="L282" class="LineNr"> 282 </span><span class="Normal">void</span> <a href='056shape_shifting_recipe.cc.html#L282'>save_or_deduce_type_name</a><span class="Delimiter">(</span>reagent& x<span class="Delimiter">,</span> map<string<span class="Delimiter">,</span> type_tree*>& type<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& variant<span class="Delimiter">,</span> <span class="Normal">const</span> string& context<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L283" class="LineNr"> 283 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9994</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">" checking "</span> << <a href='028call_return.cc.html#L158'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">)</span> << <span class="Constant">": "</span> << names_to_string<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L283" class="LineNr"> 283 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9994</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">" checking "</span> << <a href='028call_return.cc.html#L158'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">)</span> << <span class="Constant">": "</span> << names_to_string<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L284" class="LineNr"> 284 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type && contains_key<span class="Delimiter">(</span>type<span class="Delimiter">,</span> x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L285" class="LineNr"> 285 </span> x<span class="Delimiter">.</span>type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*get<span class="Delimiter">(</span>type<span class="Delimiter">,</span> x<span class="Delimiter">.</span>name<span class="Delimiter">));</span> -<span id="L286" class="LineNr"> 286 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9994</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">" deducing type to "</span> << names_to_string<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L286" class="LineNr"> 286 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9994</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">" deducing type to "</span> << names_to_string<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L287" class="LineNr"> 287 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L288" class="LineNr"> 288 </span> <span class="Delimiter">}</span> <span id="L289" class="LineNr"> 289 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L290" class="LineNr"> 290 </span> <a href='003trace.cc.html#L176'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>variant<span class="Delimiter">.</span>original_name<span class="Delimiter">)</span> << <span class="Constant">"unknown type for '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"'"</span> << context << <span class="Constant">" (check the name for typos)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L290" class="LineNr"> 290 </span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>variant<span class="Delimiter">.</span>original_name<span class="Delimiter">)</span> << <span class="Constant">"unknown type for '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"'"</span> << context << <span class="Constant">" (check the name for typos)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L291" class="LineNr"> 291 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L292" class="LineNr"> 292 </span> <span class="Delimiter">}</span> <span id="L293" class="LineNr"> 293 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>contains_key<span class="Delimiter">(</span>type<span class="Delimiter">,</span> x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L294" class="LineNr"> 294 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>name == <span class="Constant">"offset"</span> || x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>name == <span class="Constant">"variant"</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">// special-case for container-access instructions</span> <span id="L295" class="LineNr"> 295 </span> <a href='001help.cc.html#L218'>put</a><span class="Delimiter">(</span>type<span class="Delimiter">,</span> x<span class="Delimiter">.</span>name<span class="Delimiter">,</span> x<span class="Delimiter">.</span>type<span class="Delimiter">);</span> -<span id="L296" class="LineNr"> 296 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"type of '"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"' is "</span> << names_to_string<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L296" class="LineNr"> 296 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"type of '"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"' is "</span> << names_to_string<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L297" class="LineNr"> 297 </span><span class="Delimiter">}</span> <span id="L298" class="LineNr"> 298 </span> <span id="L299" class="LineNr"> 299 </span><span class="Normal">void</span> <a href='056shape_shifting_recipe.cc.html#L299'>compute_type_ingredient_mappings</a><span class="Delimiter">(</span><span class="Normal">const</span> recipe& exemplar<span class="Delimiter">,</span> <span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> map<string<span class="Delimiter">,</span> <span class="Normal">const</span> type_tree*>& mappings<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& caller_recipe<span class="Delimiter">,</span> <span class="Normal">bool</span>* error<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -390,13 +390,13 @@ if ('onhashchange' in window) { <span id="L325" class="LineNr"> 325 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!refinement_type<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L326" class="LineNr"> 326 </span> <span class="Comment">// probably a bug in mu</span> <span id="L327" class="LineNr"> 327 </span> <span class="Comment">// todo: make this smarter; only flag an error if exemplar_type contains some *new* type ingredient</span> -<span id="L328" class="LineNr"> 328 </span> <a href='003trace.cc.html#L176'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>exemplar<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"missing type ingredient for "</span> << exemplar_reagent<span class="Delimiter">.</span>original_string << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> -<span id="L329" class="LineNr"> 329 </span> <a href='003trace.cc.html#L176'>raise</a> << <span class="Constant">" (called from '"</span> << to_original_string<span class="Delimiter">(</span>call_instruction<span class="Delimiter">)</span> << <span class="Constant">"')</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L328" class="LineNr"> 328 </span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>exemplar<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"missing type ingredient for "</span> << exemplar_reagent<span class="Delimiter">.</span>original_string << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> +<span id="L329" class="LineNr"> 329 </span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">" (called from '"</span> << to_original_string<span class="Delimiter">(</span>call_instruction<span class="Delimiter">)</span> << <span class="Constant">"')</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L330" class="LineNr"> 330 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L331" class="LineNr"> 331 </span> <span class="Delimiter">}</span> <span id="L332" class="LineNr"> 332 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!exemplar_type<span class="Delimiter">-></span>atom && exemplar_type<span class="Delimiter">-></span>right == <span class="Constant">NULL</span> && !refinement_type<span class="Delimiter">-></span>atom && refinement_type<span class="Delimiter">-></span>right != <span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L333" class="LineNr"> 333 </span> exemplar_type = exemplar_type<span class="Delimiter">-></span>left<span class="Delimiter">;</span> -<span id="L334" class="LineNr"> 334 </span> <a href='003trace.cc.html#L179'>assert_for_now</a><span class="Delimiter">(</span>exemplar_type<span class="Delimiter">-></span>atom<span class="Delimiter">);</span> +<span id="L334" class="LineNr"> 334 </span> <a href='003trace.cc.html#L171'>assert_for_now</a><span class="Delimiter">(</span>exemplar_type<span class="Delimiter">-></span>atom<span class="Delimiter">);</span> <span id="L335" class="LineNr"> 335 </span> <span class="Delimiter">}</span> <span id="L336" class="LineNr"> 336 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>exemplar_type<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L337" class="LineNr"> 337 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_type_ingredient_name<span class="Delimiter">(</span>exemplar_type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> @@ -408,12 +408,12 @@ if ('onhashchange' in window) { <span id="L343" class="LineNr"> 343 </span> curr_refinement_type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*refinement_type<span class="Delimiter">-></span>left<span class="Delimiter">);</span> <span id="L344" class="LineNr"> 344 </span> <span class="Delimiter">}</span> <span id="L345" class="LineNr"> 345 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>mappings<span class="Delimiter">,</span> exemplar_type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L346" class="LineNr"> 346 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"adding mapping from "</span> << exemplar_type<span class="Delimiter">-></span>name << <span class="Constant">" to "</span> << <a href='028call_return.cc.html#L158'>to_string</a><span class="Delimiter">(</span>curr_refinement_type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L346" class="LineNr"> 346 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"adding mapping from "</span> << exemplar_type<span class="Delimiter">-></span>name << <span class="Constant">" to "</span> << <a href='028call_return.cc.html#L158'>to_string</a><span class="Delimiter">(</span>curr_refinement_type<span class="Delimiter">)</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L347" class="LineNr"> 347 </span> <a href='001help.cc.html#L218'>put</a><span class="Delimiter">(</span>mappings<span class="Delimiter">,</span> exemplar_type<span class="Delimiter">-></span>name<span class="Delimiter">,</span> <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*curr_refinement_type<span class="Delimiter">));</span> <span id="L348" class="LineNr"> 348 </span> <span class="Delimiter">}</span> <span id="L349" class="LineNr"> 349 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L350" class="LineNr"> 350 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!deeply_equal_type_names<span class="Delimiter">(</span>get<span class="Delimiter">(</span>mappings<span class="Delimiter">,</span> exemplar_type<span class="Delimiter">-></span>name<span class="Delimiter">),</span> curr_refinement_type<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L351" class="LineNr"> 351 </span> <a href='003trace.cc.html#L176'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"no call found for '"</span> << to_original_string<span class="Delimiter">(</span>call_instruction<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L351" class="LineNr"> 351 </span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"no call found for '"</span> << to_original_string<span class="Delimiter">(</span>call_instruction<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L352" class="LineNr"> 352 </span> *error = <span class="Constant">true</span><span class="Delimiter">;</span> <span id="L353" class="LineNr"> 353 </span> <span class="Normal">delete</span> curr_refinement_type<span class="Delimiter">;</span> <span id="L354" class="LineNr"> 354 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> @@ -435,16 +435,16 @@ if ('onhashchange' in window) { <span id="L370" class="LineNr"> 370 </span><span class="Normal">void</span> replace_type_ingredients<span class="Delimiter">(</span>recipe& new_recipe<span class="Delimiter">,</span> <span class="Normal">const</span> map<string<span class="Delimiter">,</span> <span class="Normal">const</span> type_tree*>& mappings<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L371" class="LineNr"> 371 </span> <span class="Comment">// update its header</span> <span id="L372" class="LineNr"> 372 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>mappings<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L373" class="LineNr"> 373 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"replacing in <a href='010vm.cc.html#L19'>recipe</a> header ingredients"</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L373" class="LineNr"> 373 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"replacing in <a href='010vm.cc.html#L19'>recipe</a> header ingredients"</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L374" class="LineNr"> 374 </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>new_recipe<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L375" class="LineNr"> 375 </span> replace_type_ingredients<span class="Delimiter">(</span>new_recipe<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> mappings<span class="Delimiter">,</span> new_recipe<span class="Delimiter">);</span> -<span id="L376" class="LineNr"> 376 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"replacing in <a href='010vm.cc.html#L19'>recipe</a> header products"</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L376" class="LineNr"> 376 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"replacing in <a href='010vm.cc.html#L19'>recipe</a> header products"</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L377" class="LineNr"> 377 </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>new_recipe<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L378" class="LineNr"> 378 </span> replace_type_ingredients<span class="Delimiter">(</span>new_recipe<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> mappings<span class="Delimiter">,</span> new_recipe<span class="Delimiter">);</span> <span id="L379" class="LineNr"> 379 </span> <span class="Comment">// update its body</span> <span id="L380" class="LineNr"> 380 </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>new_recipe<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L381" class="LineNr"> 381 </span> instruction& inst = new_recipe<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L382" class="LineNr"> 382 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"replacing in <a href='010vm.cc.html#L32'>instruction</a> '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L382" class="LineNr"> 382 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"replacing in <a href='010vm.cc.html#L32'>instruction</a> '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L383" class="LineNr"> 383 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> j = <span class="Constant">0</span><span class="Delimiter">;</span> j < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++j<span class="Delimiter">)</span> <span id="L384" class="LineNr"> 384 </span> replace_type_ingredients<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">),</span> mappings<span class="Delimiter">,</span> new_recipe<span class="Delimiter">);</span> <span id="L385" class="LineNr"> 385 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> j = <span class="Constant">0</span><span class="Delimiter">;</span> j < <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++j<span class="Delimiter">)</span> @@ -461,9 +461,9 @@ if ('onhashchange' in window) { <span id="L396" class="LineNr"> 396 </span> <span id="L397" class="LineNr"> 397 </span><span class="Normal">void</span> replace_type_ingredients<span class="Delimiter">(</span>reagent& x<span class="Delimiter">,</span> <span class="Normal">const</span> map<string<span class="Delimiter">,</span> <span class="Normal">const</span> type_tree*>& mappings<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& caller<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L398" class="LineNr"> 398 </span> string before = <a href='028call_return.cc.html#L158'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">);</span> -<span id="L399" class="LineNr"> 399 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"replacing in ingredient "</span> << x<span class="Delimiter">.</span>original_string << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L399" class="LineNr"> 399 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"replacing in ingredient "</span> << x<span class="Delimiter">.</span>original_string << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L400" class="LineNr"> 400 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L401" class="LineNr"> 401 </span> <a href='003trace.cc.html#L176'>raise</a> << <span class="Constant">"specializing "</span> << caller<span class="Delimiter">.</span>original_name << <span class="Constant">": missing type for '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L401" class="LineNr"> 401 </span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"specializing "</span> << caller<span class="Delimiter">.</span>original_name << <span class="Constant">": missing type for '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L402" class="LineNr"> 402 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L403" class="LineNr"> 403 </span> <span class="Delimiter">}</span> <span id="L404" class="LineNr"> 404 </span> replace_type_ingredients<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">,</span> mappings<span class="Delimiter">);</span> @@ -485,7 +485,7 @@ if ('onhashchange' in window) { <span id="L420" class="LineNr"> 420 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>mappings<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span id="L421" class="LineNr"> 421 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L422" class="LineNr"> 422 </span> <span class="Normal">const</span> type_tree* replacement = get<span class="Delimiter">(</span>mappings<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> -<span id="L423" class="LineNr"> 423 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << type<span class="Delimiter">-></span>name << <span class="Constant">" => "</span> << names_to_string<span class="Delimiter">(</span>replacement<span class="Delimiter">)</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L423" class="LineNr"> 423 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << type<span class="Delimiter">-></span>name << <span class="Constant">" => "</span> << names_to_string<span class="Delimiter">(</span>replacement<span class="Delimiter">)</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L424" class="LineNr"> 424 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>replacement<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L425" class="LineNr"> 425 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> replacement<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L426" class="LineNr"> 426 </span> <span class="Comment">// error in program; should be reported elsewhere</span> @@ -546,7 +546,7 @@ if ('onhashchange' in window) { <span id="L481" class="LineNr"> 481 </span><span class="Delimiter">}</span> <span id="L482" class="LineNr"> 482 </span> <span id="L483" class="LineNr"> 483 </span><span class="Normal">void</span> ensure_all_concrete_types<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">const</span><span class="Comment">*/</span> recipe& new_recipe<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& exemplar<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L484" class="LineNr"> 484 </span> <a href='003trace.cc.html#L169'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"-- ensure all concrete types in <a href='010vm.cc.html#L19'>recipe</a> "</span> << new_recipe<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L484" class="LineNr"> 484 </span> <a href='003trace.cc.html#L161'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"-- ensure all concrete types in <a href='010vm.cc.html#L19'>recipe</a> "</span> << new_recipe<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L485" class="LineNr"> 485 </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>new_recipe<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L486" class="LineNr"> 486 </span> ensure_all_concrete_types<span class="Delimiter">(</span>new_recipe<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> exemplar<span class="Delimiter">);</span> <span id="L487" class="LineNr"> 487 </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>new_recipe<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> @@ -562,12 +562,12 @@ if ('onhashchange' in window) { <span id="L497" class="LineNr"> 497 </span> <span id="L498" class="LineNr"> 498 </span><span class="Normal">void</span> ensure_all_concrete_types<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">const</span><span class="Comment">*/</span> reagent& x<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& exemplar<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L499" class="LineNr"> 499 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type || contains_type_ingredient_name<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L500" class="LineNr"> 500 </span> <a href='003trace.cc.html#L176'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>exemplar<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"failed to map a type to "</span> << x<span class="Delimiter">.</span>original_string << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L500" class="LineNr"> 500 </span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>exemplar<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"failed to map a type to "</span> << x<span class="Delimiter">.</span>original_string << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L501" class="LineNr"> 501 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> x<span class="Delimiter">.</span>type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span><span class="Constant">""</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span class="Comment">// just to prevent crashes later</span> <span id="L502" class="LineNr"> 502 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L503" class="LineNr"> 503 </span> <span class="Delimiter">}</span> <span id="L504" class="LineNr"> 504 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>value == -<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L505" class="LineNr"> 505 </span> <a href='003trace.cc.html#L176'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>exemplar<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"failed to map a type to the unknown "</span> << x<span class="Delimiter">.</span>original_string << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L193'>end</a><span class="Delimiter">();</span> +<span id="L505" class="LineNr"> 505 </span> <a href='003trace.cc.html#L168'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>exemplar<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"failed to map a type to the unknown "</span> << x<span class="Delimiter">.</span>original_string << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L185'>end</a><span class="Delimiter">();</span> <span id="L506" class="LineNr"> 506 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L507" class="LineNr"> 507 </span> <span class="Delimiter">}</span> <span id="L508" class="LineNr"> 508 </span><span class="Delimiter">}</span> |