diff options
Diffstat (limited to 'html')
178 files changed, 4161 insertions, 3710 deletions
diff --git a/html/000organization.cc.html b/html/000organization.cc.html index b065a644..8337c477 100644 --- a/html/000organization.cc.html +++ b/html/000organization.cc.html @@ -11,17 +11,19 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Identifier { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } --> </style> @@ -55,6 +57,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/000organization.cc'>https://github.com/akkartik/mu/blob/master/000organization.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: You guessed right: the '000' prefix means you should start reading here.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//:</span> diff --git a/html/001help.cc.html b/html/001help.cc.html index fa9a953a..06c577a5 100644 --- a/html/001help.cc.html +++ b/html/001help.cc.html @@ -11,19 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Delimiter { color:#800080; } .SalientComment { color: #00ffff; } -.Identifier { color: #c0a020; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -58,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/001help.cc'>https://github.com/akkartik/mu/blob/master/001help.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Everything this project/binary supports.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: This should give you a sense for what to look forward to in later layers.</span> @@ -67,42 +71,42 @@ if ('onhashchange' in window) { <span id="L6" class="LineNr"> 6 </span> <span class="Comment">//: this is the functionality later layers will provide</span> <span id="L7" class="LineNr"> 7 </span> <span class="Comment">// currently no automated tests for commandline arg parsing</span> <span id="L8" class="LineNr"> 8 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>argc <= <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L9" class="LineNr"> 9 </span> cerr << <span class="Constant">"Please provide a Mu program to run.</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L10" class="LineNr"> 10 </span> << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L9" class="LineNr"> 9 </span> cerr << <span class="Constant">"Please provide a Mu program to run.\n"</span> +<span id="L10" class="LineNr"> 10 </span> << <span class="Constant">"\n"</span><span class="Delimiter">;</span> <span id="L11" class="LineNr"> 11 </span> <span class="Delimiter">}</span> -<span id="L12" class="LineNr"> 12 </span> cerr << <span class="Constant">"Usage:</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L13" class="LineNr"> 13 </span> << <span class="Constant">" mu [options] [test] [files]</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L14" class="LineNr"> 14 </span> << <span class="Constant">"or:</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L15" class="LineNr"> 15 </span> << <span class="Constant">" mu [options] [test] [files] -- [ingredients for function/recipe 'main']</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L16" class="LineNr"> 16 </span> << <span class="Constant">"Square brackets surround optional arguments.</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L17" class="LineNr"> 17 </span> << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L18" class="LineNr"> 18 </span> << <span class="Constant">"Examples:</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L19" class="LineNr"> 19 </span> << <span class="Constant">" To load files and run 'main':</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L20" class="LineNr"> 20 </span> << <span class="Constant">" mu file1.mu file2.mu ...</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L21" class="LineNr"> 21 </span> << <span class="Constant">" To run 'main' and dump a <a href='003trace.cc.html#L189'>trace</a> of all operations at the <a href='003trace.cc.html#L225'>end</a>:</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L22" class="LineNr"> 22 </span> << <span class="Constant">" mu --trace file1.mu file2.mu ...</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L23" class="LineNr"> 23 </span> << <span class="Constant">" To run all tests:</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L24" class="LineNr"> 24 </span> << <span class="Constant">" mu test</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L25" class="LineNr"> 25 </span> << <span class="Constant">" To load files and then run all tests:</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L26" class="LineNr"> 26 </span> << <span class="Constant">" mu test file1.mu file2.mu ...</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L27" class="LineNr"> 27 </span> << <span class="Constant">" To run a single Mu <a href='050scenario.cc.html#L57'>scenario</a>:</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L28" class="LineNr"> 28 </span> << <span class="Constant">" mu test file1.mu file2.mu ... <a href='050scenario.cc.html#L57'>scenario</a></span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L29" class="LineNr"> 29 </span> << <span class="Constant">" To run a single Mu <a href='050scenario.cc.html#L57'>scenario</a> and dump a <a href='003trace.cc.html#L189'>trace</a> at the <a href='003trace.cc.html#L225'>end</a>:</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L30" class="LineNr"> 30 </span> << <span class="Constant">" mu --trace test file1.mu file2.mu ... <a href='050scenario.cc.html#L57'>scenario</a></span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L31" class="LineNr"> 31 </span> << <span class="Constant">" To load files and run only the tests in explicitly loaded files (for apps):</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L32" class="LineNr"> 32 </span> << <span class="Constant">" mu --test-only-app test file1.mu file2.mu ...</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L33" class="LineNr"> 33 </span> << <span class="Constant">" To load all files with a numeric prefix in a directory:</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L34" class="LineNr"> 34 </span> << <span class="Constant">" mu directory1 directory2 ...</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L35" class="LineNr"> 35 </span> << <span class="Constant">" You can test directories just like files.</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L36" class="LineNr"> 36 </span> << <span class="Constant">" mu test directory1 directory2 ...</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L37" class="LineNr"> 37 </span> << <span class="Constant">" To pass ingredients to a mu program, provide them after '--':</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L38" class="LineNr"> 38 </span> << <span class="Constant">" mu file_or_dir1 file_or_dir2 ... -- ingredient1 ingredient2 ...</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L39" class="LineNr"> 39 </span> << <span class="Constant">" To see where a mu program is spending its time:</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L40" class="LineNr"> 40 </span> << <span class="Constant">" mu --profile file_or_dir1 file_or_dir2 ...</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L41" class="LineNr"> 41 </span> << <span class="Constant">" this slices and dices time spent in various profile.* output files</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L42" class="LineNr"> 42 </span> << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L43" class="LineNr"> 43 </span> << <span class="Constant">" To browse a <a href='003trace.cc.html#L189'>trace</a> generated by a previous run:</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L44" class="LineNr"> 44 </span> << <span class="Constant">" mu browse-trace file</span><span class="cSpecial">\n</span><span class="Constant">"</span> +<span id="L12" class="LineNr"> 12 </span> cerr << <span class="Constant">"Usage:\n"</span> +<span id="L13" class="LineNr"> 13 </span> << <span class="Constant">" mu [options] [test] [files]\n"</span> +<span id="L14" class="LineNr"> 14 </span> << <span class="Constant">"or:\n"</span> +<span id="L15" class="LineNr"> 15 </span> << <span class="Constant">" mu [options] [test] [files] -- [ingredients for function/recipe 'main']\n"</span> +<span id="L16" class="LineNr"> 16 </span> << <span class="Constant">"Square brackets surround optional arguments.\n"</span> +<span id="L17" class="LineNr"> 17 </span> << <span class="Constant">"\n"</span> +<span id="L18" class="LineNr"> 18 </span> << <span class="Constant">"Examples:\n"</span> +<span id="L19" class="LineNr"> 19 </span> << <span class="Constant">" To load files and run 'main':\n"</span> +<span id="L20" class="LineNr"> 20 </span> << <span class="Constant">" mu file1.mu file2.mu ...\n"</span> +<span id="L21" class="LineNr"> 21 </span> << <span class="Constant">" To run 'main' and dump a <a href='003trace.cc.html#L189'>trace</a> of all operations at the <a href='003trace.cc.html#L225'>end</a>:\n"</span> +<span id="L22" class="LineNr"> 22 </span> << <span class="Constant">" mu --trace file1.mu file2.mu ...\n"</span> +<span id="L23" class="LineNr"> 23 </span> << <span class="Constant">" To run all tests:\n"</span> +<span id="L24" class="LineNr"> 24 </span> << <span class="Constant">" mu test\n"</span> +<span id="L25" class="LineNr"> 25 </span> << <span class="Constant">" To load files and then run all tests:\n"</span> +<span id="L26" class="LineNr"> 26 </span> << <span class="Constant">" mu test file1.mu file2.mu ...\n"</span> +<span id="L27" class="LineNr"> 27 </span> << <span class="Constant">" To run a single Mu <a href='050scenario.cc.html#L57'>scenario</a>:\n"</span> +<span id="L28" class="LineNr"> 28 </span> << <span class="Constant">" mu test file1.mu file2.mu ... scenario\n"</span> +<span id="L29" class="LineNr"> 29 </span> << <span class="Constant">" To run a single Mu <a href='050scenario.cc.html#L57'>scenario</a> and dump a <a href='003trace.cc.html#L189'>trace</a> at the <a href='003trace.cc.html#L225'>end</a>:\n"</span> +<span id="L30" class="LineNr"> 30 </span> << <span class="Constant">" mu --trace test file1.mu file2.mu ... scenario\n"</span> +<span id="L31" class="LineNr"> 31 </span> << <span class="Constant">" To load files and run only the tests in explicitly loaded files (for apps):\n"</span> +<span id="L32" class="LineNr"> 32 </span> << <span class="Constant">" mu --test-only-app test file1.mu file2.mu ...\n"</span> +<span id="L33" class="LineNr"> 33 </span> << <span class="Constant">" To load all files with a numeric prefix in a directory:\n"</span> +<span id="L34" class="LineNr"> 34 </span> << <span class="Constant">" mu directory1 directory2 ...\n"</span> +<span id="L35" class="LineNr"> 35 </span> << <span class="Constant">" You can test directories just like files.\n"</span> +<span id="L36" class="LineNr"> 36 </span> << <span class="Constant">" mu test directory1 directory2 ...\n"</span> +<span id="L37" class="LineNr"> 37 </span> << <span class="Constant">" To pass ingredients to a mu program, provide them after '--':\n"</span> +<span id="L38" class="LineNr"> 38 </span> << <span class="Constant">" mu file_or_dir1 file_or_dir2 ... -- ingredient1 ingredient2 ...\n"</span> +<span id="L39" class="LineNr"> 39 </span> << <span class="Constant">" To see where a mu program is spending its time:\n"</span> +<span id="L40" class="LineNr"> 40 </span> << <span class="Constant">" mu --profile file_or_dir1 file_or_dir2 ...\n"</span> +<span id="L41" class="LineNr"> 41 </span> << <span class="Constant">" this slices and dices time spent in various profile.* output files\n"</span> +<span id="L42" class="LineNr"> 42 </span> << <span class="Constant">"\n"</span> +<span id="L43" class="LineNr"> 43 </span> << <span class="Constant">" To browse a <a href='003trace.cc.html#L189'>trace</a> generated by a previous run:\n"</span> +<span id="L44" class="LineNr"> 44 </span> << <span class="Constant">" mu browse-trace file\n"</span> <span id="L45" class="LineNr"> 45 </span> <span class="Delimiter">;</span> <span id="L46" class="LineNr"> 46 </span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L47" class="LineNr"> 47 </span><span class="Delimiter">}</span> @@ -222,13 +226,13 @@ if ('onhashchange' in window) { <span id="L161" class="LineNr">161 </span> <span class="Normal">switch</span> <span class="Delimiter">(</span>sig<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L162" class="LineNr">162 </span> <span class="Normal">case</span> <span class="Constant">SIGABRT</span>: <span id="L163" class="LineNr">163 </span> <span class="Comment">#ifndef __APPLE__</span> -<span id="L164" class="LineNr">164 </span> cerr << <span class="Constant">"SIGABRT: might be an integer overflow if it wasn't an assert() failure or exception</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L164" class="LineNr">164 </span> cerr << <span class="Constant">"SIGABRT: might be an integer overflow if it wasn't an assert() failure or exception\n"</span><span class="Delimiter">;</span> <span id="L165" class="LineNr">165 </span> _Exit<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L166" class="LineNr">166 </span> <span class="Comment">#endif</span> <span id="L167" class="LineNr">167 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L168" class="LineNr">168 </span> <span class="Normal">case</span> <span class="Constant">SIGILL</span>: <span id="L169" class="LineNr">169 </span> <span class="Comment">#ifdef __APPLE__</span> -<span id="L170" class="LineNr">170 </span> cerr << <span class="Constant">"SIGILL: most likely caused by integer overflow</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L170" class="LineNr">170 </span> cerr << <span class="Constant">"SIGILL: most likely caused by integer overflow\n"</span><span class="Delimiter">;</span> <span id="L171" class="LineNr">171 </span> _Exit<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L172" class="LineNr">172 </span> <span class="Comment">#endif</span> <span id="L173" class="LineNr">173 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -269,25 +273,25 @@ if ('onhashchange' in window) { <span id="L208" class="LineNr">208 </span><span class="Comment">//: 6. Map's operator[] being non-const is fucking evil.</span> <span id="L209" class="LineNr">209 </span><span class="Delimiter">:(before "Globals")</span> <span class="Comment">// can't generate prototypes for these</span> <span id="L210" class="LineNr">210 </span><span class="Comment">// from <a href="http://stackoverflow.com/questions/152643/idiomatic-c-for-reading-from-a-const-map">http://stackoverflow.com/questions/152643/idiomatic-c-for-reading-from-a-const-map</a></span> -<span id="L211" class="LineNr">211 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">typename</span> T::mapped_type& get<span class="Delimiter">(</span>T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L212" class="LineNr">212 </span> <span class="Normal">typename</span> T::iterator iter<span class="Delimiter">(</span>map<span class="Delimiter">.</span>find<span class="Delimiter">(</span>key<span class="Delimiter">));</span> +<span id="L211" class="LineNr">211 </span><span class="Normal">template</span><<span class="Normal">typename</span> <span class="Special">T</span>> <span class="Normal">typename</span> <span class="Special">T</span>::mapped_type& get<span class="Delimiter">(</span><span class="Special">T</span>& map<span class="Delimiter">,</span> <span class="Normal">typename</span> <span class="Special">T</span>::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L212" class="LineNr">212 </span> <span class="Normal">typename</span> <span class="Special">T</span>::iterator iter<span class="Delimiter">(</span>map<span class="Delimiter">.</span>find<span class="Delimiter">(</span>key<span class="Delimiter">));</span> <span id="L213" class="LineNr">213 </span> assert<span class="Delimiter">(</span>iter != map<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">());</span> <span id="L214" class="LineNr">214 </span> <span class="Identifier">return</span> iter<span class="Delimiter">-></span>second<span class="Delimiter">;</span> <span id="L215" class="LineNr">215 </span><span class="Delimiter">}</span> -<span id="L216" class="LineNr">216 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">typename</span> T::mapped_type <span class="Normal">const</span>& get<span class="Delimiter">(</span><span class="Normal">const</span> T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L217" class="LineNr">217 </span> <span class="Normal">typename</span> T::const_iterator iter<span class="Delimiter">(</span>map<span class="Delimiter">.</span>find<span class="Delimiter">(</span>key<span class="Delimiter">));</span> +<span id="L216" class="LineNr">216 </span><span class="Normal">template</span><<span class="Normal">typename</span> <span class="Special">T</span>> <span class="Normal">typename</span> <span class="Special">T</span>::mapped_type <span class="Normal">const</span>& get<span class="Delimiter">(</span><span class="Normal">const</span> <span class="Special">T</span>& map<span class="Delimiter">,</span> <span class="Normal">typename</span> <span class="Special">T</span>::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L217" class="LineNr">217 </span> <span class="Normal">typename</span> <span class="Special">T</span>::const_iterator iter<span class="Delimiter">(</span>map<span class="Delimiter">.</span>find<span class="Delimiter">(</span>key<span class="Delimiter">));</span> <span id="L218" class="LineNr">218 </span> assert<span class="Delimiter">(</span>iter != map<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">());</span> <span id="L219" class="LineNr">219 </span> <span class="Identifier">return</span> iter<span class="Delimiter">-></span>second<span class="Delimiter">;</span> <span id="L220" class="LineNr">220 </span><span class="Delimiter">}</span> -<span id="L221" class="LineNr">221 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">typename</span> T::mapped_type <span class="Normal">const</span>& <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">,</span> <span class="Normal">typename</span> T::mapped_type <span class="Normal">const</span>& value<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L221" class="LineNr">221 </span><span class="Normal">template</span><<span class="Normal">typename</span> <span class="Special">T</span>> <span class="Normal">typename</span> <span class="Special">T</span>::mapped_type <span class="Normal">const</span>& <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">T</span>& map<span class="Delimiter">,</span> <span class="Normal">typename</span> <span class="Special">T</span>::key_type <span class="Normal">const</span>& key<span class="Delimiter">,</span> <span class="Normal">typename</span> <span class="Special">T</span>::mapped_type <span class="Normal">const</span>& value<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L222" class="LineNr">222 </span> <span class="Comment">// map[key] requires mapped_type to have a zero-arg (default) constructor</span> <span id="L223" class="LineNr">223 </span> map<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>std::make_pair<span class="Delimiter">(</span>key<span class="Delimiter">,</span> value<span class="Delimiter">)).</span>first<span class="Delimiter">-></span>second = value<span class="Delimiter">;</span> <span id="L224" class="LineNr">224 </span> <span class="Identifier">return</span> value<span class="Delimiter">;</span> <span id="L225" class="LineNr">225 </span><span class="Delimiter">}</span> -<span id="L226" class="LineNr">226 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">bool</span> <a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L226" class="LineNr">226 </span><span class="Normal">template</span><<span class="Normal">typename</span> <span class="Special">T</span>> <span class="Normal">bool</span> <a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">T</span>& map<span class="Delimiter">,</span> <span class="Normal">typename</span> <span class="Special">T</span>::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L227" class="LineNr">227 </span> <span class="Identifier">return</span> map<span class="Delimiter">.</span>find<span class="Delimiter">(</span>key<span class="Delimiter">)</span> != map<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L228" class="LineNr">228 </span><span class="Delimiter">}</span> -<span id="L229" class="LineNr">229 </span><span class="Normal">template</span><<span class="Normal">typename</span> T> <span class="Normal">typename</span> T::mapped_type& <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>T& map<span class="Delimiter">,</span> <span class="Normal">typename</span> T::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L229" class="LineNr">229 </span><span class="Normal">template</span><<span class="Normal">typename</span> <span class="Special">T</span>> <span class="Normal">typename</span> <span class="Special">T</span>::mapped_type& <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">T</span>& map<span class="Delimiter">,</span> <span class="Normal">typename</span> <span class="Special">T</span>::key_type <span class="Normal">const</span>& key<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L230" class="LineNr">230 </span> <span class="Identifier">return</span> map[key]<span class="Delimiter">;</span> <span id="L231" class="LineNr">231 </span><span class="Delimiter">}</span> <span id="L232" class="LineNr">232 </span><span class="Comment">//: The contract: any container that relies on get_or_insert should never call</span> diff --git a/html/002test.cc.html b/html/002test.cc.html index cbb0124a..2d7d3ff7 100644 --- a/html/002test.cc.html +++ b/html/002test.cc.html @@ -11,18 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Identifier { color: #c0a020; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -57,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/002test.cc'>https://github.com/akkartik/mu/blob/master/002test.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: A simple test harness. To create new tests, define functions starting with</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: 'test_'. To run all tests so defined, run:</span> @@ -72,40 +76,40 @@ if ('onhashchange' in window) { <span id="L12" class="LineNr"> 12 </span><span class="Normal">typedef</span> <span class="Normal">void</span> <span class="Delimiter">(</span>*test_fn<span class="Delimiter">)(</span><span class="Normal">void</span><span class="Delimiter">);</span> <span id="L13" class="LineNr"> 13 </span><span class="Delimiter">:(before "Globals")</span> <span id="L14" class="LineNr"> 14 </span><span class="Comment">// move a global ahead into types that we can't generate an extern declaration for</span> -<span id="L15" class="LineNr"> 15 </span><span class="Normal">const</span> <a href='002test.cc.html#L12'>test_fn</a> Tests[] = <span class="Delimiter">{</span> +<span id="L15" class="LineNr"> 15 </span><span class="Normal">const</span> <a href='002test.cc.html#L12'>test_fn</a> <span class="Special">Tests</span>[] = <span class="Delimiter">{</span> <span id="L16" class="LineNr"> 16 </span> <span class="Comment">#include "test_list" // auto-generated; see 'build*' scripts</span> <span id="L17" class="LineNr"> 17 </span><span class="Delimiter">};</span> <span id="L18" class="LineNr"> 18 </span> <span id="L19" class="LineNr"> 19 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L20" class="LineNr"> 20 </span><span class="Normal">bool</span> Run_tests =<span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L21" class="LineNr"> 21 </span><span class="Normal">bool</span> Passed =<span class="Constant"> true</span><span class="Delimiter">;</span> <span class="Comment">// set this to false inside any test to indicate failure</span> +<span id="L20" class="LineNr"> 20 </span><span class="Normal">bool</span> <span class="Special">Run_tests</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L21" class="LineNr"> 21 </span><span class="Normal">bool</span> <span class="Special">Passed</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> <span class="Comment">// set this to false inside any test to indicate failure</span> <span id="L22" class="LineNr"> 22 </span> <span id="L23" class="LineNr"> 23 </span><span class="Delimiter">:(before "End Includes")</span> <span id="L24" class="LineNr"> 24 </span><span class="Comment">#define CHECK(X) \</span> -<span id="L25" class="LineNr"> 25 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Passed && !<span class="Delimiter">(</span>X<span class="Delimiter">))</span> <span class="Delimiter">{</span> \ -<span id="L26" class="LineNr"> 26 </span> cerr << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">F - "</span> << __FUNCTION__ << <span class="Constant">"("</span> << <span class="Constant">__FILE__</span> << <span class="Constant">":"</span> << <span class="Constant">__LINE__</span> << <span class="Constant">"): "</span> << <span class="Comment">#X << '\n'; \</span> -<span id="L27" class="LineNr"> 27 </span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> \ +<span id="L25" class="LineNr"> 25 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Passed</span> && !<span class="Delimiter">(</span><span class="Special">X</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> \ +<span id="L26" class="LineNr"> 26 </span> cerr << <span class="Constant">"\nF - "</span> << __FUNCTION__ << <span class="Constant">"("</span> << <span class="Constant">__FILE__</span> << <span class="Constant">":"</span> << <span class="Constant">__LINE__</span> << <span class="Constant">"): "</span> << <span class="Comment">#X << '\n'; \</span> +<span id="L27" class="LineNr"> 27 </span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> \ <span id="L28" class="LineNr"> 28 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">/*</span><span class="Comment"> Currently we stop at the very first failure. </span><span class="Comment">*/</span> \ <span id="L29" class="LineNr"> 29 </span> <span class="Delimiter">}</span> <span id="L30" class="LineNr"> 30 </span> <span id="L31" class="LineNr"> 31 </span><span class="Comment">#define CHECK_EQ(X, Y) \</span> -<span id="L32" class="LineNr"> 32 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Passed && <span class="Delimiter">(</span>X<span class="Delimiter">)</span> != <span class="Delimiter">(</span>Y<span class="Delimiter">))</span> <span class="Delimiter">{</span> \ -<span id="L33" class="LineNr"> 33 </span> cerr << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">F - "</span> << __FUNCTION__ << <span class="Constant">"("</span> << <span class="Constant">__FILE__</span> << <span class="Constant">":"</span> << <span class="Constant">__LINE__</span> << <span class="Constant">"): "</span> << <span class="Comment">#X << " == " << #Y << '\n'; \</span> -<span id="L34" class="LineNr"> 34 </span> cerr << <span class="Constant">" got "</span> << <span class="Delimiter">(</span>X<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span class="Comment">/*</span><span class="Comment"> BEWARE: multiple eval </span><span class="Comment">*/</span> \ -<span id="L35" class="LineNr"> 35 </span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> \ +<span id="L32" class="LineNr"> 32 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Passed</span> && <span class="Delimiter">(</span><span class="Special">X</span><span class="Delimiter">)</span> != <span class="Delimiter">(</span><span class="Special">Y</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> \ +<span id="L33" class="LineNr"> 33 </span> cerr << <span class="Constant">"\nF - "</span> << __FUNCTION__ << <span class="Constant">"("</span> << <span class="Constant">__FILE__</span> << <span class="Constant">":"</span> << <span class="Constant">__LINE__</span> << <span class="Constant">"): "</span> << <span class="Comment">#X << " == " << #Y << '\n'; \</span> +<span id="L34" class="LineNr"> 34 </span> cerr << <span class="Constant">" got "</span> << <span class="Delimiter">(</span><span class="Special">X</span><span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span class="Comment">/*</span><span class="Comment"> BEWARE: multiple eval </span><span class="Comment">*/</span> \ +<span id="L35" class="LineNr"> 35 </span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> \ <span id="L36" class="LineNr"> 36 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">/*</span><span class="Comment"> Currently we stop at the very first failure. </span><span class="Comment">*/</span> \ <span id="L37" class="LineNr"> 37 </span> <span class="Delimiter">}</span> <span id="L38" class="LineNr"> 38 </span> <span id="L39" class="LineNr"> 39 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L40" class="LineNr"> 40 </span>Passed =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L40" class="LineNr"> 40 </span><span class="Special">Passed</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L41" class="LineNr"> 41 </span> <span id="L42" class="LineNr"> 42 </span><span class="Delimiter">:(before "End Commandline Parsing")</span> <span id="L43" class="LineNr"> 43 </span><span class="Normal">if</span> <span class="Delimiter">(</span>argc > <span class="Constant">1</span> && <a href='001help.cc.html#L73'>is_equal</a><span class="Delimiter">(</span>argv[<span class="Constant">1</span>]<span class="Delimiter">,</span> <span class="Constant">"test"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L44" class="LineNr"> 44 </span> Run_tests =<span class="Constant"> true</span><span class="Delimiter">;</span> --argc<span class="Delimiter">;</span> ++argv<span class="Delimiter">;</span> <span class="Comment">// shift 'test' out of commandline args</span> +<span id="L44" class="LineNr"> 44 </span> <span class="Special">Run_tests</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> --argc<span class="Delimiter">;</span> ++argv<span class="Delimiter">;</span> <span class="Comment">// shift 'test' out of commandline args</span> <span id="L45" class="LineNr"> 45 </span><span class="Delimiter">}</span> <span id="L46" class="LineNr"> 46 </span> <span id="L47" class="LineNr"> 47 </span><span class="Delimiter">:(before "End Main")</span> -<span id="L48" class="LineNr"> 48 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Run_tests<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L48" class="LineNr"> 48 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Run_tests</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L49" class="LineNr"> 49 </span> <span class="Comment">// Test Runs</span> <span id="L50" class="LineNr"> 50 </span> <span class="Comment">// we run some tests and then exit; assume no state need be maintained afterward</span> <span id="L51" class="LineNr"> 51 </span> @@ -113,10 +117,10 @@ if ('onhashchange' in window) { <span id="L53" class="LineNr"> 53 </span> <span class="Comment">// End Test Run Initialization</span> <span id="L54" class="LineNr"> 54 </span> <span class="Normal">time_t</span> t<span class="Delimiter">;</span> time<span class="Delimiter">(</span>&t<span class="Delimiter">);</span> <span id="L55" class="LineNr"> 55 </span> cerr << <span class="Constant">"C tests: "</span> << ctime<span class="Delimiter">(</span>&t<span class="Delimiter">);</span> -<span id="L56" class="LineNr"> 56 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">size_t</span> i=<span class="Constant">0</span><span class="Delimiter">;</span> i < <span class="Normal">sizeof</span><span class="Delimiter">(</span>Tests<span class="Delimiter">)</span>/<span class="Normal">sizeof</span><span class="Delimiter">(</span>Tests[<span class="Constant">0</span>]<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L56" class="LineNr"> 56 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">size_t</span> i=<span class="Constant">0</span><span class="Delimiter">;</span> i < <span class="Normal">sizeof</span><span class="Delimiter">(</span><span class="Special">Tests</span><span class="Delimiter">)</span>/<span class="Normal">sizeof</span><span class="Delimiter">(</span><span class="Special">Tests</span>[<span class="Constant">0</span>]<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L57" class="LineNr"> 57 </span><span class="CommentedCode">//? cerr << "running " << Test_names[i] << '\n';</span> <span id="L58" class="LineNr"> 58 </span> <a href='002test.cc.html#L74'>run_test</a><span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L59" class="LineNr"> 59 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Passed<span class="Delimiter">)</span> cerr << <span class="Constant">'.'</span><span class="Delimiter">;</span> +<span id="L59" class="LineNr"> 59 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Passed</span><span class="Delimiter">)</span> cerr << <span class="Constant">'.'</span><span class="Delimiter">;</span> <span id="L60" class="LineNr"> 60 </span> <span class="Normal">else</span> ++num_failures<span class="Delimiter">;</span> <span id="L61" class="LineNr"> 61 </span> <span class="Delimiter">}</span> <span id="L62" class="LineNr"> 62 </span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> @@ -132,30 +136,30 @@ if ('onhashchange' in window) { <span id="L72" class="LineNr"> 72 </span> <span id="L73" class="LineNr"> 73 </span><span class="Delimiter">:(code)</span> <span id="L74" class="LineNr"> 74 </span><span class="Normal">void</span> <a href='002test.cc.html#L74'>run_test</a><span class="Delimiter">(</span><span class="Normal">size_t</span> i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L75" class="LineNr"> 75 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>i >= <span class="Normal">sizeof</span><span class="Delimiter">(</span>Tests<span class="Delimiter">)</span>/<span class="Normal">sizeof</span><span class="Delimiter">(</span>Tests[<span class="Constant">0</span>]<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L75" class="LineNr"> 75 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>i >= <span class="Normal">sizeof</span><span class="Delimiter">(</span><span class="Special">Tests</span><span class="Delimiter">)</span>/<span class="Normal">sizeof</span><span class="Delimiter">(</span><span class="Special">Tests</span>[<span class="Constant">0</span>]<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L76" class="LineNr"> 76 </span> cerr << <span class="Constant">"no test "</span> << i << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L77" class="LineNr"> 77 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L78" class="LineNr"> 78 </span> <span class="Delimiter">}</span> <span id="L79" class="LineNr"> 79 </span> <a href='000organization.cc.html#L134'>reset</a><span class="Delimiter">();</span> <span id="L80" class="LineNr"> 80 </span> <span class="Comment">// End Test Setup</span> -<span id="L81" class="LineNr"> 81 </span> <span class="Delimiter">(</span>*Tests[i]<span class="Delimiter">)();</span> +<span id="L81" class="LineNr"> 81 </span> <span class="Delimiter">(</span>*<span class="Special">Tests</span>[i]<span class="Delimiter">)();</span> <span id="L82" class="LineNr"> 82 </span> <span class="Comment">// End Test Teardown</span> <span id="L83" class="LineNr"> 83 </span><span class="Delimiter">}</span> <span id="L84" class="LineNr"> 84 </span> <span id="L85" class="LineNr"> 85 </span><span class="Comment">//: Convenience: run a single test</span> <span id="L86" class="LineNr"> 86 </span><span class="Delimiter">:(before "Globals")</span> <span id="L87" class="LineNr"> 87 </span><span class="Comment">// Names for each element of the 'Tests' global, respectively.</span> -<span id="L88" class="LineNr"> 88 </span><span class="Normal">const</span> string Test_names[] = <span class="Delimiter">{</span> +<span id="L88" class="LineNr"> 88 </span><span class="Normal">const</span> string <span class="Special">Test_names</span>[] = <span class="Delimiter">{</span> <span id="L89" class="LineNr"> 89 </span> <span class="Comment">#include "test_name_list" // auto-generated; see 'build*' scripts</span> <span id="L90" class="LineNr"> 90 </span><span class="Delimiter">};</span> <span id="L91" class="LineNr"> 91 </span><span class="Delimiter">:(after "Test Runs")</span> <span id="L92" class="LineNr"> 92 </span>string maybe_single_test_to_run = argv[argc-<span class="Constant">1</span>]<span class="Delimiter">;</span> <span id="L93" class="LineNr"> 93 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!starts_with<span class="Delimiter">(</span>maybe_single_test_to_run<span class="Delimiter">,</span> <span class="Constant">"test_"</span><span class="Delimiter">))</span> <span id="L94" class="LineNr"> 94 </span> maybe_single_test_to_run<span class="Delimiter">.</span>insert<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">"test_"</span><span class="Delimiter">);</span> -<span id="L95" class="LineNr"> 95 </span><span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">size_t</span> i=<span class="Constant">0</span><span class="Delimiter">;</span> i < <span class="Normal">sizeof</span><span class="Delimiter">(</span>Tests<span class="Delimiter">)</span>/<span class="Normal">sizeof</span><span class="Delimiter">(</span>Tests[<span class="Constant">0</span>]<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L96" class="LineNr"> 96 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Test_names[i] == maybe_single_test_to_run<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L95" class="LineNr"> 95 </span><span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">size_t</span> i=<span class="Constant">0</span><span class="Delimiter">;</span> i < <span class="Normal">sizeof</span><span class="Delimiter">(</span><span class="Special">Tests</span><span class="Delimiter">)</span>/<span class="Normal">sizeof</span><span class="Delimiter">(</span><span class="Special">Tests</span>[<span class="Constant">0</span>]<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L96" class="LineNr"> 96 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Test_names</span>[i] == maybe_single_test_to_run<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L97" class="LineNr"> 97 </span> <a href='002test.cc.html#L74'>run_test</a><span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L98" class="LineNr"> 98 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Passed<span class="Delimiter">)</span> cerr << <span class="Constant">".</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L98" class="LineNr"> 98 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Passed</span><span class="Delimiter">)</span> cerr << <span class="Constant">".\n"</span><span class="Delimiter">;</span> <span id="L99" class="LineNr"> 99 </span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L100" class="LineNr">100 </span> <span class="Delimiter">}</span> <span id="L101" class="LineNr">101 </span><span class="Delimiter">}</span> diff --git a/html/003trace.cc.html b/html/003trace.cc.html index c7c1a4e0..cbda9303 100644 --- a/html/003trace.cc.html +++ b/html/003trace.cc.html @@ -11,17 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Identifier { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -56,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/003trace.cc'>https://github.com/akkartik/mu/blob/master/003trace.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: The goal of layers is to make programs more easy to understand and more</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: malleable, easy to rewrite in radical ways without accidentally breaking</span> @@ -139,20 +143,20 @@ if ('onhashchange' in window) { <span id="L80" class="LineNr"> 80 </span><span class="Comment">//: Traces can have a lot of overhead, so only turn them on when asked.</span> <span id="L81" class="LineNr"> 81 </span><span class="Delimiter">:(before "End Commandline Options(*arg)")</span> <span id="L82" class="LineNr"> 82 </span><span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L73'>is_equal</a><span class="Delimiter">(</span>*arg<span class="Delimiter">,</span> <span class="Constant">"--trace"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L83" class="LineNr"> 83 </span> Save_trace =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L83" class="LineNr"> 83 </span> <span class="Special">Save_trace</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L84" class="LineNr"> 84 </span><span class="Delimiter">}</span> <span id="L85" class="LineNr"> 85 </span><span class="Delimiter">:(before "End Commandline Parsing")</span> -<span id="L86" class="LineNr"> 86 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Save_trace<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L87" class="LineNr"> 87 </span> cerr << <span class="Constant">"initializing <a href='003trace.cc.html#L189'>trace</a></span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> -<span id="L88" class="LineNr"> 88 </span> Trace_stream = <span class="Normal">new</span> trace_stream<span class="Delimiter">;</span> +<span id="L86" class="LineNr"> 86 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Save_trace</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L87" class="LineNr"> 87 </span> cerr << <span class="Constant">"initializing trace\n"</span><span class="Delimiter">;</span> +<span id="L88" class="LineNr"> 88 </span> <span class="Special">Trace_stream</span> = <span class="Normal">new</span> trace_stream<span class="Delimiter">;</span> <span id="L89" class="LineNr"> 89 </span><span class="Delimiter">}</span> <span id="L90" class="LineNr"> 90 </span><span class="Delimiter">:(code)</span> <span id="L91" class="LineNr"> 91 </span><span class="Normal">void</span> <a href='003trace.cc.html#L91'>cleanup_main</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L92" class="LineNr"> 92 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Trace_stream<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L93" class="LineNr"> 93 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Save_trace<span class="Delimiter">)</span> -<span id="L94" class="LineNr"> 94 </span> Trace_stream<span class="Delimiter">-></span><a href='003trace.cc.html#L133'>save</a><span class="Delimiter">();</span> -<span id="L95" class="LineNr"> 95 </span> <span class="Normal">delete</span> Trace_stream<span class="Delimiter">;</span> -<span id="L96" class="LineNr"> 96 </span> Trace_stream = <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L92" class="LineNr"> 92 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L93" class="LineNr"> 93 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Save_trace</span><span class="Delimiter">)</span> +<span id="L94" class="LineNr"> 94 </span> <span class="Special">Trace_stream</span><span class="Delimiter">-></span><a href='003trace.cc.html#L133'>save</a><span class="Delimiter">();</span> +<span id="L95" class="LineNr"> 95 </span> <span class="Normal">delete</span> <span class="Special">Trace_stream</span><span class="Delimiter">;</span> +<span id="L96" class="LineNr"> 96 </span> <span class="Special">Trace_stream</span> = <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L97" class="LineNr"> 97 </span><span class="Delimiter">}</span> <span id="L98" class="LineNr"> 98 </span><span class="Delimiter">:(before "End One-time Setup")</span> <span id="L99" class="LineNr"> 99 </span>atexit<span class="Delimiter">(</span><a href='003trace.cc.html#L91'>cleanup_main</a><span class="Delimiter">);</span> @@ -161,9 +165,9 @@ if ('onhashchange' in window) { <span id="L102" class="LineNr">102 </span><span class="Comment">// Pre-define some global constants that trace_stream needs to know about.</span> <span id="L103" class="LineNr">103 </span><span class="Comment">// Since they're in the Types section, they'll be included in any cleaved</span> <span id="L104" class="LineNr">104 </span><span class="Comment">// compilation units. So no extern linkage.</span> -<span id="L105" class="LineNr">105 </span><span class="Normal">const</span> <span class="Normal">int</span> Max_depth = <span class="Constant">9999</span><span class="Delimiter">;</span> -<span id="L106" class="LineNr">106 </span><span class="Normal">const</span> <span class="Normal">int</span> Error_depth = <span class="Constant">0</span><span class="Delimiter">;</span> <span class="Comment">// definitely always print errors</span> -<span id="L107" class="LineNr">107 </span><span class="Normal">const</span> <span class="Normal">int</span> App_depth = <span class="Constant">2</span><span class="Delimiter">;</span> <span class="Comment">// temporarily where all Mu code will trace to</span> +<span id="L105" class="LineNr">105 </span><span class="Normal">const</span> <span class="Normal">int</span> <span class="Special">Max_depth</span> = <span class="Constant">9999</span><span class="Delimiter">;</span> +<span id="L106" class="LineNr">106 </span><span class="Normal">const</span> <span class="Normal">int</span> <span class="Special">Error_depth</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span class="Comment">// definitely always print errors</span> +<span id="L107" class="LineNr">107 </span><span class="Normal">const</span> <span class="Normal">int</span> <span class="Special">App_depth</span> = <span class="Constant">2</span><span class="Delimiter">;</span> <span class="Comment">// temporarily where all Mu code will trace to</span> <span id="L108" class="LineNr">108 </span> <span id="L109" class="LineNr">109 </span><span class="Normal">struct</span> trace_stream <span class="Delimiter">{</span> <span id="L110" class="LineNr">110 </span> vector<trace_line> past_lines<span class="Delimiter">;</span> @@ -174,11 +178,11 @@ if ('onhashchange' in window) { <span id="L115" class="LineNr">115 </span> <span class="Normal">int</span> callstack_depth<span class="Delimiter">;</span> <span id="L116" class="LineNr">116 </span> <span class="Normal">int</span> collect_depth<span class="Delimiter">;</span> <span id="L117" class="LineNr">117 </span> ofstream<span class="Constant"> null</span>_stream<span class="Delimiter">;</span> <span class="Comment">// never opens a file, so writes silently fail</span> -<span id="L118" class="LineNr">118 </span> trace_stream<span class="Delimiter">()</span> :curr_stream<span class="Delimiter">(</span><span class="Constant">NULL</span><span class="Delimiter">),</span> curr_depth<span class="Delimiter">(</span>Max_depth<span class="Delimiter">),</span> callstack_depth<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">),</span> collect_depth<span class="Delimiter">(</span>Max_depth<span class="Delimiter">)</span> <span class="Delimiter">{}</span> +<span id="L118" class="LineNr">118 </span> trace_stream<span class="Delimiter">()</span> :curr_stream<span class="Delimiter">(</span><span class="Constant">NULL</span><span class="Delimiter">),</span> curr_depth<span class="Delimiter">(</span><span class="Special">Max_depth</span><span class="Delimiter">),</span> callstack_depth<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">),</span> collect_depth<span class="Delimiter">(</span><span class="Special">Max_depth</span><span class="Delimiter">)</span> <span class="Delimiter">{}</span> <span id="L119" class="LineNr">119 </span> <a href='003trace.cc.html#L119'>~trace_stream</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr_stream<span class="Delimiter">)</span> <span class="Normal">delete</span> curr_stream<span class="Delimiter">;</span> <span class="Delimiter">}</span> <span id="L120" class="LineNr">120 </span> <span id="L121" class="LineNr">121 </span> ostream& stream<span class="Delimiter">(</span>string label<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L122" class="LineNr">122 </span> <span class="Identifier">return</span> stream<span class="Delimiter">(</span>Max_depth<span class="Delimiter">,</span> label<span class="Delimiter">);</span> +<span id="L122" class="LineNr">122 </span> <span class="Identifier">return</span> stream<span class="Delimiter">(</span><span class="Special">Max_depth</span><span class="Delimiter">,</span> label<span class="Delimiter">);</span> <span id="L123" class="LineNr">123 </span> <span class="Delimiter">}</span> <span id="L124" class="LineNr">124 </span> <span id="L125" class="LineNr">125 </span> ostream& stream<span class="Delimiter">(</span><span class="Normal">int</span> depth<span class="Delimiter">,</span> string label<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -190,7 +194,7 @@ if ('onhashchange' in window) { <span id="L131" class="LineNr">131 </span> <span class="Delimiter">}</span> <span id="L132" class="LineNr">132 </span> <span id="L133" class="LineNr">133 </span> <span class="Normal">void</span> <a href='003trace.cc.html#L133'>save</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L134" class="LineNr">134 </span> cerr << <span class="Constant">"saving <a href='003trace.cc.html#L189'>trace</a> to 'last_run'</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L134" class="LineNr">134 </span> cerr << <span class="Constant">"saving <a href='003trace.cc.html#L189'>trace</a> to 'last_run'\n"</span><span class="Delimiter">;</span> <span id="L135" class="LineNr">135 </span> ofstream fout<span class="Delimiter">(</span><span class="Constant">"last_run"</span><span class="Delimiter">);</span> <span id="L136" class="LineNr">136 </span> fout << <a href='003trace.cc.html#L163'>readable_contents</a><span class="Delimiter">(</span><span class="Constant">""</span><span class="Delimiter">);</span> <span id="L137" class="LineNr">137 </span> fout<span class="Delimiter">.</span>close<span class="Delimiter">();</span> @@ -208,15 +212,15 @@ if ('onhashchange' in window) { <span id="L149" class="LineNr">149 </span> string curr_contents = curr_stream<span class="Delimiter">-></span>str<span class="Delimiter">();</span> <span id="L150" class="LineNr">150 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!curr_contents<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L151" class="LineNr">151 </span> past_lines<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>trace_line<span class="Delimiter">(</span>curr_depth<span class="Delimiter">,</span> <a href='003trace.cc.html#L394'>trim</a><span class="Delimiter">(</span>curr_label<span class="Delimiter">),</span> curr_contents<span class="Delimiter">));</span> <span class="Comment">// preserve indent in contents</span> -<span id="L152" class="LineNr">152 </span> <span class="Normal">if</span> <span class="Delimiter">((</span>!Hide_errors && curr_label == <span class="Constant">"error"</span><span class="Delimiter">)</span> -<span id="L153" class="LineNr">153 </span> || Dump_trace -<span id="L154" class="LineNr">154 </span> || <span class="Delimiter">(</span>!Dump_label<span class="Delimiter">.</span>empty<span class="Delimiter">()</span> && curr_label == Dump_label<span class="Delimiter">))</span> +<span id="L152" class="LineNr">152 </span> <span class="Normal">if</span> <span class="Delimiter">((</span>!<span class="Special">Hide_errors</span> && curr_label == <span class="Constant">"error"</span><span class="Delimiter">)</span> +<span id="L153" class="LineNr">153 </span> || <span class="Special">Dump_trace</span> +<span id="L154" class="LineNr">154 </span> || <span class="Delimiter">(</span>!<span class="Special">Dump_label</span><span class="Delimiter">.</span>empty<span class="Delimiter">()</span> && curr_label == <span class="Special">Dump_label</span><span class="Delimiter">))</span> <span id="L155" class="LineNr">155 </span> cerr << curr_label << <span class="Constant">": "</span> << curr_contents << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L156" class="LineNr">156 </span> <span class="Delimiter">}</span> <span id="L157" class="LineNr">157 </span> <span class="Normal">delete</span> curr_stream<span class="Delimiter">;</span> <span id="L158" class="LineNr">158 </span> curr_stream = <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L159" class="LineNr">159 </span> curr_label<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L160" class="LineNr">160 </span> curr_depth = Max_depth<span class="Delimiter">;</span> +<span id="L160" class="LineNr">160 </span> curr_depth = <span class="Special">Max_depth</span><span class="Delimiter">;</span> <span id="L161" class="LineNr">161 </span><span class="Delimiter">}</span> <span id="L162" class="LineNr">162 </span> <span id="L163" class="LineNr">163 </span>string trace_stream::<a href='003trace.cc.html#L163'>readable_contents</a><span class="Delimiter">(</span>string label<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -229,17 +233,17 @@ if ('onhashchange' in window) { <span id="L170" class="LineNr">170 </span><span class="Delimiter">}</span> <span id="L171" class="LineNr">171 </span> <span id="L172" class="LineNr">172 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L173" class="LineNr">173 </span>trace_stream* Trace_stream = <span class="Constant">NULL</span><span class="Delimiter">;</span> -<span id="L174" class="LineNr">174 </span><span class="Normal">int</span> Trace_errors = <span class="Constant">0</span><span class="Delimiter">;</span> <span class="Comment">// used only when Trace_stream is NULL</span> +<span id="L173" class="LineNr">173 </span>trace_stream* <span class="Special">Trace_stream</span> = <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L174" class="LineNr">174 </span><span class="Normal">int</span> <span class="Special">Trace_errors</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span class="Comment">// used only when Trace_stream is NULL</span> <span id="L175" class="LineNr">175 </span> <span id="L176" class="LineNr">176 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L177" class="LineNr">177 </span><span class="Normal">bool</span> Hide_errors =<span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// if set, don't print even error trace lines to screen</span> -<span id="L178" class="LineNr">178 </span><span class="Normal">bool</span> Dump_trace =<span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// if set, print trace lines to screen</span> -<span id="L179" class="LineNr">179 </span>string Dump_label = <span class="Constant">""</span><span class="Delimiter">;</span> <span class="Comment">// if set, print trace lines matching a single label to screen</span> +<span id="L177" class="LineNr">177 </span><span class="Normal">bool</span> <span class="Special">Hide_errors</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// if set, don't print even error trace lines to screen</span> +<span id="L178" class="LineNr">178 </span><span class="Normal">bool</span> <span class="Special">Dump_trace</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// if set, print trace lines to screen</span> +<span id="L179" class="LineNr">179 </span>string <span class="Special">Dump_label</span> = <span class="Constant">""</span><span class="Delimiter">;</span> <span class="Comment">// if set, print trace lines matching a single label to screen</span> <span id="L180" class="LineNr">180 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L181" class="LineNr">181 </span>Hide_errors =<span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L182" class="LineNr">182 </span>Dump_trace =<span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// toggle this to print traces to screen as they are emitted</span> -<span id="L183" class="LineNr">183 </span>Dump_label = <span class="Constant">""</span><span class="Delimiter">;</span> +<span id="L181" class="LineNr">181 </span><span class="Special">Hide_errors</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L182" class="LineNr">182 </span><span class="Special">Dump_trace</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// toggle this to print traces to screen as they are emitted</span> +<span id="L183" class="LineNr">183 </span><span class="Special">Dump_label</span> = <span class="Constant">""</span><span class="Delimiter">;</span> <span id="L184" class="LineNr">184 </span> <span id="L185" class="LineNr">185 </span><span class="Delimiter">:(before "End Includes")</span> <span id="L186" class="LineNr">186 </span><span class="Comment">#define CLEAR_TRACE delete Trace_stream, Trace_stream = new trace_stream;</span> @@ -265,31 +269,31 @@ if ('onhashchange' in window) { <span id="L206" class="LineNr">206 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!tb_is_active<span class="Delimiter">())</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L207" class="LineNr">207 </span> <span class="Comment">// leave the screen in a relatively clean state</span> <span id="L208" class="LineNr">208 </span> tb_set_cursor<span class="Delimiter">(</span>tb_width<span class="Delimiter">()</span>-<span class="Constant">1</span><span class="Delimiter">,</span> tb_height<span class="Delimiter">()</span>-<span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L209" class="LineNr">209 </span> cout << <span class="Constant">"</span><span class="cSpecial">\r\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L209" class="LineNr">209 </span> cout << <span class="Constant">"\r\n"</span><span class="Delimiter">;</span> <span id="L210" class="LineNr">210 </span> tb_shutdown<span class="Delimiter">();</span> <span id="L211" class="LineNr">211 </span><span class="Delimiter">}</span> <span id="L212" class="LineNr">212 </span> <span id="L213" class="LineNr">213 </span><span class="Comment">// Inside tests, fail any tests that displayed (unexpected) errors.</span> <span id="L214" class="LineNr">214 </span><span class="Comment">// Expected errors in tests should always be hidden and silently checked for.</span> <span id="L215" class="LineNr">215 </span><span class="Delimiter">:(before "End Test Teardown")</span> -<span id="L216" class="LineNr">216 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Passed && !Hide_errors && <a href='003trace.cc.html#L220'>trace_contains_errors</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L217" class="LineNr">217 </span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L216" class="LineNr">216 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Passed</span> && !<span class="Special">Hide_errors</span> && <a href='003trace.cc.html#L220'>trace_contains_errors</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> +<span id="L217" class="LineNr">217 </span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L218" class="LineNr">218 </span><span class="Delimiter">}</span> <span id="L219" class="LineNr">219 </span><span class="Delimiter">:(code)</span> <span id="L220" class="LineNr">220 </span><span class="Normal">bool</span> <a href='003trace.cc.html#L220'>trace_contains_errors</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L221" class="LineNr">221 </span> <span class="Identifier">return</span> Trace_errors > <span class="Constant">0</span> || trace_count<span class="Delimiter">(</span><span class="Constant">"error"</span><span class="Delimiter">)</span> > <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L221" class="LineNr">221 </span> <span class="Identifier">return</span> <span class="Special">Trace_errors</span> > <span class="Constant">0</span> || trace_count<span class="Delimiter">(</span><span class="Constant">"error"</span><span class="Delimiter">)</span> > <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L222" class="LineNr">222 </span><span class="Delimiter">}</span> <span id="L223" class="LineNr">223 </span> <span id="L224" class="LineNr">224 </span><span class="Delimiter">:(before "End Types")</span> <span id="L225" class="LineNr">225 </span><span class="Normal">struct</span> <a href='003trace.cc.html#L225'>end</a> <span class="Delimiter">{};</span> <span id="L226" class="LineNr">226 </span><span class="Delimiter">:(code)</span> <span id="L227" class="LineNr">227 </span>ostream& <span class="Normal">operator</span><<<span class="Delimiter">(</span>ostream& os<span class="Delimiter">,</span> <a href='003trace.cc.html#L225'>end</a> <span class="Comment">/*</span><span class="Comment">unused</span><span class="Comment">*/</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L228" class="LineNr">228 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> Trace_stream<span class="Delimiter">-></span><a href='003trace.cc.html#L147'>newline</a><span class="Delimiter">();</span> +<span id="L228" class="LineNr">228 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Special">Trace_stream</span><span class="Delimiter">-></span><a href='003trace.cc.html#L147'>newline</a><span class="Delimiter">();</span> <span id="L229" class="LineNr">229 </span> <span class="Identifier">return</span> os<span class="Delimiter">;</span> <span id="L230" class="LineNr">230 </span><span class="Delimiter">}</span> <span id="L231" class="LineNr">231 </span> <span id="L232" class="LineNr">232 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L233" class="LineNr">233 </span><span class="Normal">bool</span> Save_trace =<span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// if set, write out trace to disk</span> +<span id="L233" class="LineNr">233 </span><span class="Normal">bool</span> <span class="Special">Save_trace</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// if set, write out trace to disk</span> <span id="L234" class="LineNr">234 </span> <span id="L235" class="LineNr">235 </span><span class="Comment">// Trace_stream is a resource, lease_tracer uses RAII to manage it.</span> <span id="L236" class="LineNr">236 </span><span class="Delimiter">:(before "End Types")</span> @@ -298,10 +302,10 @@ if ('onhashchange' in window) { <span id="L239" class="LineNr">239 </span> <a href='003trace.cc.html#L243'>~lease_tracer</a><span class="Delimiter">();</span> <span id="L240" class="LineNr">240 </span><span class="Delimiter">};</span> <span id="L241" class="LineNr">241 </span><span class="Delimiter">:(code)</span> -<span id="L242" class="LineNr">242 </span>lease_tracer::lease_tracer<span class="Delimiter">()</span> <span class="Delimiter">{</span> Trace_stream = <span class="Normal">new</span> trace_stream<span class="Delimiter">;</span> <span class="Delimiter">}</span> +<span id="L242" class="LineNr">242 </span>lease_tracer::lease_tracer<span class="Delimiter">()</span> <span class="Delimiter">{</span> <span class="Special">Trace_stream</span> = <span class="Normal">new</span> trace_stream<span class="Delimiter">;</span> <span class="Delimiter">}</span> <span id="L243" class="LineNr">243 </span>lease_tracer::<a href='003trace.cc.html#L243'>~lease_tracer</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L244" class="LineNr">244 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Save_trace<span class="Delimiter">)</span> Trace_stream<span class="Delimiter">-></span><a href='003trace.cc.html#L133'>save</a><span class="Delimiter">();</span> -<span id="L245" class="LineNr">245 </span> <span class="Normal">delete</span> Trace_stream<span class="Delimiter">,</span> Trace_stream = <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L244" class="LineNr">244 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Save_trace</span><span class="Delimiter">)</span> <span class="Special">Trace_stream</span><span class="Delimiter">-></span><a href='003trace.cc.html#L133'>save</a><span class="Delimiter">();</span> +<span id="L245" class="LineNr">245 </span> <span class="Normal">delete</span> <span class="Special">Trace_stream</span><span class="Delimiter">,</span> <span class="Special">Trace_stream</span> = <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L246" class="LineNr">246 </span><span class="Delimiter">}</span> <span id="L247" class="LineNr">247 </span><span class="Delimiter">:(before "End Includes")</span> <span id="L248" class="LineNr">248 </span><span class="Comment">#define START_TRACING_UNTIL_END_OF_SCOPE lease_tracer leased_tracer;</span> @@ -313,19 +317,19 @@ if ('onhashchange' in window) { <span id="L254" class="LineNr">254 </span> <span id="L255" class="LineNr">255 </span><span class="Comment">#define CHECK_TRACE_CONTAINS_ERRORS() CHECK(trace_contains_errors())</span> <span id="L256" class="LineNr">256 </span><span class="Comment">#define CHECK_TRACE_DOESNT_CONTAIN_ERRORS() \</span> -<span id="L257" class="LineNr">257 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Passed && <a href='003trace.cc.html#L220'>trace_contains_errors</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> \ -<span id="L258" class="LineNr">258 </span> cerr << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">F - "</span> << __FUNCTION__ << <span class="Constant">"("</span> << <span class="Constant">__FILE__</span> << <span class="Constant">":"</span> << <span class="Constant">__LINE__</span> << <span class="Constant">"): unexpected errors</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> \ +<span id="L257" class="LineNr">257 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Passed</span> && <a href='003trace.cc.html#L220'>trace_contains_errors</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> \ +<span id="L258" class="LineNr">258 </span> cerr << <span class="Constant">"\nF - "</span> << __FUNCTION__ << <span class="Constant">"("</span> << <span class="Constant">__FILE__</span> << <span class="Constant">":"</span> << <span class="Constant">__LINE__</span> << <span class="Constant">"): unexpected errors\n"</span><span class="Delimiter">;</span> \ <span id="L259" class="LineNr">259 </span> <a href='003trace.cc.html#L193'>DUMP</a><span class="Delimiter">(</span><span class="Constant">"error"</span><span class="Delimiter">);</span> \ -<span id="L260" class="LineNr">260 </span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> \ +<span id="L260" class="LineNr">260 </span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> \ <span id="L261" class="LineNr">261 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> \ <span id="L262" class="LineNr">262 </span> <span class="Delimiter">}</span> <span id="L263" class="LineNr">263 </span> <span id="L264" class="LineNr">264 </span><span class="Comment">#define CHECK_TRACE_COUNT(label, count) \</span> -<span id="L265" class="LineNr">265 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Passed && trace_count<span class="Delimiter">(</span>label<span class="Delimiter">)</span> != <span class="Delimiter">(</span>count<span class="Delimiter">))</span> <span class="Delimiter">{</span> \ -<span id="L266" class="LineNr">266 </span> cerr << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">F - "</span> << __FUNCTION__ << <span class="Constant">"("</span> << <span class="Constant">__FILE__</span> << <span class="Constant">":"</span> << <span class="Constant">__LINE__</span> << <span class="Constant">"): trace_count of "</span> << label << <span class="Constant">" should be "</span> << count << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> \ +<span id="L265" class="LineNr">265 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Passed</span> && trace_count<span class="Delimiter">(</span>label<span class="Delimiter">)</span> != <span class="Delimiter">(</span>count<span class="Delimiter">))</span> <span class="Delimiter">{</span> \ +<span id="L266" class="LineNr">266 </span> cerr << <span class="Constant">"\nF - "</span> << __FUNCTION__ << <span class="Constant">"("</span> << <span class="Constant">__FILE__</span> << <span class="Constant">":"</span> << <span class="Constant">__LINE__</span> << <span class="Constant">"): trace_count of "</span> << label << <span class="Constant">" should be "</span> << count << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> \ <span id="L267" class="LineNr">267 </span> cerr << <span class="Constant">" got "</span> << trace_count<span class="Delimiter">(</span>label<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span class="Comment">/*</span><span class="Comment"> multiple eval </span><span class="Comment">*/</span> \ <span id="L268" class="LineNr">268 </span> <a href='003trace.cc.html#L193'>DUMP</a><span class="Delimiter">(</span>label<span class="Delimiter">);</span> \ -<span id="L269" class="LineNr">269 </span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> \ +<span id="L269" class="LineNr">269 </span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> \ <span id="L270" class="LineNr">270 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">/*</span><span class="Comment"> Currently we stop at the very first failure. </span><span class="Comment">*/</span> \ <span id="L271" class="LineNr">271 </span> <span class="Delimiter">}</span> <span id="L272" class="LineNr">272 </span> @@ -333,8 +337,8 @@ if ('onhashchange' in window) { <span id="L274" class="LineNr">274 </span> <span id="L275" class="LineNr">275 </span><span class="Delimiter">:(code)</span> <span id="L276" class="LineNr">276 </span><span class="Normal">bool</span> <a href='003trace.cc.html#L276'>check_trace_contents</a><span class="Delimiter">(</span>string FUNCTION<span class="Delimiter">,</span> string <span class="Normal">FILE</span><span class="Delimiter">,</span> <span class="Normal">int</span> LINE<span class="Delimiter">,</span> string expected<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L277" class="LineNr">277 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Passed<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L278" class="LineNr">278 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Trace_stream<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L277" class="LineNr">277 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Passed</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L278" class="LineNr">278 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L279" class="LineNr">279 </span> vector<string> expected_lines = <a href='003trace.cc.html#L370'>split</a><span class="Delimiter">(</span>expected<span class="Delimiter">,</span> <span class="Constant">"^D"</span><span class="Delimiter">);</span> <span id="L280" class="LineNr">280 </span> <span class="Normal">int</span> curr_expected_line = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L281" class="LineNr">281 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>curr_expected_line < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>expected_lines<span class="Delimiter">)</span> && expected_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>curr_expected_line<span class="Delimiter">).</span>empty<span class="Delimiter">())</span> @@ -342,7 +346,7 @@ if ('onhashchange' in window) { <span id="L283" class="LineNr">283 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr_expected_line == <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>expected_lines<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L284" class="LineNr">284 </span> string label<span class="Delimiter">,</span> contents<span class="Delimiter">;</span> <span id="L285" class="LineNr">285 </span> <a href='003trace.cc.html#L308'>split_label_contents</a><span class="Delimiter">(</span>expected_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>curr_expected_line<span class="Delimiter">),</span> &label<span class="Delimiter">,</span> &contents<span class="Delimiter">);</span> -<span id="L286" class="LineNr">286 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<trace_line>::iterator p = Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L286" class="LineNr">286 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<trace_line>::iterator p = <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L287" class="LineNr">287 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>label != p<span class="Delimiter">-></span>label<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L288" class="LineNr">288 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>contents != <a href='003trace.cc.html#L394'>trim</a><span class="Delimiter">(</span>p<span class="Delimiter">-></span>contents<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L289" class="LineNr">289 </span> ++curr_expected_line<span class="Delimiter">;</span> @@ -353,14 +357,14 @@ if ('onhashchange' in window) { <span id="L294" class="LineNr">294 </span> <span class="Delimiter">}</span> <span id="L295" class="LineNr">295 </span> <span id="L296" class="LineNr">296 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='003trace.cc.html#L321'>line_exists_anywhere</a><span class="Delimiter">(</span>label<span class="Delimiter">,</span> contents<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L297" class="LineNr">297 </span> cerr << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">F - "</span> << FUNCTION << <span class="Constant">"("</span> << <span class="Normal">FILE</span> << <span class="Constant">":"</span> << LINE << <span class="Constant">"): line ["</span> << label << <span class="Constant">": "</span> << contents << <span class="Constant">"] out of order in <a href='003trace.cc.html#L189'>trace</a>:</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L297" class="LineNr">297 </span> cerr << <span class="Constant">"\nF - "</span> << FUNCTION << <span class="Constant">"("</span> << <span class="Normal">FILE</span> << <span class="Constant">":"</span> << LINE << <span class="Constant">"): line ["</span> << label << <span class="Constant">": "</span> << contents << <span class="Constant">"] out of order in <a href='003trace.cc.html#L189'>trace</a>:\n"</span><span class="Delimiter">;</span> <span id="L298" class="LineNr">298 </span> <a href='003trace.cc.html#L193'>DUMP</a><span class="Delimiter">(</span><span class="Constant">""</span><span class="Delimiter">);</span> <span id="L299" class="LineNr">299 </span> <span class="Delimiter">}</span> <span id="L300" class="LineNr">300 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> -<span id="L301" class="LineNr">301 </span> cerr << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">F - "</span> << FUNCTION << <span class="Constant">"("</span> << <span class="Normal">FILE</span> << <span class="Constant">":"</span> << LINE << <span class="Constant">"): missing ["</span> << contents << <span class="Constant">"] in <a href='003trace.cc.html#L189'>trace</a>:</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L301" class="LineNr">301 </span> cerr << <span class="Constant">"\nF - "</span> << FUNCTION << <span class="Constant">"("</span> << <span class="Normal">FILE</span> << <span class="Constant">":"</span> << LINE << <span class="Constant">"): missing ["</span> << contents << <span class="Constant">"] in <a href='003trace.cc.html#L189'>trace</a>:\n"</span><span class="Delimiter">;</span> <span id="L302" class="LineNr">302 </span> <a href='003trace.cc.html#L193'>DUMP</a><span class="Delimiter">(</span>label<span class="Delimiter">);</span> <span id="L303" class="LineNr">303 </span> <span class="Delimiter">}</span> -<span id="L304" class="LineNr">304 </span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L304" class="LineNr">304 </span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L305" class="LineNr">305 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L306" class="LineNr">306 </span><span class="Delimiter">}</span> <span id="L307" class="LineNr">307 </span> @@ -378,7 +382,7 @@ if ('onhashchange' in window) { <span id="L319" class="LineNr">319 </span><span class="Delimiter">}</span> <span id="L320" class="LineNr">320 </span> <span id="L321" class="LineNr">321 </span><span class="Normal">bool</span> <a href='003trace.cc.html#L321'>line_exists_anywhere</a><span class="Delimiter">(</span><span class="Normal">const</span> string& label<span class="Delimiter">,</span> <span class="Normal">const</span> string& contents<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L322" class="LineNr">322 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<trace_line>::iterator p = Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L322" class="LineNr">322 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<trace_line>::iterator p = <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L323" class="LineNr">323 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>label != p<span class="Delimiter">-></span>label<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L324" class="LineNr">324 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>contents == <a href='003trace.cc.html#L394'>trim</a><span class="Delimiter">(</span>p<span class="Delimiter">-></span>contents<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L325" class="LineNr">325 </span> <span class="Delimiter">}</span> @@ -390,9 +394,9 @@ if ('onhashchange' in window) { <span id="L331" class="LineNr">331 </span><span class="Delimiter">}</span> <span id="L332" class="LineNr">332 </span> <span id="L333" class="LineNr">333 </span><span class="Normal">int</span> trace_count<span class="Delimiter">(</span>string label<span class="Delimiter">,</span> string line<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L334" class="LineNr">334 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Trace_stream<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L334" class="LineNr">334 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L335" class="LineNr">335 </span> <span class="Normal">long</span> result = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L336" class="LineNr">336 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<trace_line>::iterator p = Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L336" class="LineNr">336 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<trace_line>::iterator p = <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L337" class="LineNr">337 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>label == p<span class="Delimiter">-></span>label<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L338" class="LineNr">338 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>line == <span class="Constant">""</span> || <a href='003trace.cc.html#L394'>trim</a><span class="Delimiter">(</span>line<span class="Delimiter">)</span> == <a href='003trace.cc.html#L394'>trim</a><span class="Delimiter">(</span>p<span class="Delimiter">-></span>contents<span class="Delimiter">))</span> <span id="L339" class="LineNr">339 </span> ++result<span class="Delimiter">;</span> @@ -402,9 +406,9 @@ if ('onhashchange' in window) { <span id="L343" class="LineNr">343 </span><span class="Delimiter">}</span> <span id="L344" class="LineNr">344 </span> <span id="L345" class="LineNr">345 </span><span class="Normal">int</span> <a href='003trace.cc.html#L345'>trace_count_prefix</a><span class="Delimiter">(</span>string label<span class="Delimiter">,</span> string prefix<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L346" class="LineNr">346 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Trace_stream<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L346" class="LineNr">346 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L347" class="LineNr">347 </span> <span class="Normal">long</span> result = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L348" class="LineNr">348 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<trace_line>::iterator p = Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L348" class="LineNr">348 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<trace_line>::iterator p = <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L349" class="LineNr">349 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>label == p<span class="Delimiter">-></span>label<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L350" class="LineNr">350 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L77'>starts_with</a><span class="Delimiter">(</span><a href='003trace.cc.html#L394'>trim</a><span class="Delimiter">(</span>p<span class="Delimiter">-></span>contents<span class="Delimiter">),</span> <a href='003trace.cc.html#L394'>trim</a><span class="Delimiter">(</span>prefix<span class="Delimiter">)))</span> <span id="L351" class="LineNr">351 </span> ++result<span class="Delimiter">;</span> @@ -420,7 +424,7 @@ if ('onhashchange' in window) { <span id="L361" class="LineNr">361 </span><span class="Normal">bool</span> trace_doesnt_contain<span class="Delimiter">(</span>string expected<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L362" class="LineNr">362 </span> vector<string> tmp = <a href='003trace.cc.html#L385'>split_first</a><span class="Delimiter">(</span>expected<span class="Delimiter">,</span> <span class="Constant">": "</span><span class="Delimiter">);</span> <span id="L363" class="LineNr">363 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>tmp<span class="Delimiter">)</span> == <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L364" class="LineNr">364 </span> <a href='003trace.cc.html#L196'>raise</a> << expected << <span class="Constant">": missing label or contents in <a href='003trace.cc.html#L189'>trace</a> line</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L364" class="LineNr">364 </span> <a href='003trace.cc.html#L196'>raise</a> << expected << <span class="Constant">": missing label or contents in <a href='003trace.cc.html#L189'>trace</a> line\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L365" class="LineNr">365 </span> assert<span class="Delimiter">(</span><span class="Constant">false</span><span class="Delimiter">);</span> <span id="L366" class="LineNr">366 </span> <span class="Delimiter">}</span> <span id="L367" class="LineNr">367 </span> <span class="Identifier">return</span> trace_doesnt_contain<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">),</span> tmp<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">));</span> @@ -487,8 +491,8 @@ if ('onhashchange' in window) { <span id="L428" class="LineNr">428 </span><span class="Comment">//: Errors will be depth 0.</span> <span id="L429" class="LineNr">429 </span><span class="Comment">//: Mu 'applications' will be able to use depths 1-100 as they like.</span> <span id="L430" class="LineNr">430 </span><span class="Comment">//: Primitive statements will occupy 101-9989</span> -<span id="L431" class="LineNr">431 </span><span class="Normal">extern</span> <span class="Normal">const</span> <span class="Normal">int</span> Initial_callstack_depth = <span class="Constant">101</span><span class="Delimiter">;</span> -<span id="L432" class="LineNr">432 </span><span class="Normal">extern</span> <span class="Normal">const</span> <span class="Normal">int</span> Max_callstack_depth = <span class="Constant">9989</span><span class="Delimiter">;</span> +<span id="L431" class="LineNr">431 </span><span class="Normal">extern</span> <span class="Normal">const</span> <span class="Normal">int</span> <span class="Special">Initial_callstack_depth</span> = <span class="Constant">101</span><span class="Delimiter">;</span> +<span id="L432" class="LineNr">432 </span><span class="Normal">extern</span> <span class="Normal">const</span> <span class="Normal">int</span> <span class="Special">Max_callstack_depth</span> = <span class="Constant">9989</span><span class="Delimiter">;</span> <span id="L433" class="LineNr">433 </span><span class="Comment">//: Finally, details of primitive Mu statements will occupy depth 9990-9999</span> <span id="L434" class="LineNr">434 </span><span class="Comment">//: (more on that later as well)</span> <span id="L435" class="LineNr">435 </span><span class="Comment">//:</span> diff --git a/html/003trace.test.cc.html b/html/003trace.test.cc.html index eccb5493..09607bbd 100644 --- a/html/003trace.test.cc.html +++ b/html/003trace.test.cc.html @@ -11,17 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.cSpecial { color: #008000; } +.Comment { color: #8080ff; } --> </style> @@ -55,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/003trace.test.cc'>https://github.com/akkartik/mu/blob/master/003trace.test.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Normal">void</span> <a href='003trace.test.cc.html#L1'>test_trace_check_compares</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> <span id="L2" class="LineNr"> 2 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"test layer"</span><span class="Delimiter">)</span> << <span class="Constant">"foo"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> @@ -87,7 +89,7 @@ if ('onhashchange' in window) { <span id="L29" class="LineNr"> 29 </span><span class="Delimiter">}</span> <span id="L30" class="LineNr"> 30 </span> <span id="L31" class="LineNr"> 31 </span><span class="Normal">void</span> <a href='003trace.test.cc.html#L31'>test_trace_ignores_trailing_whitespace</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L32" class="LineNr"> 32 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"test layer 1"</span><span class="Delimiter">)</span> << <span class="Constant">"foo</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L32" class="LineNr"> 32 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"test layer 1"</span><span class="Delimiter">)</span> << <span class="Constant">"foo\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L33" class="LineNr"> 33 </span> <a href='003trace.cc.html#L253'>CHECK_TRACE_CONTENTS</a><span class="Delimiter">(</span><span class="Constant">"test layer 1: foo"</span><span class="Delimiter">);</span> <span id="L34" class="LineNr"> 34 </span><span class="Delimiter">}</span> <span id="L35" class="LineNr"> 35 </span> @@ -116,7 +118,7 @@ if ('onhashchange' in window) { <span id="L58" class="LineNr"> 58 </span><span class="Delimiter">}</span> <span id="L59" class="LineNr"> 59 </span> <span id="L60" class="LineNr"> 60 </span><span class="Normal">void</span> <a href='003trace.test.cc.html#L60'>test_trace_count_ignores_trailing_whitespace</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L61" class="LineNr"> 61 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"test layer 1"</span><span class="Delimiter">)</span> << <span class="Constant">"foo</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L61" class="LineNr"> 61 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"test layer 1"</span><span class="Delimiter">)</span> << <span class="Constant">"foo\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L62" class="LineNr"> 62 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span>trace_count<span class="Delimiter">(</span><span class="Constant">"test layer 1"</span><span class="Delimiter">,</span> <span class="Constant">"foo"</span><span class="Delimiter">),</span> <span class="Constant">1</span><span class="Delimiter">);</span> <span id="L63" class="LineNr"> 63 </span><span class="Delimiter">}</span> <span id="L64" class="LineNr"> 64 </span> diff --git a/html/010vm.cc.html b/html/010vm.cc.html index 8e674214..5ecaa30d 100644 --- a/html/010vm.cc.html +++ b/html/010vm.cc.html @@ -11,19 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .CommentedCode { color: #6c6c6c; } .SalientComment { color: #00ffff; } --> @@ -59,14 +62,15 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/010vm.cc'>https://github.com/akkartik/mu/blob/master/010vm.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: A Mu program is a book of 'recipes' (functions)</span> <span id="L2" class="LineNr"> 2 </span><span class="Delimiter">:(before "End Globals")</span> <span id="L3" class="LineNr"> 3 </span><span class="Comment">//: Each recipe is stored at a specific page number, or ordinal.</span> -<span id="L4" class="LineNr"> 4 </span>map<recipe_ordinal<span class="Delimiter">,</span> recipe> Recipe<span class="Delimiter">;</span> +<span id="L4" class="LineNr"> 4 </span>map<recipe_ordinal<span class="Delimiter">,</span> recipe> <span class="Special">Recipe</span><span class="Delimiter">;</span> <span id="L5" class="LineNr"> 5 </span><span class="Comment">//: You can also refer to each recipe by its name.</span> -<span id="L6" class="LineNr"> 6 </span>map<string<span class="Delimiter">,</span> recipe_ordinal> Recipe_ordinal<span class="Delimiter">;</span> -<span id="L7" class="LineNr"> 7 </span><a href='010vm.cc.html#L14'>recipe_ordinal</a> Next_recipe_ordinal = <span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L6" class="LineNr"> 6 </span>map<string<span class="Delimiter">,</span> recipe_ordinal> <span class="Special">Recipe_ordinal</span><span class="Delimiter">;</span> +<span id="L7" class="LineNr"> 7 </span><a href='010vm.cc.html#L14'>recipe_ordinal</a> <span class="Special">Next_recipe_ordinal</span> = <span class="Constant">1</span><span class="Delimiter">;</span> <span id="L8" class="LineNr"> 8 </span> <span id="L9" class="LineNr"> 9 </span><span class="Comment">//: Ordinals are like numbers, except you can't do arithmetic on them. Ordinal</span> <span id="L10" class="LineNr"> 10 </span><span class="Comment">//: 1 is not less than 2, it's just different. Phone numbers are ordinals;</span> @@ -167,13 +171,13 @@ if ('onhashchange' in window) { <span id="L105" class="LineNr">105 </span> <span id="L106" class="LineNr">106 </span><span class="Comment">// End type_tree Definition</span> <span id="L107" class="LineNr">107 </span><span class="Delimiter">:(code)</span> -<span id="L108" class="LineNr">108 </span>type_tree::type_tree<span class="Delimiter">(</span>string name<span class="Delimiter">)</span> :atom<span class="Delimiter">(</span><span class="Constant">true</span><span class="Delimiter">),</span> name<span class="Delimiter">(</span>name<span class="Delimiter">),</span> value<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">)),</span> left<span class="Delimiter">(</span><span class="Constant">NULL</span><span class="Delimiter">),</span> right<span class="Delimiter">(</span><span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Delimiter">{}</span> +<span id="L108" class="LineNr">108 </span>type_tree::type_tree<span class="Delimiter">(</span>string name<span class="Delimiter">)</span> :atom<span class="Delimiter">(</span><span class="Constant">true</span><span class="Delimiter">),</span> name<span class="Delimiter">(</span>name<span class="Delimiter">),</span> value<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> name<span class="Delimiter">)),</span> left<span class="Delimiter">(</span><span class="Constant">NULL</span><span class="Delimiter">),</span> right<span class="Delimiter">(</span><span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Delimiter">{}</span> <span id="L109" class="LineNr">109 </span> <span id="L110" class="LineNr">110 </span><span class="Delimiter">:(before "End Globals")</span> <span id="L111" class="LineNr">111 </span><span class="Comment">// Locations refer to a common 'memory'. Each location can store a number.</span> -<span id="L112" class="LineNr">112 </span>map<<span class="Normal">int</span><span class="Delimiter">,</span> <span class="Normal">double</span>> Memory<span class="Delimiter">;</span> +<span id="L112" class="LineNr">112 </span>map<<span class="Normal">int</span><span class="Delimiter">,</span> <span class="Normal">double</span>> <span class="Special">Memory</span><span class="Delimiter">;</span> <span id="L113" class="LineNr">113 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L114" class="LineNr">114 </span>Memory<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L114" class="LineNr">114 </span><span class="Special">Memory</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L115" class="LineNr">115 </span> <span id="L116" class="LineNr">116 </span><span class="Delimiter">:(after "Types")</span> <span id="L117" class="LineNr">117 </span><span class="Comment">// Mu types encode how the numbers stored in different parts of memory are</span> @@ -186,41 +190,41 @@ if ('onhashchange' in window) { <span id="L124" class="LineNr">124 </span><span class="Comment">// seamless experience to help understand arbitrary Mu programs.</span> <span id="L125" class="LineNr">125 </span><span class="Normal">typedef</span> <span class="Normal">int</span> <a href='010vm.cc.html#L125'>type_ordinal</a><span class="Delimiter">;</span> <span id="L126" class="LineNr">126 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L127" class="LineNr">127 </span>map<string<span class="Delimiter">,</span> type_ordinal> Type_ordinal<span class="Delimiter">;</span> -<span id="L128" class="LineNr">128 </span>map<type_ordinal<span class="Delimiter">,</span> type_info> Type<span class="Delimiter">;</span> -<span id="L129" class="LineNr">129 </span><a href='010vm.cc.html#L125'>type_ordinal</a> Next_type_ordinal = <span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L130" class="LineNr">130 </span><a href='010vm.cc.html#L125'>type_ordinal</a> Number_type_ordinal = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L131" class="LineNr">131 </span><a href='010vm.cc.html#L125'>type_ordinal</a> Boolean_type_ordinal = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L132" class="LineNr">132 </span><a href='010vm.cc.html#L125'>type_ordinal</a> Character_type_ordinal = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L133" class="LineNr">133 </span><a href='010vm.cc.html#L125'>type_ordinal</a> Address_type_ordinal = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L134" class="LineNr">134 </span><a href='010vm.cc.html#L125'>type_ordinal</a> Array_type_ordinal = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L127" class="LineNr">127 </span>map<string<span class="Delimiter">,</span> type_ordinal> <span class="Special">Type_ordinal</span><span class="Delimiter">;</span> +<span id="L128" class="LineNr">128 </span>map<type_ordinal<span class="Delimiter">,</span> type_info> <span class="Special">Type</span><span class="Delimiter">;</span> +<span id="L129" class="LineNr">129 </span><a href='010vm.cc.html#L125'>type_ordinal</a> <span class="Special">Next_type_ordinal</span> = <span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L130" class="LineNr">130 </span><a href='010vm.cc.html#L125'>type_ordinal</a> <span class="Special">Number_type_ordinal</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L131" class="LineNr">131 </span><a href='010vm.cc.html#L125'>type_ordinal</a> <span class="Special">Boolean_type_ordinal</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L132" class="LineNr">132 </span><a href='010vm.cc.html#L125'>type_ordinal</a> <span class="Special">Character_type_ordinal</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L133" class="LineNr">133 </span><a href='010vm.cc.html#L125'>type_ordinal</a> <span class="Special">Address_type_ordinal</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L134" class="LineNr">134 </span><a href='010vm.cc.html#L125'>type_ordinal</a> <span class="Special">Array_type_ordinal</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L135" class="LineNr">135 </span><span class="Delimiter">:(code)</span> <span id="L136" class="LineNr">136 </span><span class="Normal">void</span> <a href='010vm.cc.html#L136'>setup_types</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L137" class="LineNr">137 </span> Type<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> Type_ordinal<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L138" class="LineNr">138 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"literal"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L139" class="LineNr">139 </span> Next_type_ordinal = <span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L137" class="LineNr">137 </span> <span class="Special">Type</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span class="Special">Type_ordinal</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L138" class="LineNr">138 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"literal"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L139" class="LineNr">139 </span> <span class="Special">Next_type_ordinal</span> = <span class="Constant">1</span><span class="Delimiter">;</span> <span id="L140" class="LineNr">140 </span> <span class="Comment">// Mu Types Initialization</span> -<span id="L141" class="LineNr">141 </span> Number_type_ordinal = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"number"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L142" class="LineNr">142 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> Number_type_ordinal<span class="Delimiter">).</span>name = <span class="Constant">"number"</span><span class="Delimiter">;</span> -<span id="L143" class="LineNr">143 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"location"</span><span class="Delimiter">,</span> Number_type_ordinal<span class="Delimiter">);</span> <span class="Comment">// synonym of number for addresses we'll never look up</span> -<span id="L144" class="LineNr">144 </span> Address_type_ordinal = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"address"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L145" class="LineNr">145 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> Address_type_ordinal<span class="Delimiter">).</span>name = <span class="Constant">"address"</span><span class="Delimiter">;</span> -<span id="L146" class="LineNr">146 </span> Boolean_type_ordinal = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"boolean"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L147" class="LineNr">147 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> Boolean_type_ordinal<span class="Delimiter">).</span>name = <span class="Constant">"boolean"</span><span class="Delimiter">;</span> -<span id="L148" class="LineNr">148 </span> Character_type_ordinal = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"character"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L149" class="LineNr">149 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> Character_type_ordinal<span class="Delimiter">).</span>name = <span class="Constant">"character"</span><span class="Delimiter">;</span> +<span id="L141" class="LineNr">141 </span> <span class="Special">Number_type_ordinal</span> = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"number"</span><span class="Delimiter">,</span> <span class="Special">Next_type_ordinal</span>++<span class="Delimiter">);</span> +<span id="L142" class="LineNr">142 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> <span class="Special">Number_type_ordinal</span><span class="Delimiter">).</span>name = <span class="Constant">"number"</span><span class="Delimiter">;</span> +<span id="L143" class="LineNr">143 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"location"</span><span class="Delimiter">,</span> <span class="Special">Number_type_ordinal</span><span class="Delimiter">);</span> <span class="Comment">// synonym of number for addresses we'll never look up</span> +<span id="L144" class="LineNr">144 </span> <span class="Special">Address_type_ordinal</span> = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"address"</span><span class="Delimiter">,</span> <span class="Special">Next_type_ordinal</span>++<span class="Delimiter">);</span> +<span id="L145" class="LineNr">145 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> <span class="Special">Address_type_ordinal</span><span class="Delimiter">).</span>name = <span class="Constant">"address"</span><span class="Delimiter">;</span> +<span id="L146" class="LineNr">146 </span> <span class="Special">Boolean_type_ordinal</span> = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"boolean"</span><span class="Delimiter">,</span> <span class="Special">Next_type_ordinal</span>++<span class="Delimiter">);</span> +<span id="L147" class="LineNr">147 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> <span class="Special">Boolean_type_ordinal</span><span class="Delimiter">).</span>name = <span class="Constant">"boolean"</span><span class="Delimiter">;</span> +<span id="L148" class="LineNr">148 </span> <span class="Special">Character_type_ordinal</span> = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"character"</span><span class="Delimiter">,</span> <span class="Special">Next_type_ordinal</span>++<span class="Delimiter">);</span> +<span id="L149" class="LineNr">149 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> <span class="Special">Character_type_ordinal</span><span class="Delimiter">).</span>name = <span class="Constant">"character"</span><span class="Delimiter">;</span> <span id="L150" class="LineNr">150 </span> <span class="Comment">// Array types are a special modifier to any other type. For example,</span> <span id="L151" class="LineNr">151 </span> <span class="Comment">// array:number or array:address:boolean.</span> -<span id="L152" class="LineNr">152 </span> Array_type_ordinal = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"array"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L153" class="LineNr">153 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> Array_type_ordinal<span class="Delimiter">).</span>name = <span class="Constant">"array"</span><span class="Delimiter">;</span> +<span id="L152" class="LineNr">152 </span> <span class="Special">Array_type_ordinal</span> = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"array"</span><span class="Delimiter">,</span> <span class="Special">Next_type_ordinal</span>++<span class="Delimiter">);</span> +<span id="L153" class="LineNr">153 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> <span class="Special">Array_type_ordinal</span><span class="Delimiter">).</span>name = <span class="Constant">"array"</span><span class="Delimiter">;</span> <span id="L154" class="LineNr">154 </span> <span class="Comment">// End Mu Types Initialization</span> <span id="L155" class="LineNr">155 </span><span class="Delimiter">}</span> <span id="L156" class="LineNr">156 </span><span class="Normal">void</span> <a href='010vm.cc.html#L156'>teardown_types</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L157" class="LineNr">157 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<type_ordinal<span class="Delimiter">,</span> type_info>::iterator p = Type<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Type<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L157" class="LineNr">157 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<type_ordinal<span class="Delimiter">,</span> type_info>::iterator p = <span class="Special">Type</span><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Type</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L158" class="LineNr">158 </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#L141'>SIZE</a><span class="Delimiter">(</span>p<span class="Delimiter">-></span>second<span class="Delimiter">.</span>elements<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L159" class="LineNr">159 </span> p<span class="Delimiter">-></span>second<span class="Delimiter">.</span>elements<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L160" class="LineNr">160 </span> <span class="Delimiter">}</span> -<span id="L161" class="LineNr">161 </span> Type_ordinal<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L161" class="LineNr">161 </span> <span class="Special">Type_ordinal</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L162" class="LineNr">162 </span><span class="Delimiter">}</span> <span id="L163" class="LineNr">163 </span><span class="Delimiter">:(before "End One-time Setup")</span> <span id="L164" class="LineNr">164 </span><a href='010vm.cc.html#L136'>setup_types</a><span class="Delimiter">();</span> @@ -265,10 +269,10 @@ if ('onhashchange' in window) { <span id="L203" class="LineNr">203 </span><span class="Comment">//: recipes there are only codes, no entries in the book, because Mu just knows</span> <span id="L204" class="LineNr">204 </span><span class="Comment">//: what to do for them.</span> <span id="L205" class="LineNr">205 </span><span class="Normal">void</span> <a href='010vm.cc.html#L205'>setup_recipes</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L206" class="LineNr">206 </span> Recipe<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> Recipe_ordinal<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L207" class="LineNr">207 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"idle"</span><span class="Delimiter">,</span> <a href='010vm.cc.html#L195'>IDLE</a><span class="Delimiter">);</span> +<span id="L206" class="LineNr">206 </span> <span class="Special">Recipe</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span class="Special">Recipe_ordinal</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L207" class="LineNr">207 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"idle"</span><span class="Delimiter">,</span> <a href='010vm.cc.html#L195'>IDLE</a><span class="Delimiter">);</span> <span id="L208" class="LineNr">208 </span> <span class="Comment">// Primitive Recipe Numbers</span> -<span id="L209" class="LineNr">209 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"copy"</span><span class="Delimiter">,</span> <a href='010vm.cc.html#L196'>COPY</a><span class="Delimiter">);</span> +<span id="L209" class="LineNr">209 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"copy"</span><span class="Delimiter">,</span> <a href='010vm.cc.html#L196'>COPY</a><span class="Delimiter">);</span> <span id="L210" class="LineNr">210 </span> <span class="Comment">// End Primitive Recipe Numbers</span> <span id="L211" class="LineNr">211 </span><span class="Delimiter">}</span> <span id="L212" class="LineNr">212 </span><span class="Comment">//: We could just reset the recipe table after every test, but that gets slow</span> @@ -278,23 +282,23 @@ if ('onhashchange' in window) { <span id="L216" class="LineNr">216 </span><span class="Delimiter">:(before "End One-time Setup")</span> <span id="L217" class="LineNr">217 </span><a href='010vm.cc.html#L205'>setup_recipes</a><span class="Delimiter">();</span> <span id="L218" class="LineNr">218 </span>assert<span class="Delimiter">(</span><a href='010vm.cc.html#L198'>MAX_PRIMITIVE_RECIPES</a> < <span class="Constant">200</span><span class="Delimiter">);</span> <span class="Comment">// level 0 is primitives; until 199</span> -<span id="L219" class="LineNr">219 </span>Next_recipe_ordinal = <span class="Constant">200</span><span class="Delimiter">;</span> -<span id="L220" class="LineNr">220 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">,</span> Next_recipe_ordinal++<span class="Delimiter">);</span> +<span id="L219" class="LineNr">219 </span><span class="Special">Next_recipe_ordinal</span> = <span class="Constant">200</span><span class="Delimiter">;</span> +<span id="L220" class="LineNr">220 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">,</span> <span class="Special">Next_recipe_ordinal</span>++<span class="Delimiter">);</span> <span id="L221" class="LineNr">221 </span><span class="Comment">// Load Mu Prelude</span> <span id="L222" class="LineNr">222 </span><span class="Comment">// End Mu Prelude</span> <span id="L223" class="LineNr">223 </span><span class="Delimiter">:(before "End Commandline Parsing")</span> -<span id="L224" class="LineNr">224 </span>assert<span class="Delimiter">(</span>Next_recipe_ordinal < <span class="Constant">1000</span><span class="Delimiter">);</span> <span class="Comment">// recipes being tested didn't overflow into test space</span> +<span id="L224" class="LineNr">224 </span>assert<span class="Delimiter">(</span><span class="Special">Next_recipe_ordinal</span> < <span class="Constant">1000</span><span class="Delimiter">);</span> <span class="Comment">// recipes being tested didn't overflow into test space</span> <span id="L225" class="LineNr">225 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L226" class="LineNr">226 </span>Next_recipe_ordinal = <span class="Constant">1000</span><span class="Delimiter">;</span> <span class="Comment">// consistent new numbers for each test</span> +<span id="L226" class="LineNr">226 </span><span class="Special">Next_recipe_ordinal</span> = <span class="Constant">1000</span><span class="Delimiter">;</span> <span class="Comment">// consistent new numbers for each test</span> <span id="L227" class="LineNr">227 </span> <span id="L228" class="LineNr">228 </span><span class="Comment">//: One final detail: tests can modify our global tables of recipes and types,</span> <span id="L229" class="LineNr">229 </span><span class="Comment">//: so we need some way to clean up after each test is done so it doesn't</span> <span id="L230" class="LineNr">230 </span><span class="Comment">//: influence later ones.</span> <span id="L231" class="LineNr">231 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L232" class="LineNr">232 </span>map<string<span class="Delimiter">,</span> recipe_ordinal> Recipe_ordinal_snapshot<span class="Delimiter">;</span> -<span id="L233" class="LineNr">233 </span>map<recipe_ordinal<span class="Delimiter">,</span> recipe> Recipe_snapshot<span class="Delimiter">;</span> -<span id="L234" class="LineNr">234 </span>map<string<span class="Delimiter">,</span> type_ordinal> Type_ordinal_snapshot<span class="Delimiter">;</span> -<span id="L235" class="LineNr">235 </span>map<type_ordinal<span class="Delimiter">,</span> type_info> Type_snapshot<span class="Delimiter">;</span> +<span id="L232" class="LineNr">232 </span>map<string<span class="Delimiter">,</span> recipe_ordinal> <span class="Special">Recipe_ordinal_snapshot</span><span class="Delimiter">;</span> +<span id="L233" class="LineNr">233 </span>map<recipe_ordinal<span class="Delimiter">,</span> recipe> <span class="Special">Recipe_snapshot</span><span class="Delimiter">;</span> +<span id="L234" class="LineNr">234 </span>map<string<span class="Delimiter">,</span> type_ordinal> <span class="Special">Type_ordinal_snapshot</span><span class="Delimiter">;</span> +<span id="L235" class="LineNr">235 </span>map<type_ordinal<span class="Delimiter">,</span> type_info> <span class="Special">Type_snapshot</span><span class="Delimiter">;</span> <span id="L236" class="LineNr">236 </span><span class="Delimiter">:(before "End One-time Setup")</span> <span id="L237" class="LineNr">237 </span>save_snapshots<span class="Delimiter">();</span> <span id="L238" class="LineNr">238 </span><span class="Delimiter">:(before "End Reset")</span> @@ -302,22 +306,22 @@ if ('onhashchange' in window) { <span id="L240" class="LineNr">240 </span> <span id="L241" class="LineNr">241 </span><span class="Delimiter">:(code)</span> <span id="L242" class="LineNr">242 </span><span class="Normal">void</span> save_snapshots<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L243" class="LineNr">243 </span> Recipe_ordinal_snapshot = Recipe_ordinal<span class="Delimiter">;</span> -<span id="L244" class="LineNr">244 </span> Recipe_snapshot = Recipe<span class="Delimiter">;</span> -<span id="L245" class="LineNr">245 </span> Type_ordinal_snapshot = Type_ordinal<span class="Delimiter">;</span> -<span id="L246" class="LineNr">246 </span> Type_snapshot = Type<span class="Delimiter">;</span> +<span id="L243" class="LineNr">243 </span> <span class="Special">Recipe_ordinal_snapshot</span> = <span class="Special">Recipe_ordinal</span><span class="Delimiter">;</span> +<span id="L244" class="LineNr">244 </span> <span class="Special">Recipe_snapshot</span> = <span class="Special">Recipe</span><span class="Delimiter">;</span> +<span id="L245" class="LineNr">245 </span> <span class="Special">Type_ordinal_snapshot</span> = <span class="Special">Type_ordinal</span><span class="Delimiter">;</span> +<span id="L246" class="LineNr">246 </span> <span class="Special">Type_snapshot</span> = <span class="Special">Type</span><span class="Delimiter">;</span> <span id="L247" class="LineNr">247 </span> <span class="Comment">// End save_snapshots</span> <span id="L248" class="LineNr">248 </span><span class="Delimiter">}</span> <span id="L249" class="LineNr">249 </span> <span id="L250" class="LineNr">250 </span><span class="Normal">void</span> restore_snapshots<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L251" class="LineNr">251 </span> Recipe = Recipe_snapshot<span class="Delimiter">;</span> -<span id="L252" class="LineNr">252 </span> Recipe_ordinal = Recipe_ordinal_snapshot<span class="Delimiter">;</span> +<span id="L251" class="LineNr">251 </span> <span class="Special">Recipe</span> = <span class="Special">Recipe_snapshot</span><span class="Delimiter">;</span> +<span id="L252" class="LineNr">252 </span> <span class="Special">Recipe_ordinal</span> = <span class="Special">Recipe_ordinal_snapshot</span><span class="Delimiter">;</span> <span id="L253" class="LineNr">253 </span> restore_non_recipe_snapshots<span class="Delimiter">();</span> <span id="L254" class="LineNr">254 </span><span class="Delimiter">}</span> <span id="L255" class="LineNr">255 </span><span class="Comment">// when running sandboxes in the edit/ app we'll want to restore everything except recipes defined in the app</span> <span id="L256" class="LineNr">256 </span><span class="Normal">void</span> restore_non_recipe_snapshots<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L257" class="LineNr">257 </span> Type_ordinal = Type_ordinal_snapshot<span class="Delimiter">;</span> -<span id="L258" class="LineNr">258 </span> Type = Type_snapshot<span class="Delimiter">;</span> +<span id="L257" class="LineNr">257 </span> <span class="Special">Type_ordinal</span> = <span class="Special">Type_ordinal_snapshot</span><span class="Delimiter">;</span> +<span id="L258" class="LineNr">258 </span> <span class="Special">Type</span> = <span class="Special">Type_snapshot</span><span class="Delimiter">;</span> <span id="L259" class="LineNr">259 </span> <span class="Comment">// End restore_snapshots</span> <span id="L260" class="LineNr">260 </span><span class="Delimiter">}</span> <span id="L261" class="LineNr">261 </span> @@ -413,8 +417,8 @@ if ('onhashchange' in window) { <span id="L351" class="LineNr">351 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>properties<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L352" class="LineNr">352 </span> <span class="Normal">const</span> string& type_name = properties<span class="Delimiter">-></span>value<span class="Delimiter">;</span> <span id="L353" class="LineNr">353 </span> <span class="Normal">int</span> value = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L354" class="LineNr">354 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> type_name<span class="Delimiter">))</span> -<span id="L355" class="LineNr">355 </span> value = get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> type_name<span class="Delimiter">);</span> +<span id="L354" class="LineNr">354 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> type_name<span class="Delimiter">))</span> +<span id="L355" class="LineNr">355 </span> value = get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> type_name<span class="Delimiter">);</span> <span id="L356" class="LineNr">356 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_integer<span class="Delimiter">(</span>type_name<span class="Delimiter">))</span> <span class="Comment">// sometimes types will contain literal integers, like for the size of an array</span> <span id="L357" class="LineNr">357 </span> value = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L358" class="LineNr">358 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>properties<span class="Delimiter">-></span>value == <span class="Constant">"->"</span><span class="Delimiter">)</span> <span class="Comment">// used in recipe types</span> @@ -641,20 +645,20 @@ if ('onhashchange' in window) { <span id="L579" class="LineNr">579 </span><span class="Delimiter">}</span> <span id="L580" class="LineNr">580 </span> <span id="L581" class="LineNr">581 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L582" class="LineNr">582 </span><span class="Normal">extern</span> <span class="Normal">const</span> string Ignore<span class="Delimiter">(</span><span class="Constant">","</span><span class="Delimiter">);</span> <span class="Comment">// commas are ignored in Mu except within [] strings</span> +<span id="L582" class="LineNr">582 </span><span class="Normal">extern</span> <span class="Normal">const</span> string <span class="Special">Ignore</span><span class="Delimiter">(</span><span class="Constant">","</span><span class="Delimiter">);</span> <span class="Comment">// commas are ignored in Mu except within [] strings</span> <span id="L583" class="LineNr">583 </span><span class="Delimiter">:(code)</span> <span id="L584" class="LineNr">584 </span><span class="Normal">void</span> skip_whitespace_but_not_newline<span class="Delimiter">(</span>istream& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L585" class="LineNr">585 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><span class="Constant">true</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L586" class="LineNr">586 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L587" class="LineNr">587 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> == <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L588" class="LineNr">588 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>isspace<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()))</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> -<span id="L589" class="LineNr">589 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>Ignore<span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> +<span id="L589" class="LineNr">589 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Ignore</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> <span id="L590" class="LineNr">590 </span> <span class="Normal">else</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L591" class="LineNr">591 </span> <span class="Delimiter">}</span> <span id="L592" class="LineNr">592 </span><span class="Delimiter">}</span> <span id="L593" class="LineNr">593 </span> <span id="L594" class="LineNr">594 </span><span class="Normal">void</span> dump_memory<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L595" class="LineNr">595 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<<span class="Normal">int</span><span class="Delimiter">,</span> <span class="Normal">double</span>>::iterator p = Memory<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Memory<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L595" class="LineNr">595 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<<span class="Normal">int</span><span class="Delimiter">,</span> <span class="Normal">double</span>>::iterator p = <span class="Special">Memory</span><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Memory</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L596" class="LineNr">596 </span> cerr << p<span class="Delimiter">-></span>first << <span class="Constant">": "</span> << no_scientific<span class="Delimiter">(</span>p<span class="Delimiter">-></span>second<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L597" class="LineNr">597 </span> <span class="Delimiter">}</span> <span id="L598" class="LineNr">598 </span><span class="Delimiter">}</span> @@ -667,19 +671,19 @@ if ('onhashchange' in window) { <span id="L605" class="LineNr">605 </span> <span id="L606" class="LineNr">606 </span>string <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><span class="Normal">const</span> recipe& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L607" class="LineNr">607 </span> ostringstream out<span class="Delimiter">;</span> -<span id="L608" class="LineNr">608 </span> out << <span class="Constant">"recipe "</span> << r<span class="Delimiter">.</span>name << <span class="Constant">" [</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L608" class="LineNr">608 </span> out << <span class="Constant">"recipe "</span> << r<span class="Delimiter">.</span>name << <span class="Constant">" [\n"</span><span class="Delimiter">;</span> <span id="L609" class="LineNr">609 </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#L141'>SIZE</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L610" class="LineNr">610 </span> out << <span class="Constant">" "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L611" class="LineNr">611 </span> out << <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L611" class="LineNr">611 </span> out << <span class="Constant">"]\n"</span><span class="Delimiter">;</span> <span id="L612" class="LineNr">612 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> <span id="L613" class="LineNr">613 </span><span class="Delimiter">}</span> <span id="L614" class="LineNr">614 </span> <span id="L615" class="LineNr">615 </span>string to_original_string<span class="Delimiter">(</span><span class="Normal">const</span> recipe& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L616" class="LineNr">616 </span> ostringstream out<span class="Delimiter">;</span> -<span id="L617" class="LineNr">617 </span> out << <span class="Constant">"recipe "</span> << r<span class="Delimiter">.</span>name << <span class="Constant">" [</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L617" class="LineNr">617 </span> out << <span class="Constant">"recipe "</span> << r<span class="Delimiter">.</span>name << <span class="Constant">" [\n"</span><span class="Delimiter">;</span> <span id="L618" class="LineNr">618 </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#L141'>SIZE</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L619" class="LineNr">619 </span> out << <span class="Constant">" "</span> << to_original_string<span class="Delimiter">(</span>r<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L620" class="LineNr">620 </span> out << <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L620" class="LineNr">620 </span> out << <span class="Constant">"]\n"</span><span class="Delimiter">;</span> <span id="L621" class="LineNr">621 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> <span id="L622" class="LineNr">622 </span><span class="Delimiter">}</span> <span id="L623" class="LineNr">623 </span> @@ -690,10 +694,10 @@ if ('onhashchange' in window) { <span id="L628" class="LineNr">628 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>x<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L629" class="LineNr">629 </span> <span class="Normal">const</span> instruction& inst = x<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> <span id="L630" class="LineNr">630 </span> out << <span class="Constant">"inst: "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L631" class="LineNr">631 </span> out << <span class="Constant">" ingredients</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L631" class="LineNr">631 </span> out << <span class="Constant">" ingredients\n"</span><span class="Delimiter">;</span> <span id="L632" class="LineNr">632 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L633" class="LineNr">633 </span> out << <span class="Constant">" "</span> << debug_string<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="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L634" class="LineNr">634 </span> out << <span class="Constant">" products</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L634" class="LineNr">634 </span> out << <span class="Constant">" products\n"</span><span class="Delimiter">;</span> <span id="L635" class="LineNr">635 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L636" class="LineNr">636 </span> out << <span class="Constant">" "</span> << debug_string<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="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L637" class="LineNr">637 </span> <span class="Delimiter">}</span> @@ -741,7 +745,7 @@ if ('onhashchange' in window) { <span id="L679" class="LineNr">679 </span> out << r<span class="Delimiter">.</span>name << <span class="Constant">": "</span> << names_to_string<span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">);</span> <span id="L680" class="LineNr">680 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!r<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L681" class="LineNr">681 </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#L141'>SIZE</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>properties<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> -<span id="L682" class="LineNr">682 </span> out << <span class="Constant">", </span><span class="cSpecial">\"</span><span class="Constant">"</span> << r<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>first << <span class="Constant">"</span><span class="cSpecial">\"</span><span class="Constant">: "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>second<span class="Delimiter">);</span> +<span id="L682" class="LineNr">682 </span> out << <span class="Constant">", \"" << r.properties.at(i).first << "</span>\<span class="Constant">": "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>second<span class="Delimiter">);</span> <span id="L683" class="LineNr">683 </span> <span class="Delimiter">}</span> <span id="L684" class="LineNr">684 </span> out << <span class="Constant">"}"</span><span class="Delimiter">;</span> <span id="L685" class="LineNr">685 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> @@ -815,8 +819,8 @@ if ('onhashchange' in window) { <span id="L753" class="LineNr">753 </span><span class="Delimiter">}</span> <span id="L754" class="LineNr">754 </span> <span id="L755" class="LineNr">755 </span><span class="Normal">void</span> dump<span class="Delimiter">(</span><a href='010vm.cc.html#L125'>type_ordinal</a> type<span class="Delimiter">,</span> ostream& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L756" class="LineNr">756 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">))</span> -<span id="L757" class="LineNr">757 </span> out << get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">).</span>name<span class="Delimiter">;</span> +<span id="L756" class="LineNr">756 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">))</span> +<span id="L757" class="LineNr">757 </span> out << get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">).</span>name<span class="Delimiter">;</span> <span id="L758" class="LineNr">758 </span> <span class="Normal">else</span> <span id="L759" class="LineNr">759 </span> out << <span class="Constant">"?"</span> << type<span class="Delimiter">;</span> <span id="L760" class="LineNr">760 </span><span class="Delimiter">}</span> @@ -887,7 +891,7 @@ if ('onhashchange' in window) { <span id="L825" class="LineNr">825 </span> <span class="Normal">char</span>* <a href='003trace.cc.html#L225'>end</a> = <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L826" class="LineNr">826 </span> <span class="Comment">// safe because string.c_str() is guaranteed to be null-terminated</span> <span id="L827" class="LineNr">827 </span> <span class="Normal">int</span> result = strtoll<span class="Delimiter">(</span>n<span class="Delimiter">.</span>c_str<span class="Delimiter">(),</span> &end<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">any base</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L828" class="LineNr">828 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*end != <span class="cSpecial">'\0'</span><span class="Delimiter">)</span> cerr << <span class="Constant">"tried to convert "</span> << n << <span class="Constant">" to number</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L828" class="LineNr">828 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*end != <span class="cSpecial">'\0'</span><span class="Delimiter">)</span> cerr << <span class="Constant">"tried to convert "</span> << n << <span class="Constant">" to number\n"</span><span class="Delimiter">;</span> <span id="L829" class="LineNr">829 </span> assert<span class="Delimiter">(</span>*end == <span class="cSpecial">'\0'</span><span class="Delimiter">);</span> <span id="L830" class="LineNr">830 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L831" class="LineNr">831 </span><span class="Delimiter">}</span> diff --git a/html/011load.cc.html b/html/011load.cc.html index 9319045a..1f42e841 100644 --- a/html/011load.cc.html +++ b/html/011load.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .traceAbsent { color: #c00000; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/011load.cc'>https://github.com/akkartik/mu/blob/master/011load.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Phase 1 of running Mu code: load it from a textual representation.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//:</span> @@ -99,10 +102,10 @@ if ('onhashchange' in window) { <span id="L36" class="LineNr"> 36 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>r > <span class="Constant">0</span><span class="Delimiter">)</span> result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>r<span class="Delimiter">);</span> <span id="L37" class="LineNr"> 37 </span> <span class="Delimiter">}</span> <span id="L38" class="LineNr"> 38 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>command == <span class="Constant">"recipe!"</span> || command == <span class="Constant">"def!"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L39" class="LineNr"> 39 </span> Disable_redefine_checks =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L39" class="LineNr"> 39 </span> <span class="Special">Disable_redefine_checks</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L40" class="LineNr"> 40 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r = <a href='011load.cc.html#L53'>slurp_recipe</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L41" class="LineNr"> 41 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>r > <span class="Constant">0</span><span class="Delimiter">)</span> result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>r<span class="Delimiter">);</span> -<span id="L42" class="LineNr"> 42 </span> Disable_redefine_checks =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L42" class="LineNr"> 42 </span> <span class="Special">Disable_redefine_checks</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L43" class="LineNr"> 43 </span> <span class="Delimiter">}</span> <span id="L44" class="LineNr"> 44 </span> <span class="Comment">// End Command Handlers</span> <span id="L45" class="LineNr"> 45 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> @@ -118,36 +121,36 @@ if ('onhashchange' in window) { <span id="L55" class="LineNr"> 55 </span> result<span class="Delimiter">.</span>name = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L56" class="LineNr"> 56 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L57" class="LineNr"> 57 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L58" class="LineNr"> 58 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"file ended with 'recipe'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L58" class="LineNr"> 58 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"file ended with 'recipe'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L59" class="LineNr"> 59 </span> <span class="Identifier">return</span> -<span class="Constant">1</span><span class="Delimiter">;</span> <span id="L60" class="LineNr"> 60 </span> <span class="Delimiter">}</span> <span id="L61" class="LineNr"> 61 </span> <span class="Comment">// End Load Recipe Name</span> <span id="L62" class="LineNr"> 62 </span> skip_whitespace_but_not_newline<span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L63" class="LineNr"> 63 </span> <span class="Comment">// End Recipe Refinements</span> <span id="L64" class="LineNr"> 64 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> -<span id="L65" class="LineNr"> 65 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"empty result.name</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L65" class="LineNr"> 65 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"empty result.name\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L66" class="LineNr"> 66 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"--- defining "</span> << result<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L67" class="LineNr"> 67 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> -<span id="L68" class="LineNr"> 68 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">,</span> Next_recipe_ordinal<span class="Delimiter">);</span> -<span id="L69" class="LineNr"> 69 </span> result<span class="Delimiter">.</span>ordinal = get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">);</span> -<span id="L70" class="LineNr"> 70 </span> ++Next_recipe_ordinal<span class="Delimiter">;</span> -<span id="L71" class="LineNr"> 71 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Recipe<span class="Delimiter">.</span>find<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> != Recipe<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> +<span id="L67" class="LineNr"> 67 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> +<span id="L68" class="LineNr"> 68 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">,</span> <span class="Special">Next_recipe_ordinal</span><span class="Delimiter">);</span> +<span id="L69" class="LineNr"> 69 </span> result<span class="Delimiter">.</span>ordinal = get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">);</span> +<span id="L70" class="LineNr"> 70 </span> ++<span class="Special">Next_recipe_ordinal</span><span class="Delimiter">;</span> +<span id="L71" class="LineNr"> 71 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> != <span class="Special">Recipe</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L72" class="LineNr"> 72 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"already exists"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L73" class="LineNr"> 73 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='011load.cc.html#L380'>should_check_for_redefine</a><span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> -<span id="L74" class="LineNr"> 74 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"redefining <a href='010vm.cc.html#L19'>recipe</a> "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L75" class="LineNr"> 75 </span> Recipe<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">));</span> +<span id="L74" class="LineNr"> 74 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"redefining <a href='010vm.cc.html#L19'>recipe</a> "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">"\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L75" class="LineNr"> 75 </span> <span class="Special">Recipe</span><span class="Delimiter">.</span>erase<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">));</span> <span id="L76" class="LineNr"> 76 </span> <span class="Delimiter">}</span> <span id="L77" class="LineNr"> 77 </span> <a href='011load.cc.html#L83'>slurp_body</a><span class="Delimiter">(</span>in<span class="Delimiter">,</span> result<span class="Delimiter">);</span> <span id="L78" class="LineNr"> 78 </span> <span class="Comment">// End Recipe Body(result)</span> -<span id="L79" class="LineNr"> 79 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">),</span> result<span class="Delimiter">);</span> -<span id="L80" class="LineNr"> 80 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">);</span> +<span id="L79" class="LineNr"> 79 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">),</span> result<span class="Delimiter">);</span> +<span id="L80" class="LineNr"> 80 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">);</span> <span id="L81" class="LineNr"> 81 </span><span class="Delimiter">}</span> <span id="L82" class="LineNr"> 82 </span> <span id="L83" class="LineNr"> 83 </span><span class="Normal">void</span> <a href='011load.cc.html#L83'>slurp_body</a><span class="Delimiter">(</span>istream& in<span class="Delimiter">,</span> recipe& result<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L84" class="LineNr"> 84 </span> in >> std::noskipws<span class="Delimiter">;</span> <span id="L85" class="LineNr"> 85 </span> skip_whitespace_but_not_newline<span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L86" class="LineNr"> 86 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>get<span class="Delimiter">()</span> != <span class="Constant">'['</span><span class="Delimiter">)</span> -<span id="L87" class="LineNr"> 87 </span> <a href='003trace.cc.html#L196'>raise</a> << result<span class="Delimiter">.</span>name << <span class="Constant">": <a href='010vm.cc.html#L19'>recipe</a> body must begin with '['</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L87" class="LineNr"> 87 </span> <a href='003trace.cc.html#L196'>raise</a> << result<span class="Delimiter">.</span>name << <span class="Constant">": <a href='010vm.cc.html#L19'>recipe</a> body must begin with '['\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L88" class="LineNr"> 88 </span> <a href='011load.cc.html#L211'>skip_whitespace_and_comments</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span class="Comment">// permit trailing comment after '['</span> <span id="L89" class="LineNr"> 89 </span> <a href='010vm.cc.html#L33'>instruction</a> curr<span class="Delimiter">;</span> <span id="L90" class="LineNr"> 90 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='011load.cc.html#L98'>next_instruction</a><span class="Delimiter">(</span>in<span class="Delimiter">,</span> &curr<span class="Delimiter">))</span> <span class="Delimiter">{</span> @@ -162,7 +165,7 @@ if ('onhashchange' in window) { <span id="L99" class="LineNr"> 99 </span> curr<span class="Delimiter">-></span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L100" class="LineNr">100 </span> <a href='011load.cc.html#L211'>skip_whitespace_and_comments</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L101" class="LineNr">101 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L102" class="LineNr">102 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (0)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L102" class="LineNr">102 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (0)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L103" class="LineNr">103 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L104" class="LineNr">104 </span> <span class="Delimiter">}</span> <span id="L105" class="LineNr">105 </span> @@ -170,13 +173,13 @@ if ('onhashchange' in window) { <span id="L107" class="LineNr">107 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L108" class="LineNr">108 </span> skip_whitespace_but_not_newline<span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L109" class="LineNr">109 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L110" class="LineNr">110 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (1)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L110" class="LineNr">110 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (1)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L111" class="LineNr">111 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L112" class="LineNr">112 </span> <span class="Delimiter">}</span> <span id="L113" class="LineNr">113 </span> string word = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L114" class="LineNr">114 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>word<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L115" class="LineNr">115 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L116" class="LineNr">116 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (2)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L116" class="LineNr">116 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (2)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L117" class="LineNr">117 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L118" class="LineNr">118 </span> <span class="Delimiter">}</span> <span id="L119" class="LineNr">119 </span> words<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>word<span class="Delimiter">);</span> @@ -191,7 +194,7 @@ if ('onhashchange' in window) { <span id="L128" class="LineNr">128 </span> curr<span class="Delimiter">-></span>label = words<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L129" class="LineNr">129 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"label: "</span> << curr<span class="Delimiter">-></span>label << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L130" class="LineNr">130 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L131" class="LineNr">131 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (3)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L131" class="LineNr">131 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> at <a href='003trace.cc.html#L225'>end</a> of file (3)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L132" class="LineNr">132 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L133" class="LineNr">133 </span> <span class="Delimiter">}</span> <span id="L134" class="LineNr">134 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> @@ -205,7 +208,7 @@ if ('onhashchange' in window) { <span id="L142" class="LineNr">142 </span> <span class="Delimiter">}</span> <span id="L143" class="LineNr">143 </span> <span id="L144" class="LineNr">144 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>p == words<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L145" class="LineNr">145 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"instruction prematurely ended with '<-'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L145" class="LineNr">145 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"instruction prematurely ended with '<-'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L146" class="LineNr">146 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L147" class="LineNr">147 </span> <span class="Delimiter">}</span> <span id="L148" class="LineNr">148 </span> curr<span class="Delimiter">-></span>name = *p<span class="Delimiter">;</span> ++p<span class="Delimiter">;</span> @@ -221,7 +224,7 @@ if ('onhashchange' in window) { <span id="L158" class="LineNr">158 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<reagent>::iterator p = curr<span class="Delimiter">-></span>products<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != curr<span class="Delimiter">-></span>products<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span id="L159" class="LineNr">159 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">" product: "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>*p<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L160" class="LineNr">160 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L161" class="LineNr">161 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"9: unbalanced '[' for <a href='010vm.cc.html#L19'>recipe</a></span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L161" class="LineNr">161 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"9: unbalanced '[' for recipe\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L162" class="LineNr">162 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L163" class="LineNr">163 </span> <span class="Delimiter">}</span> <span id="L164" class="LineNr">164 </span> <span class="Comment">// End next_instruction(curr)</span> @@ -237,7 +240,7 @@ if ('onhashchange' in window) { <span id="L174" class="LineNr">174 </span> <a href='011load.cc.html#L222'>skip_whitespace_and_comments_but_not_newline</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L175" class="LineNr">175 </span> string result = out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> <span id="L176" class="LineNr">176 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>result != <span class="Constant">"["</span> && <a href='011load.cc.html#L186'>ends_with</a><span class="Delimiter">(</span>result<span class="Delimiter">,</span> <span class="Constant">'['</span><span class="Delimiter">))</span> -<span id="L177" class="LineNr">177 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"insert a space before '[' in '"</span> << result << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L177" class="LineNr">177 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"insert a space before '[' in '"</span> << result << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L178" class="LineNr">178 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L179" class="LineNr">179 </span><span class="Delimiter">}</span> <span id="L180" class="LineNr">180 </span> @@ -253,17 +256,17 @@ if ('onhashchange' in window) { <span id="L190" class="LineNr">190 </span> <span id="L191" class="LineNr">191 </span><span class="Delimiter">:(before "End Globals")</span> <span id="L192" class="LineNr">192 </span><span class="Comment">// word boundaries</span> -<span id="L193" class="LineNr">193 </span><span class="Normal">extern</span> <span class="Normal">const</span> string Terminators<span class="Delimiter">(</span><span class="Constant">"(){}"</span><span class="Delimiter">);</span> +<span id="L193" class="LineNr">193 </span><span class="Normal">extern</span> <span class="Normal">const</span> string <span class="Special">Terminators</span><span class="Delimiter">(</span><span class="Constant">"(){}"</span><span class="Delimiter">);</span> <span id="L194" class="LineNr">194 </span><span class="Delimiter">:(code)</span> <span id="L195" class="LineNr">195 </span><span class="Normal">void</span> <a href='011load.cc.html#L195'>slurp_word</a><span class="Delimiter">(</span>istream& in<span class="Delimiter">,</span> ostream& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L196" class="LineNr">196 </span> <span class="Normal">char</span> c<span class="Delimiter">;</span> -<span id="L197" class="LineNr">197 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && Terminators<span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L197" class="LineNr">197 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> && <span class="Special">Terminators</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L198" class="LineNr">198 </span> in >> c<span class="Delimiter">;</span> <span id="L199" class="LineNr">199 </span> out << c<span class="Delimiter">;</span> <span id="L200" class="LineNr">200 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L201" class="LineNr">201 </span> <span class="Delimiter">}</span> <span id="L202" class="LineNr">202 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>in >> c<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L203" class="LineNr">203 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>isspace<span class="Delimiter">(</span>c<span class="Delimiter">)</span> || Terminators<span class="Delimiter">.</span>find<span class="Delimiter">(</span>c<span class="Delimiter">)</span> != string::npos || Ignore<span class="Delimiter">.</span>find<span class="Delimiter">(</span>c<span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L203" class="LineNr">203 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>isspace<span class="Delimiter">(</span>c<span class="Delimiter">)</span> || <span class="Special">Terminators</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>c<span class="Delimiter">)</span> != string::npos || <span class="Special">Ignore</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>c<span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L204" class="LineNr">204 </span> in<span class="Delimiter">.</span>putback<span class="Delimiter">(</span>c<span class="Delimiter">);</span> <span id="L205" class="LineNr">205 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L206" class="LineNr">206 </span> <span class="Delimiter">}</span> @@ -275,7 +278,7 @@ if ('onhashchange' in window) { <span id="L212" class="LineNr">212 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><span class="Constant">true</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L213" class="LineNr">213 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L214" class="LineNr">214 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>isspace<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()))</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> -<span id="L215" class="LineNr">215 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>Ignore<span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> +<span id="L215" class="LineNr">215 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Ignore</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> <span id="L216" class="LineNr">216 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> == <span class="Constant">'#'</span><span class="Delimiter">)</span> <a href='011load.cc.html#L233'>skip_comment</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L217" class="LineNr">217 </span> <span class="Normal">else</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L218" class="LineNr">218 </span> <span class="Delimiter">}</span> @@ -287,7 +290,7 @@ if ('onhashchange' in window) { <span id="L224" class="LineNr">224 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L225" class="LineNr">225 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> == <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L226" class="LineNr">226 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>isspace<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()))</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> -<span id="L227" class="LineNr">227 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>Ignore<span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> +<span id="L227" class="LineNr">227 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Ignore</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">())</span> != string::npos<span class="Delimiter">)</span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> <span id="L228" class="LineNr">228 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> == <span class="Constant">'#'</span><span class="Delimiter">)</span> <a href='011load.cc.html#L233'>skip_comment</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L229" class="LineNr">229 </span> <span class="Normal">else</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L230" class="LineNr">230 </span> <span class="Delimiter">}</span> @@ -418,9 +421,9 @@ if ('onhashchange' in window) { <span id="L355" class="LineNr">355 </span><span class="Comment">//: this test we can't represent with a scenario</span> <span id="L356" class="LineNr">356 </span><span class="Delimiter">:(code)</span> <span id="L357" class="LineNr">357 </span><span class="Normal">void</span> <a href='011load.cc.html#L357'>test_parse_comment_terminated_by_eof</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L358" class="LineNr">358 </span> load<span class="Delimiter">(</span><span class="Constant">"recipe <a href='000organization.cc.html#L113'>main</a> [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L359" class="LineNr">359 </span> <span class="Constant">" a:number <- copy 34</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L360" class="LineNr">360 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span> +<span id="L358" class="LineNr">358 </span> load<span class="Delimiter">(</span><span class="Constant">"recipe <a href='000organization.cc.html#L113'>main</a> [\n"</span> +<span id="L359" class="LineNr">359 </span> <span class="Constant">" a:number <- copy 34\n"</span> +<span id="L360" class="LineNr">360 </span> <span class="Constant">"]\n"</span> <span id="L361" class="LineNr">361 </span> <span class="Constant">"# abc"</span><span class="Delimiter">);</span> <span class="Comment">// no newline after comment</span> <span id="L362" class="LineNr">362 </span> cerr << <span class="Constant">"."</span><span class="Delimiter">;</span> <span class="Comment">// termination = success</span> <span id="L363" class="LineNr">363 </span><span class="Delimiter">}</span> @@ -436,12 +439,12 @@ if ('onhashchange' in window) { <span id="L373" class="LineNr">373 </span><span class="Comment">//: step on their own toes. But there'll be many occasions later where</span> <span id="L374" class="LineNr">374 </span><span class="Comment">//: we'll want to disable the errors.</span> <span id="L375" class="LineNr">375 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L376" class="LineNr">376 </span><span class="Normal">bool</span> Disable_redefine_checks =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L376" class="LineNr">376 </span><span class="Normal">bool</span> <span class="Special">Disable_redefine_checks</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L377" class="LineNr">377 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L378" class="LineNr">378 </span>Disable_redefine_checks =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L378" class="LineNr">378 </span><span class="Special">Disable_redefine_checks</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L379" class="LineNr">379 </span><span class="Delimiter">:(code)</span> <span id="L380" class="LineNr">380 </span><span class="Normal">bool</span> <a href='011load.cc.html#L380'>should_check_for_redefine</a><span class="Delimiter">(</span><span class="Normal">const</span> string& recipe_name<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L381" class="LineNr">381 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Disable_redefine_checks<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L381" class="LineNr">381 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Disable_redefine_checks</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L382" class="LineNr">382 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L383" class="LineNr">383 </span><span class="Delimiter">}</span> <span id="L384" class="LineNr">384 </span> @@ -472,7 +475,7 @@ if ('onhashchange' in window) { <span id="L409" class="LineNr">409 </span> <span class="Normal">char</span> c<span class="Delimiter">;</span> <span id="L410" class="LineNr">410 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>in >> c<span class="Delimiter">)</span> <span id="L411" class="LineNr">411 </span> cerr << c<span class="Delimiter">;</span> -<span id="L412" class="LineNr">412 </span> cerr << <span class="Constant">"$</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L412" class="LineNr">412 </span> cerr << <span class="Constant">"$\n"</span><span class="Delimiter">;</span> <span id="L413" class="LineNr">413 </span> exit<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L414" class="LineNr">414 </span><span class="Delimiter">}</span> </pre> diff --git a/html/012transform.cc.html b/html/012transform.cc.html index f6471294..bd67993f 100644 --- a/html/012transform.cc.html +++ b/html/012transform.cc.html @@ -11,17 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Identifier { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } --> </style> @@ -55,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/012transform.cc'>https://github.com/akkartik/mu/blob/master/012transform.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Phase 2: Filter loaded recipes through an extensible list of 'transforms'.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//:</span> @@ -83,7 +87,7 @@ if ('onhashchange' in window) { <span id="L25" class="LineNr"> 25 </span><span class="Normal">typedef</span> <span class="Normal">void</span> <span class="Delimiter">(</span>*transform_fn<span class="Delimiter">)(</span><span class="Normal">const</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a><span class="Delimiter">);</span> <span id="L26" class="LineNr"> 26 </span> <span id="L27" class="LineNr"> 27 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L28" class="LineNr"> 28 </span>vector<transform_fn> Transform<span class="Delimiter">;</span> +<span id="L28" class="LineNr"> 28 </span>vector<transform_fn> <span class="Special">Transform</span><span class="Delimiter">;</span> <span id="L29" class="LineNr"> 29 </span> <span id="L30" class="LineNr"> 30 </span><span class="Delimiter">:(before "End One-time Setup")</span> <span id="L31" class="LineNr"> 31 </span><a href='012transform.cc.html#L33'>initialize_transforms</a><span class="Delimiter">();</span> @@ -104,12 +108,12 @@ if ('onhashchange' in window) { <span id="L46" class="LineNr"> 46 </span><span class="Normal">void</span> <a href='012transform.cc.html#L46'>transform_all</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> <span id="L47" class="LineNr"> 47 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9990</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"=== transform_all()"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L48" class="LineNr"> 48 </span> <span class="Comment">// Begin transform_all</span> -<span id="L49" class="LineNr"> 49 </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#L141'>SIZE</a><span class="Delimiter">(</span>Transform<span class="Delimiter">);</span> ++t<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L50" class="LineNr"> 50 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<recipe_ordinal<span class="Delimiter">,</span> recipe>::iterator p = Recipe<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Recipe<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L49" class="LineNr"> 49 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Transform</span><span class="Delimiter">);</span> ++t<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L50" class="LineNr"> 50 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<recipe_ordinal<span class="Delimiter">,</span> recipe>::iterator p = <span class="Special">Recipe</span><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Recipe</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L51" class="LineNr"> 51 </span> recipe& r = p<span class="Delimiter">-></span>second<span class="Delimiter">;</span> <span id="L52" class="LineNr"> 52 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>r<span class="Delimiter">.</span>transformed_until != t-<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L53" class="LineNr"> 53 </span> <span class="Comment">// End Transform Checks</span> -<span id="L54" class="LineNr"> 54 </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"><a href='010vm.cc.html#L14'>recipe_ordinal</a></span><span class="Comment">*/</span>p<span class="Delimiter">-></span>first<span class="Delimiter">);</span> +<span id="L54" class="LineNr"> 54 </span> <span class="Delimiter">(</span>*<span class="Special">Transform</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>t<span class="Delimiter">))(</span><span class="Comment">/*</span><span class="Comment"><a href='010vm.cc.html#L14'>recipe_ordinal</a></span><span class="Comment">*/</span>p<span class="Delimiter">-></span>first<span class="Delimiter">);</span> <span id="L55" class="LineNr"> 55 </span> r<span class="Delimiter">.</span>transformed_until = t<span class="Delimiter">;</span> <span id="L56" class="LineNr"> 56 </span> <span class="Delimiter">}</span> <span id="L57" class="LineNr"> 57 </span> <span class="Delimiter">}</span> @@ -124,14 +128,14 @@ if ('onhashchange' in window) { <span id="L66" class="LineNr"> 66 </span><span class="Comment">//: helpful errors we track a count of the number of calls made to</span> <span id="L67" class="LineNr"> 67 </span><span class="Comment">//: transform_all().</span> <span id="L68" class="LineNr"> 68 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L69" class="LineNr"> 69 </span><span class="Normal">int</span> Num_calls_to_transform_all = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L69" class="LineNr"> 69 </span><span class="Normal">int</span> <span class="Special">Num_calls_to_transform_all</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L70" class="LineNr"> 70 </span><span class="Delimiter">:(after "void transform_all()")</span> -<span id="L71" class="LineNr"> 71 </span> ++Num_calls_to_transform_all<span class="Delimiter">;</span> +<span id="L71" class="LineNr"> 71 </span> ++<span class="Special">Num_calls_to_transform_all</span><span class="Delimiter">;</span> <span id="L72" class="LineNr"> 72 </span> <span id="L73" class="LineNr"> 73 </span><span class="Delimiter">:(code)</span> <span id="L74" class="LineNr"> 74 </span><span class="Normal">void</span> <a href='012transform.cc.html#L74'>parse_int_reagents</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> <span id="L75" class="LineNr"> 75 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- parsing any uninitialized reagents as integers"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L76" class="LineNr"> 76 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<recipe_ordinal<span class="Delimiter">,</span> recipe>::iterator p = Recipe<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Recipe<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L76" class="LineNr"> 76 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<recipe_ordinal<span class="Delimiter">,</span> recipe>::iterator p = <span class="Special">Recipe</span><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Recipe</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L77" class="LineNr"> 77 </span> recipe& r = p<span class="Delimiter">-></span>second<span class="Delimiter">;</span> <span id="L78" class="LineNr"> 78 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>r<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L79" class="LineNr"> 79 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> diff --git a/html/013update_operation.cc.html b/html/013update_operation.cc.html index a9c93f53..4358e5f6 100644 --- a/html/013update_operation.cc.html +++ b/html/013update_operation.cc.html @@ -11,22 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } -.traceContains { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.cSpecial { color: #008000; } +.Comment { color: #8080ff; } +.traceContains { color: #008000; } --> </style> @@ -60,26 +61,27 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/013update_operation.cc'>https://github.com/akkartik/mu/blob/master/013update_operation.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Once all code is loaded, save operation ids of instructions and check that</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: nothing's undefined.</span> <span id="L3" class="LineNr"> 3 </span> <span id="L4" class="LineNr"> 4 </span><span class="Delimiter">:(before "End Instruction Modifying Transforms")</span> -<span id="L5" class="LineNr"> 5 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='013update_operation.cc.html#L8'>update_instruction_operations</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L5" class="LineNr"> 5 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='013update_operation.cc.html#L8'>update_instruction_operations</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L6" class="LineNr"> 6 </span> <span id="L7" class="LineNr"> 7 </span><span class="Delimiter">:(code)</span> <span id="L8" class="LineNr"> 8 </span><span class="Normal">void</span> <a href='013update_operation.cc.html#L8'>update_instruction_operations</a><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="L9" class="LineNr"> 9 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- compute <a href='010vm.cc.html#L33'>instruction</a> operations for <a href='010vm.cc.html#L19'>recipe</a> "</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L10" class="LineNr">10 </span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L9" class="LineNr"> 9 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- compute <a href='010vm.cc.html#L33'>instruction</a> operations for <a href='010vm.cc.html#L19'>recipe</a> "</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L10" class="LineNr">10 </span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L11" class="LineNr">11 </span><span class="CommentedCode">//? cerr << "--- compute instruction operations for recipe " << caller.name << '\n';</span> <span id="L12" class="LineNr">12 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L13" class="LineNr">13 </span> instruction& inst = caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> <span id="L14" class="LineNr">14 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>is_label<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L15" class="LineNr">15 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L16" class="LineNr">16 </span> <a href='003trace.cc.html#L196'>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 <a href='010vm.cc.html#L19'>recipe</a> in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L15" class="LineNr">15 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L16" class="LineNr">16 </span> <a href='003trace.cc.html#L196'>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 <a href='010vm.cc.html#L19'>recipe</a> in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L17" class="LineNr">17 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L18" class="LineNr">18 </span> <span class="Delimiter">}</span> -<span id="L19" class="LineNr">19 </span> inst<span class="Delimiter">.</span>operation = get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">);</span> +<span id="L19" class="LineNr">19 </span> inst<span class="Delimiter">.</span>operation = get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">);</span> <span id="L20" class="LineNr">20 </span> <span class="Comment">// End Instruction Operation Checks</span> <span id="L21" class="LineNr">21 </span> <span class="Delimiter">}</span> <span id="L22" class="LineNr">22 </span><span class="Delimiter">}</span> diff --git a/html/014literal_string.cc.html b/html/014literal_string.cc.html index 394d0437..b28b9049 100644 --- a/html/014literal_string.cc.html +++ b/html/014literal_string.cc.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -59,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/014literal_string.cc'>https://github.com/akkartik/mu/blob/master/014literal_string.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: For convenience, some instructions will take literal arrays of characters</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: (text or strings).</span> @@ -82,7 +85,7 @@ if ('onhashchange' in window) { <span id="L20" class="LineNr"> 20 </span><span class="traceContains">+parse: ingredient: {"abc:def/ghi": "literal-string"}</span> <span id="L21" class="LineNr"> 21 </span> <span id="L22" class="LineNr"> 22 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> -<span id="L23" class="LineNr"> 23 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"literal-string"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L23" class="LineNr"> 23 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"literal-string"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L24" class="LineNr"> 24 </span> <span id="L25" class="LineNr"> 25 </span><span class="Delimiter">:(before "End <a href='011load.cc.html#L169'>next_word</a> Special-cases")</span> <span id="L26" class="LineNr"> 26 </span><span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> == <span class="Constant">'['</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -135,7 +138,7 @@ if ('onhashchange' in window) { <span id="L73" class="LineNr"> 73 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>brace_depth == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L74" class="LineNr"> 74 </span> <span class="Delimiter">}</span> <span id="L75" class="LineNr"> 75 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">)</span> && brace_depth > <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L76" class="LineNr"> 76 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"unbalanced '['</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L76" class="LineNr"> 76 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"unbalanced '['\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L77" class="LineNr"> 77 </span> out<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L78" class="LineNr"> 78 </span> <span class="Delimiter">}</span> <span id="L79" class="LineNr"> 79 </span><span class="Delimiter">}</span> @@ -162,7 +165,7 @@ if ('onhashchange' in window) { <span id="L100" class="LineNr">100 </span> out << c<span class="Delimiter">;</span> <span id="L101" class="LineNr">101 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="Constant">']'</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L102" class="LineNr">102 </span> <span class="Delimiter">}</span> -<span id="L103" class="LineNr">103 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"unbalanced '['</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L103" class="LineNr">103 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"unbalanced '['\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L104" class="LineNr">104 </span> out<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L105" class="LineNr">105 </span><span class="Delimiter">}</span> <span id="L106" class="LineNr">106 </span> @@ -192,8 +195,8 @@ if ('onhashchange' in window) { <span id="L130" class="LineNr">130 </span>string <a href='014literal_string.cc.html#L130'>emit_literal_string</a><span class="Delimiter">(</span>string name<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L131" class="LineNr">131 </span> <span class="Normal">size_t</span> pos = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L132" class="LineNr">132 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>pos != string::npos<span class="Delimiter">)</span> -<span id="L133" class="LineNr">133 </span> pos = <a href='014literal_string.cc.html#L137'>replace</a><span class="Delimiter">(</span>name<span class="Delimiter">,</span> <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">,</span> <span class="Constant">"</span><span class="cSpecial">\\</span><span class="Constant">n"</span><span class="Delimiter">,</span> pos<span class="Delimiter">);</span> -<span id="L134" class="LineNr">134 </span> <span class="Identifier">return</span> <span class="Constant">"{</span><span class="cSpecial">\"</span><span class="Constant">"</span>+name+<span class="Constant">"</span><span class="cSpecial">\"</span><span class="Constant">: </span><span class="cSpecial">\"</span><span class="Constant">literal-string</span><span class="cSpecial">\"</span><span class="Constant">}"</span><span class="Delimiter">;</span> +<span id="L133" class="LineNr">133 </span> pos = <a href='014literal_string.cc.html#L137'>replace</a><span class="Delimiter">(</span>name<span class="Delimiter">,</span> <span class="Constant">"\n"</span><span class="Delimiter">,</span> <span class="Constant">"\\n"</span><span class="Delimiter">,</span> pos<span class="Delimiter">);</span> +<span id="L134" class="LineNr">134 </span> <span class="Identifier">return</span> <span class="Constant">"{\""+name+"</span>\<span class="Constant">": \"</span>literal-string\<span class="Constant">"}"</span><span class="Delimiter">;</span> <span id="L135" class="LineNr">135 </span><span class="Delimiter">}</span> <span id="L136" class="LineNr">136 </span> <span id="L137" class="LineNr">137 </span><span class="Normal">size_t</span> <a href='014literal_string.cc.html#L137'>replace</a><span class="Delimiter">(</span>string& str<span class="Delimiter">,</span> <span class="Normal">const</span> string& from<span class="Delimiter">,</span> <span class="Normal">const</span> string& to<span class="Delimiter">,</span> <span class="Normal">size_t</span> n<span class="Delimiter">)</span> <span class="Delimiter">{</span> diff --git a/html/015literal_noninteger.cc.html b/html/015literal_noninteger.cc.html index 3ce63b55..c99848b5 100644 --- a/html/015literal_noninteger.cc.html +++ b/html/015literal_noninteger.cc.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -59,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/015literal_noninteger.cc'>https://github.com/akkartik/mu/blob/master/015literal_noninteger.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Support literal non-integers.</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/016dilated_reagent.cc.html b/html/016dilated_reagent.cc.html index a8ae9068..ff49e974 100644 --- a/html/016dilated_reagent.cc.html +++ b/html/016dilated_reagent.cc.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .Error { color: #ffffff; background-color: #ff6060; padding-bottom: 1px; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } .traceContains { color: #008000; } --> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/016dilated_reagent.cc'>https://github.com/akkartik/mu/blob/master/016dilated_reagent.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: An alternative syntax for reagents that permits whitespace in properties,</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: grouped by brackets. We'll use this ability in the next layer, when we</span> @@ -125,7 +128,7 @@ if ('onhashchange' in window) { <span id="L62" class="LineNr"> 62 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="Constant">'('</span><span class="Delimiter">)</span> open_brackets<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>c<span class="Delimiter">);</span> <span id="L63" class="LineNr"> 63 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="Constant">')'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L64" class="LineNr"> 64 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>open_brackets<span class="Delimiter">.</span>empty<span class="Delimiter">()</span> || open_brackets<span class="Delimiter">.</span>back<span class="Delimiter">()</span> != <span class="Constant">'('</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L65" class="LineNr"> 65 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"unbalanced ')'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L65" class="LineNr"> 65 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"unbalanced ')'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L66" class="LineNr"> 66 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L67" class="LineNr"> 67 </span> <span class="Delimiter">}</span> <span id="L68" class="LineNr"> 68 </span> assert<span class="Delimiter">(</span>open_brackets<span class="Delimiter">.</span>back<span class="Delimiter">()</span> == <span class="Constant">'('</span><span class="Delimiter">);</span> @@ -134,7 +137,7 @@ if ('onhashchange' in window) { <span id="L71" class="LineNr"> 71 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="Constant">'['</span><span class="Delimiter">)</span> open_brackets<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>c<span class="Delimiter">);</span> <span id="L72" class="LineNr"> 72 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="Constant">']'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L73" class="LineNr"> 73 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>open_brackets<span class="Delimiter">.</span>empty<span class="Delimiter">()</span> || open_brackets<span class="Delimiter">.</span>back<span class="Delimiter">()</span> != <span class="Constant">'['</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L74" class="LineNr"> 74 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"unbalanced ']'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L74" class="LineNr"> 74 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"unbalanced ']'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L75" class="LineNr"> 75 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L76" class="LineNr"> 76 </span> <span class="Delimiter">}</span> <span id="L77" class="LineNr"> 77 </span> open_brackets<span class="Delimiter">.</span>pop_back<span class="Delimiter">();</span> @@ -142,7 +145,7 @@ if ('onhashchange' in window) { <span id="L79" class="LineNr"> 79 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="Constant">'{'</span><span class="Delimiter">)</span> open_brackets<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>c<span class="Delimiter">);</span> <span id="L80" class="LineNr"> 80 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="Constant">'}'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L81" class="LineNr"> 81 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>open_brackets<span class="Delimiter">.</span>empty<span class="Delimiter">()</span> || open_brackets<span class="Delimiter">.</span>back<span class="Delimiter">()</span> != <span class="Constant">'{'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L82" class="LineNr"> 82 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"unbalanced '}'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L82" class="LineNr"> 82 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"unbalanced '}'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L83" class="LineNr"> 83 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L84" class="LineNr"> 84 </span> <span class="Delimiter">}</span> <span id="L85" class="LineNr"> 85 </span> open_brackets<span class="Delimiter">.</span>pop_back<span class="Delimiter">();</span> @@ -162,18 +165,18 @@ if ('onhashchange' in window) { <span id="L99" class="LineNr"> 99 </span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> <span class="Comment">// skip '{'</span> <span id="L100" class="LineNr">100 </span> name = <a href='016dilated_reagent.cc.html#L139'>slurp_key</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L101" class="LineNr">101 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L102" class="LineNr">102 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"invalid reagent '"</span> << s << <span class="Constant">"' without a name</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L102" class="LineNr">102 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"invalid reagent '"</span> << s << <span class="Constant">"' without a name\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L103" class="LineNr">103 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L104" class="LineNr">104 </span> <span class="Delimiter">}</span> <span id="L105" class="LineNr">105 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>name == <span class="Constant">"}"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L106" class="LineNr">106 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"invalid empty reagent '"</span> << s << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L106" class="LineNr">106 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"invalid empty reagent '"</span> << s << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L107" class="LineNr">107 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L108" class="LineNr">108 </span> <span class="Delimiter">}</span> <span id="L109" class="LineNr">109 </span> <span class="Delimiter">{</span> <span id="L110" class="LineNr">110 </span> string s = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L111" class="LineNr">111 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>s<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L112" class="LineNr">112 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L113" class="LineNr">113 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete dilated reagent at <a href='003trace.cc.html#L225'>end</a> of file (0)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L113" class="LineNr">113 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete dilated reagent at <a href='003trace.cc.html#L225'>end</a> of file (0)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L114" class="LineNr">114 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L115" class="LineNr">115 </span> <span class="Delimiter">}</span> <span id="L116" class="LineNr">116 </span> string_tree* type_names = <span class="Normal">new</span> string_tree<span class="Delimiter">(</span>s<span class="Delimiter">);</span> @@ -188,7 +191,7 @@ if ('onhashchange' in window) { <span id="L125" class="LineNr">125 </span> string s = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L126" class="LineNr">126 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>s<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L127" class="LineNr">127 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L128" class="LineNr">128 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete dilated reagent at <a href='003trace.cc.html#L225'>end</a> of file (1)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L128" class="LineNr">128 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete dilated reagent at <a href='003trace.cc.html#L225'>end</a> of file (1)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L129" class="LineNr">129 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L130" class="LineNr">130 </span> <span class="Delimiter">}</span> <span id="L131" class="LineNr">131 </span> string_tree* value = <span class="Normal">new</span> string_tree<span class="Delimiter">(</span>s<span class="Delimiter">);</span> @@ -203,7 +206,7 @@ if ('onhashchange' in window) { <span id="L140" class="LineNr">140 </span> string result = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L141" class="LineNr">141 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>result<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L142" class="LineNr">142 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L143" class="LineNr">143 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete dilated reagent at <a href='003trace.cc.html#L225'>end</a> of file (2)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L143" class="LineNr">143 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete dilated reagent at <a href='003trace.cc.html#L225'>end</a> of file (2)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L144" class="LineNr">144 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L145" class="LineNr">145 </span> <span class="Delimiter">}</span> <span id="L146" class="LineNr">146 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>!result<span class="Delimiter">.</span>empty<span class="Delimiter">()</span> && *result<span class="Delimiter">.</span>rbegin<span class="Delimiter">()</span> == <span class="Constant">':'</span><span class="Delimiter">)</span> diff --git a/html/017parse_tree.cc.html b/html/017parse_tree.cc.html index 911ed305..eb683b99 100644 --- a/html/017parse_tree.cc.html +++ b/html/017parse_tree.cc.html @@ -11,21 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.cSpecial { color: #008000; } -.LineNr { color: #444444; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -60,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/017parse_tree.cc'>https://github.com/akkartik/mu/blob/master/017parse_tree.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">// So far instructions can only contain linear lists of properties. Now we add</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">// support for more complex trees of properties in dilated reagents. This will</span> @@ -111,7 +113,7 @@ if ('onhashchange' in window) { <span id="L48" class="LineNr"> 48 </span> string s = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L49" class="LineNr"> 49 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>s<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L50" class="LineNr"> 50 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L51" class="LineNr"> 51 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete string tree at <a href='003trace.cc.html#L225'>end</a> of file (0)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L51" class="LineNr"> 51 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete string tree at <a href='003trace.cc.html#L225'>end</a> of file (0)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L52" class="LineNr"> 52 </span> <span class="Identifier">return</span> <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L53" class="LineNr"> 53 </span> <span class="Delimiter">}</span> <span id="L54" class="LineNr"> 54 </span> string_tree* result = <span class="Normal">new</span> string_tree<span class="Delimiter">(</span>s<span class="Delimiter">);</span> @@ -132,7 +134,7 @@ if ('onhashchange' in window) { <span id="L69" class="LineNr"> 69 </span> string s = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L70" class="LineNr"> 70 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>s<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L71" class="LineNr"> 71 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L72" class="LineNr"> 72 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete string tree at <a href='003trace.cc.html#L225'>end</a> of file (1)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L72" class="LineNr"> 72 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete string tree at <a href='003trace.cc.html#L225'>end</a> of file (1)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L73" class="LineNr"> 73 </span> <span class="Identifier">return</span> <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L74" class="LineNr"> 74 </span> <span class="Delimiter">}</span> <span id="L75" class="LineNr"> 75 </span> <span class="Delimiter">(</span>*curr<span class="Delimiter">)-></span>left = <span class="Normal">new</span> string_tree<span class="Delimiter">(</span>s<span class="Delimiter">);</span> diff --git a/html/018constant.cc.html b/html/018constant.cc.html index 2e5661d3..3b91c860 100644 --- a/html/018constant.cc.html +++ b/html/018constant.cc.html @@ -11,20 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.cSpecial { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -59,13 +60,14 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/018constant.cc'>https://github.com/akkartik/mu/blob/master/018constant.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: A few literal constants.</span> <span id="L2" class="LineNr"> 2 </span> <span id="L3" class="LineNr"> 3 </span><span class="Delimiter">:(scenarios load)</span> <span class="Comment">// use 'load' instead of 'run' in all scenarios in this layer</span> <span id="L4" class="LineNr"> 4 </span> <span id="L5" class="LineNr"> 5 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> -<span id="L6" class="LineNr"> 6 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"literal-boolean"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L6" class="LineNr"> 6 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"literal-boolean"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L7" class="LineNr"> 7 </span> <span id="L8" class="LineNr"> 8 </span><span class="Comment">//: 'true'</span> <span id="L9" class="LineNr"> 9 </span> @@ -78,7 +80,7 @@ if ('onhashchange' in window) { <span id="L16" class="LineNr">16 </span><span class="Delimiter">:(before "End Parsing reagent")</span> <span id="L17" class="LineNr">17 </span><span class="Normal">if</span> <span class="Delimiter">(</span>name == <span class="Constant">"true"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L18" class="LineNr">18 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type != <span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L19" class="LineNr">19 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'true' is a literal and can't take a type</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L19" class="LineNr">19 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'true' is a literal and can't take a type\n"</span> << end<span class="Delimiter">();</span> <span id="L20" class="LineNr">20 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L21" class="LineNr">21 </span> <span class="Delimiter">}</span> <span id="L22" class="LineNr">22 </span> type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span><span class="Constant">"literal-boolean"</span><span class="Delimiter">);</span> @@ -96,7 +98,7 @@ if ('onhashchange' in window) { <span id="L34" class="LineNr">34 </span><span class="Delimiter">:(before "End Parsing reagent")</span> <span id="L35" class="LineNr">35 </span><span class="Normal">if</span> <span class="Delimiter">(</span>name == <span class="Constant">"false"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L36" class="LineNr">36 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type != <span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L37" class="LineNr">37 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'false' is a literal and can't take a type</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L37" class="LineNr">37 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'false' is a literal and can't take a type\n"</span> << end<span class="Delimiter">();</span> <span id="L38" class="LineNr">38 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L39" class="LineNr">39 </span> <span class="Delimiter">}</span> <span id="L40" class="LineNr">40 </span> type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span><span class="Constant">"literal-boolean"</span><span class="Delimiter">);</span> @@ -106,7 +108,7 @@ if ('onhashchange' in window) { <span id="L44" class="LineNr">44 </span><span class="Comment">//: 'null'</span> <span id="L45" class="LineNr">45 </span> <span id="L46" class="LineNr">46 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> -<span id="L47" class="LineNr">47 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"literal-address"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L47" class="LineNr">47 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"literal-address"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L48" class="LineNr">48 </span> <span id="L49" class="LineNr">49 </span><span class="Delimiter">:(scenario null)</span> <span id="L50" class="LineNr">50 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ @@ -117,7 +119,7 @@ if ('onhashchange' in window) { <span id="L55" class="LineNr">55 </span><span class="Delimiter">:(before "End Parsing reagent")</span> <span id="L56" class="LineNr">56 </span><span class="Normal">if</span> <span class="Delimiter">(</span>name == <span class="Constant">"null"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L57" class="LineNr">57 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type != <span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L58" class="LineNr">58 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'null' is a literal and can't take a type</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L58" class="LineNr">58 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'null' is a literal and can't take a type\n"</span> << end<span class="Delimiter">();</span> <span id="L59" class="LineNr">59 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L60" class="LineNr">60 </span> <span class="Delimiter">}</span> <span id="L61" class="LineNr">61 </span> type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span><span class="Constant">"literal-address"</span><span class="Delimiter">);</span> diff --git a/html/019type_abbreviations.cc.html b/html/019type_abbreviations.cc.html index 4d9eb542..e5f55721 100644 --- a/html/019type_abbreviations.cc.html +++ b/html/019type_abbreviations.cc.html @@ -11,22 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.Identifier { color: #c0a020; } -.LineNr { color: #444444; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.Identifier { color:#c0a020; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } .SalientComment { color: #00ffff; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.cSpecial { color: #008000; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -61,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/019type_abbreviations.cc'>https://github.com/akkartik/mu/blob/master/019type_abbreviations.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: For convenience, allow Mu types to be abbreviated.</span> <span id="L2" class="LineNr"> 2 </span> @@ -73,7 +75,7 @@ if ('onhashchange' in window) { <span id="L9" class="LineNr"> 9 </span><span class="traceContains">+transform: product type after expanding abbreviations: "number"</span> <span id="L10" class="LineNr"> 10 </span> <span id="L11" class="LineNr"> 11 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L12" class="LineNr"> 12 </span>map<string<span class="Delimiter">,</span> type_tree*> Type_abbreviations<span class="Delimiter">,</span> Type_abbreviations_snapshot<span class="Delimiter">;</span> +<span id="L12" class="LineNr"> 12 </span>map<string<span class="Delimiter">,</span> type_tree*> <span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> <span class="Special">Type_abbreviations_snapshot</span><span class="Delimiter">;</span> <span id="L13" class="LineNr"> 13 </span> <span id="L14" class="LineNr"> 14 </span><span class="SalientComment">//:: Defining type abbreviations.</span> <span id="L15" class="LineNr"> 15 </span> @@ -87,36 +89,36 @@ if ('onhashchange' in window) { <span id="L23" class="LineNr"> 23 </span> string new_type_name = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L24" class="LineNr"> 24 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> || !new_type_name<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> <span id="L25" class="LineNr"> 25 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">)</span> || new_type_name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L26" class="LineNr"> 26 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'type' statement; must be of the form 'type <new type name> = <type expression>'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L26" class="LineNr"> 26 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'type' statement; must be of the form 'type <new type name> = <type expression>'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L27" class="LineNr"> 27 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L28" class="LineNr"> 28 </span> <span class="Delimiter">}</span> <span id="L29" class="LineNr"> 29 </span> string arrow = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L30" class="LineNr"> 30 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">)</span> || !arrow<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> <span id="L31" class="LineNr"> 31 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>arrow<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L32" class="LineNr"> 32 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'type' statement 'type "</span> << new_type_name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L32" class="LineNr"> 32 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'type' statement 'type "</span> << new_type_name << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L33" class="LineNr"> 33 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L34" class="LineNr"> 34 </span> <span class="Delimiter">}</span> <span id="L35" class="LineNr"> 35 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>arrow != <span class="Constant">"="</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L36" class="LineNr"> 36 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'type' statements must be of the form 'type <new type name> = <type expression>' but got 'type "</span> << new_type_name << <span class="Constant">' '</span> << arrow << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L36" class="LineNr"> 36 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'type' statements must be of the form 'type <new type name> = <type expression>' but got 'type "</span> << new_type_name << <span class="Constant">' '</span> << arrow << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L37" class="LineNr"> 37 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L38" class="LineNr"> 38 </span> <span class="Delimiter">}</span> <span id="L39" class="LineNr"> 39 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L40" class="LineNr"> 40 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'type' statement 'type "</span> << new_type_name << <span class="Constant">" ='</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L40" class="LineNr"> 40 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'type' statement 'type "</span> << new_type_name << <span class="Constant">" ='\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L41" class="LineNr"> 41 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L42" class="LineNr"> 42 </span> <span class="Delimiter">}</span> <span id="L43" class="LineNr"> 43 </span> string old = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L44" class="LineNr"> 44 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>old<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L45" class="LineNr"> 45 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'type' statement 'type "</span> << new_type_name << <span class="Constant">" ='</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L46" class="LineNr"> 46 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'type' statements must be of the form 'type <new type name> = <type expression>' but got 'type "</span> << new_type_name << <span class="Constant">' '</span> << arrow << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L45" class="LineNr"> 45 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'type' statement 'type "</span> << new_type_name << <span class="Constant">" ='\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L46" class="LineNr"> 46 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'type' statements must be of the form 'type <new type name> = <type expression>' but got 'type "</span> << new_type_name << <span class="Constant">' '</span> << arrow << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L47" class="LineNr"> 47 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L48" class="LineNr"> 48 </span> <span class="Delimiter">}</span> -<span id="L49" class="LineNr"> 49 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> new_type_name<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L50" class="LineNr"> 50 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'type' conflict: '"</span> << new_type_name << <span class="Constant">"' defined as both '"</span> << names_to_string_without_quotes<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> new_type_name<span class="Delimiter">))</span> << <span class="Constant">"' and '"</span> << old << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L49" class="LineNr"> 49 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> new_type_name<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L50" class="LineNr"> 50 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'type' conflict: '"</span> << new_type_name << <span class="Constant">"' defined as both '"</span> << names_to_string_without_quotes<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> new_type_name<span class="Delimiter">))</span> << <span class="Constant">"' and '"</span> << old << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L51" class="LineNr"> 51 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L52" class="LineNr"> 52 </span> <span class="Delimiter">}</span> <span id="L53" class="LineNr"> 53 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9990</span><span class="Delimiter">,</span> <span class="Constant">"type"</span><span class="Delimiter">)</span> << <span class="Constant">"alias "</span> << new_type_name << <span class="Constant">" = "</span> << old << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L54" class="LineNr"> 54 </span> type_tree* old_type = <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span>old<span class="Delimiter">);</span> -<span id="L55" class="LineNr"> 55 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> new_type_name<span class="Delimiter">,</span> old_type<span class="Delimiter">);</span> +<span id="L55" class="LineNr"> 55 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> new_type_name<span class="Delimiter">,</span> old_type<span class="Delimiter">);</span> <span id="L56" class="LineNr"> 56 </span><span class="Delimiter">}</span> <span id="L57" class="LineNr"> 57 </span> <span id="L58" class="LineNr"> 58 </span>type_tree* <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Normal">const</span> string& x<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -164,34 +166,34 @@ if ('onhashchange' in window) { <span id="L100" class="LineNr">100 </span><span class="Comment">//: cleaning up type abbreviations between tests and before exiting</span> <span id="L101" class="LineNr">101 </span> <span id="L102" class="LineNr">102 </span><span class="Delimiter">:(before "End save_snapshots")</span> -<span id="L103" class="LineNr">103 </span>Type_abbreviations_snapshot = Type_abbreviations<span class="Delimiter">;</span> +<span id="L103" class="LineNr">103 </span><span class="Special">Type_abbreviations_snapshot</span> = <span class="Special">Type_abbreviations</span><span class="Delimiter">;</span> <span id="L104" class="LineNr">104 </span><span class="Delimiter">:(before "End restore_snapshots")</span> <span id="L105" class="LineNr">105 </span><a href='019type_abbreviations.cc.html#L109'>restore_type_abbreviations</a><span class="Delimiter">();</span> <span id="L106" class="LineNr">106 </span><span class="Delimiter">:(before "End One-time Setup")</span> <span id="L107" class="LineNr">107 </span>atexit<span class="Delimiter">(</span><a href='019type_abbreviations.cc.html#L117'>clear_type_abbreviations</a><span class="Delimiter">);</span> <span id="L108" class="LineNr">108 </span><span class="Delimiter">:(code)</span> <span id="L109" class="LineNr">109 </span><span class="Normal">void</span> <a href='019type_abbreviations.cc.html#L109'>restore_type_abbreviations</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L110" class="LineNr">110 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<string<span class="Delimiter">,</span> type_tree*>::iterator p = Type_abbreviations<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Type_abbreviations<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>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>!contains_key<span class="Delimiter">(</span>Type_abbreviations_snapshot<span class="Delimiter">,</span> p<span class="Delimiter">-></span>first<span class="Delimiter">))</span> +<span id="L110" class="LineNr">110 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<string<span class="Delimiter">,</span> type_tree*>::iterator p = <span class="Special">Type_abbreviations</span><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Type_abbreviations</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>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>!contains_key<span class="Delimiter">(</span><span class="Special">Type_abbreviations_snapshot</span><span class="Delimiter">,</span> p<span class="Delimiter">-></span>first<span class="Delimiter">))</span> <span id="L112" class="LineNr">112 </span> <span class="Normal">delete</span> p<span class="Delimiter">-></span>second<span class="Delimiter">;</span> <span id="L113" class="LineNr">113 </span> <span class="Delimiter">}</span> -<span id="L114" class="LineNr">114 </span> Type_abbreviations<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L115" class="LineNr">115 </span> Type_abbreviations = Type_abbreviations_snapshot<span class="Delimiter">;</span> +<span id="L114" class="LineNr">114 </span> <span class="Special">Type_abbreviations</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L115" class="LineNr">115 </span> <span class="Special">Type_abbreviations</span> = <span class="Special">Type_abbreviations_snapshot</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="Normal">void</span> <a href='019type_abbreviations.cc.html#L117'>clear_type_abbreviations</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L118" class="LineNr">118 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<string<span class="Delimiter">,</span> type_tree*>::iterator p = Type_abbreviations<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Type_abbreviations<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> +<span id="L118" class="LineNr">118 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<string<span class="Delimiter">,</span> type_tree*>::iterator p = <span class="Special">Type_abbreviations</span><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Type_abbreviations</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span id="L119" class="LineNr">119 </span> <span class="Normal">delete</span> p<span class="Delimiter">-></span>second<span class="Delimiter">;</span> -<span id="L120" class="LineNr">120 </span> Type_abbreviations<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L120" class="LineNr">120 </span> <span class="Special">Type_abbreviations</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L121" class="LineNr">121 </span><span class="Delimiter">}</span> <span id="L122" class="LineNr">122 </span> <span id="L123" class="LineNr">123 </span><span class="SalientComment">//:: A few default abbreviations.</span> <span id="L124" class="LineNr">124 </span> <span id="L125" class="LineNr">125 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> -<span id="L126" class="LineNr">126 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> <span class="Constant">"&"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"address"</span><span class="Delimiter">));</span> -<span id="L127" class="LineNr">127 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> <span class="Constant">"@"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"array"</span><span class="Delimiter">));</span> -<span id="L128" class="LineNr">128 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> <span class="Constant">"num"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"number"</span><span class="Delimiter">));</span> -<span id="L129" class="LineNr">129 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> <span class="Constant">"bool"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"boolean"</span><span class="Delimiter">));</span> -<span id="L130" class="LineNr">130 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> <span class="Constant">"char"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"character"</span><span class="Delimiter">));</span> +<span id="L126" class="LineNr">126 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> <span class="Constant">"&"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"address"</span><span class="Delimiter">));</span> +<span id="L127" class="LineNr">127 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> <span class="Constant">"@"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"array"</span><span class="Delimiter">));</span> +<span id="L128" class="LineNr">128 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> <span class="Constant">"num"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"number"</span><span class="Delimiter">));</span> +<span id="L129" class="LineNr">129 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> <span class="Constant">"bool"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"boolean"</span><span class="Delimiter">));</span> +<span id="L130" class="LineNr">130 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> <span class="Constant">"char"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"character"</span><span class="Delimiter">));</span> <span id="L131" class="LineNr">131 </span> <span id="L132" class="LineNr">132 </span><span class="Delimiter">:(scenario use_type_abbreviations_when_declaring_type_abbreviations)</span> <span id="L133" class="LineNr">133 </span><span class="muData">type</span> foo = &:num @@ -222,13 +224,13 @@ if ('onhashchange' in window) { <span id="L158" class="LineNr">158 </span><span class="traceContains">+transform: ingredient type after expanding abbreviations: ("array" ("address" "number") "3")</span> <span id="L159" class="LineNr">159 </span> <span id="L160" class="LineNr">160 </span><span class="Delimiter">:(before "Transform.push_back(update_instruction_operations)")</span> -<span id="L161" class="LineNr">161 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>expand_type_abbreviations<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L161" class="LineNr">161 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>expand_type_abbreviations<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L162" class="LineNr">162 </span><span class="Comment">// Begin Type Modifying Transforms</span> <span id="L163" class="LineNr">163 </span><span class="Comment">// End Type Modifying Transforms</span> <span id="L164" class="LineNr">164 </span> <span id="L165" class="LineNr">165 </span><span class="Delimiter">:(code)</span> <span id="L166" class="LineNr">166 </span><span class="Normal">void</span> expand_type_abbreviations<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="L167" class="LineNr">167 </span> expand_type_abbreviations<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">));</span> +<span id="L167" class="LineNr">167 </span> expand_type_abbreviations<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">));</span> <span id="L168" class="LineNr">168 </span><span class="Delimiter">}</span> <span id="L169" class="LineNr">169 </span> <span id="L170" class="LineNr">170 </span><span class="Normal">void</span> expand_type_abbreviations<span class="Delimiter">(</span><span class="Normal">const</span> recipe& caller<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -255,8 +257,8 @@ if ('onhashchange' in window) { <span id="L191" class="LineNr">191 </span> expand_type_abbreviations<span class="Delimiter">(</span>type<span class="Delimiter">-></span>right<span class="Delimiter">);</span> <span id="L192" class="LineNr">192 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L193" class="LineNr">193 </span> <span class="Delimiter">}</span> -<span id="L194" class="LineNr">194 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> -<span id="L195" class="LineNr">195 </span> *type = type_tree<span class="Delimiter">(</span>*get<span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">));</span> +<span id="L194" class="LineNr">194 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> +<span id="L195" class="LineNr">195 </span> *type = type_tree<span class="Delimiter">(</span>*get<span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">));</span> <span id="L196" class="LineNr">196 </span><span class="Delimiter">}</span> </pre> </body> diff --git a/html/020run.cc.html b/html/020run.cc.html index c2f8248b..bc61e5f7 100644 --- a/html/020run.cc.html +++ b/html/020run.cc.html @@ -11,23 +11,25 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } .SalientComment { color: #00ffff; } .CommentedCode { color: #6c6c6c; } .traceAbsent { color: #c00000; } .muRecipe { color: #ff8700; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .cSpecial { color: #008000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -62,6 +64,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/020run.cc'>https://github.com/akkartik/mu/blob/master/020run.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Phase 3: Start running a loaded and transformed recipe.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//:</span> @@ -112,27 +115,27 @@ if ('onhashchange' in window) { <span id="L47" class="LineNr"> 47 </span><span class="Delimiter">};</span> <span id="L48" class="LineNr"> 48 </span> <span id="L49" class="LineNr"> 49 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L50" class="LineNr"> 50 </span>routine* Current_routine = <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L50" class="LineNr"> 50 </span>routine* <span class="Special">Current_routine</span> = <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L51" class="LineNr"> 51 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L52" class="LineNr"> 52 </span>Current_routine = <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L52" class="LineNr"> 52 </span><span class="Special">Current_routine</span> = <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L53" class="LineNr"> 53 </span> <span id="L54" class="LineNr"> 54 </span><span class="Delimiter">:(code)</span> <span id="L55" class="LineNr"> 55 </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="L56" class="LineNr"> 56 </span> routine rr<span class="Delimiter">(</span>r<span class="Delimiter">);</span> -<span id="L57" class="LineNr"> 57 </span> Current_routine = &rr<span class="Delimiter">;</span> +<span id="L57" class="LineNr"> 57 </span> <span class="Special">Current_routine</span> = &rr<span class="Delimiter">;</span> <span id="L58" class="LineNr"> 58 </span> run_current_routine<span class="Delimiter">();</span> -<span id="L59" class="LineNr"> 59 </span> Current_routine = <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L59" class="LineNr"> 59 </span> <span class="Special">Current_routine</span> = <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L60" class="LineNr"> 60 </span><span class="Delimiter">}</span> <span id="L61" class="LineNr"> 61 </span> <span id="L62" class="LineNr"> 62 </span><span class="Normal">void</span> run_current_routine<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L63" class="LineNr"> 63 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='073scheduler.cc.html#L28'>should_continue_running</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// beware: may modify Current_routine</span> +<span id="L63" class="LineNr"> 63 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='073scheduler.cc.html#L28'>should_continue_running</a><span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// beware: may modify Current_routine</span> <span id="L64" class="LineNr"> 64 </span> <span class="Comment">// Running One Instruction</span> <span id="L65" class="LineNr"> 65 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>is_label<span class="Delimiter">)</span> <span class="Delimiter">{</span> ++current_step_index<span class="Delimiter">();</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> -<span id="L66" class="LineNr"> 66 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span>Initial_callstack_depth + Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L66" class="LineNr"> 66 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Special">Initial_callstack_depth</span> + <span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth<span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L67" class="LineNr"> 67 </span><span class="CommentedCode">//? if (Foo) cerr << "run: " << to_string(current_instruction()) << '\n';</span> -<span id="L68" class="LineNr"> 68 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">)</span> != <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L69" class="LineNr"> 69 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"something wrote to location 0; this should never happen</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L70" class="LineNr"> 70 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L68" class="LineNr"> 68 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">)</span> != <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L69" class="LineNr"> 69 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"something wrote to location 0; this should never happen\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L70" class="LineNr"> 70 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L71" class="LineNr"> 71 </span> <span class="Delimiter">}</span> <span id="L72" class="LineNr"> 72 </span> <span class="Comment">// read all ingredients from memory, each potentially spanning multiple locations</span> <span id="L73" class="LineNr"> 73 </span> vector<vector<<span class="Normal">double</span>> > ingredients<span class="Delimiter">;</span> @@ -162,7 +165,7 @@ if ('onhashchange' in window) { <span id="L97" class="LineNr"> 97 </span> <span class="Comment">//: used by a later layer</span> <span id="L98" class="LineNr"> 98 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>write_products<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L99" class="LineNr"> 99 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>products<span class="Delimiter">)</span> < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L100" class="LineNr">100 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>products<span class="Delimiter">)</span> << <span class="Constant">" vs "</span> << <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">)</span> << <span class="Constant">": failed to write to all products in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L100" class="LineNr">100 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>products<span class="Delimiter">)</span> << <span class="Constant">" vs "</span> << <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">)</span> << <span class="Constant">": failed to write to all products in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L101" class="LineNr">101 </span> <span class="Delimiter">}</span> <span id="L102" class="LineNr">102 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L103" class="LineNr">103 </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#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -181,8 +184,8 @@ if ('onhashchange' in window) { <span id="L116" class="LineNr">116 </span><span class="Delimiter">:(code)</span> <span id="L117" class="LineNr">117 </span><span class="Comment">//: hook replaced in a later layer</span> <span id="L118" class="LineNr">118 </span><span class="Normal">bool</span> <a href='073scheduler.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="L119" class="LineNr">119 </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="L120" class="LineNr">120 </span> <span class="Identifier">return</span> !Current_routine<span class="Delimiter">-></span>completed<span class="Delimiter">();</span> +<span id="L119" class="LineNr">119 </span> assert<span class="Delimiter">(</span>current_routine == <span class="Special">Current_routine</span><span class="Delimiter">);</span> <span class="Comment">// argument passed in just to make caller readable above</span> +<span id="L120" class="LineNr">120 </span> <span class="Identifier">return</span> !<span class="Special">Current_routine</span><span class="Delimiter">-></span>completed<span class="Delimiter">();</span> <span id="L121" class="LineNr">121 </span><span class="Delimiter">}</span> <span id="L122" class="LineNr">122 </span> <span id="L123" class="LineNr">123 </span><span class="Normal">bool</span> should_copy_ingredients<span class="Delimiter">()</span> <span class="Delimiter">{</span> @@ -214,7 +217,7 @@ if ('onhashchange' in window) { <span id="L149" class="LineNr">149 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"invalid type "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L150" class="LineNr">150 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L151" class="LineNr">151 </span> <span class="Delimiter">}</span> -<span id="L152" class="LineNr">152 </span> <span class="Identifier">return</span> type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == Address_type_ordinal<span class="Delimiter">;</span> +<span id="L152" class="LineNr">152 </span> <span class="Identifier">return</span> type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == <span class="Special">Address_type_ordinal</span><span class="Delimiter">;</span> <span id="L153" class="LineNr">153 </span><span class="Delimiter">}</span> <span id="L154" class="LineNr">154 </span> <span id="L155" class="LineNr">155 </span><span class="Comment">//: Some helpers.</span> @@ -222,37 +225,37 @@ if ('onhashchange' in window) { <span id="L157" class="LineNr">157 </span> <span id="L158" class="LineNr">158 </span><span class="Comment">//: hook replaced in a later layer</span> <span id="L159" class="LineNr">159 </span><span class="Normal">int</span>& <a href='026call.cc.html#L84'>current_step_index</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L160" class="LineNr">160 </span> <span class="Identifier">return</span> Current_routine<span class="Delimiter">-></span>running_step_index<span class="Delimiter">;</span> +<span id="L160" class="LineNr">160 </span> <span class="Identifier">return</span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>running_step_index<span class="Delimiter">;</span> <span id="L161" class="LineNr">161 </span><span class="Delimiter">}</span> <span id="L162" class="LineNr">162 </span> <span id="L163" class="LineNr">163 </span><span class="Comment">//: hook replaced in a later layer</span> <span id="L164" class="LineNr">164 </span><a href='010vm.cc.html#L14'>recipe_ordinal</a> <a href='026call.cc.html#L85'>currently_running_recipe</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L165" class="LineNr">165 </span> <span class="Identifier">return</span> Current_routine<span class="Delimiter">-></span>running_recipe<span class="Delimiter">;</span> +<span id="L165" class="LineNr">165 </span> <span class="Identifier">return</span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>running_recipe<span class="Delimiter">;</span> <span id="L166" class="LineNr">166 </span><span class="Delimiter">}</span> <span id="L167" class="LineNr">167 </span> <span id="L168" class="LineNr">168 </span><span class="Comment">//: hook replaced in a later layer</span> <span id="L169" class="LineNr">169 </span><span class="Normal">const</span> string& <a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L170" class="LineNr">170 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> Current_routine<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name<span class="Delimiter">;</span> +<span id="L170" class="LineNr">170 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name<span class="Delimiter">;</span> <span id="L171" class="LineNr">171 </span><span class="Delimiter">}</span> <span id="L172" class="LineNr">172 </span> <span id="L173" class="LineNr">173 </span><span class="Comment">//: hook replaced in a later layer</span> <span id="L174" class="LineNr">174 </span><span class="Normal">const</span> recipe& <a href='026call.cc.html#L86'>current_recipe</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L175" class="LineNr">175 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> Current_routine<span class="Delimiter">-></span>running_recipe<span class="Delimiter">);</span> +<span id="L175" class="LineNr">175 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>running_recipe<span class="Delimiter">);</span> <span id="L176" class="LineNr">176 </span><span class="Delimiter">}</span> <span id="L177" class="LineNr">177 </span> <span id="L178" class="LineNr">178 </span><span class="Comment">//: hook replaced in a later layer</span> <span id="L179" class="LineNr">179 </span><span class="Normal">const</span> instruction& <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L180" class="LineNr">180 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> Current_routine<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>running_step_index<span class="Delimiter">);</span> +<span id="L180" class="LineNr">180 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>running_step_index<span class="Delimiter">);</span> <span id="L181" class="LineNr">181 </span><span class="Delimiter">}</span> <span id="L182" class="LineNr">182 </span> <span id="L183" class="LineNr">183 </span><span class="Comment">//: hook replaced in a later layer</span> <span id="L184" class="LineNr">184 </span><span class="Normal">bool</span> routine::completed<span class="Delimiter">()</span> <span class="Normal">const</span> <span class="Delimiter">{</span> -<span id="L185" class="LineNr">185 </span> <span class="Identifier">return</span> running_step_index >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> +<span id="L185" class="LineNr">185 </span> <span class="Identifier">return</span> running_step_index >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> <span id="L186" class="LineNr">186 </span><span class="Delimiter">}</span> <span id="L187" class="LineNr">187 </span> <span id="L188" class="LineNr">188 </span><span class="Comment">//: hook replaced in a later layer</span> <span id="L189" class="LineNr">189 </span><span class="Normal">const</span> vector<instruction>& routine::steps<span class="Delimiter">()</span> <span class="Normal">const</span> <span class="Delimiter">{</span> -<span id="L190" class="LineNr">190 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">;</span> +<span id="L190" class="LineNr">190 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">;</span> <span id="L191" class="LineNr">191 </span><span class="Delimiter">}</span> <span id="L192" class="LineNr">192 </span> <span id="L193" class="LineNr">193 </span><span class="SalientComment">//:: Startup flow</span> @@ -273,12 +276,12 @@ if ('onhashchange' in window) { <span id="L208" class="LineNr">208 </span> <span class="Comment">// ignore argv past '--'; that's commandline args for 'main'</span> <span id="L209" class="LineNr">209 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>string<span class="Delimiter">(</span>*argv<span class="Delimiter">)</span> == <span class="Constant">"--"</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L210" class="LineNr">210 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L77'>starts_with</a><span class="Delimiter">(</span>*argv<span class="Delimiter">,</span> <span class="Constant">"--"</span><span class="Delimiter">))</span> -<span id="L211" class="LineNr">211 </span> cerr << <span class="Constant">"treating "</span> << *argv << <span class="Constant">" as a file rather than an option</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L211" class="LineNr">211 </span> cerr << <span class="Constant">"treating "</span> << *argv << <span class="Constant">" as a file rather than an option\n"</span><span class="Delimiter">;</span> <span id="L212" class="LineNr">212 </span> load_file_or_directory<span class="Delimiter">(</span>*argv<span class="Delimiter">);</span> <span id="L213" class="LineNr">213 </span> --argc<span class="Delimiter">;</span> <span id="L214" class="LineNr">214 </span> ++argv<span class="Delimiter">;</span> <span id="L215" class="LineNr">215 </span> <span class="Delimiter">}</span> -<span id="L216" class="LineNr">216 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Run_tests<span class="Delimiter">)</span> Recipe<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">));</span> +<span id="L216" class="LineNr">216 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Run_tests</span><span class="Delimiter">)</span> <span class="Special">Recipe</span><span class="Delimiter">.</span>erase<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">));</span> <span id="L217" class="LineNr">217 </span><span class="Delimiter">}</span> <span id="L218" class="LineNr">218 </span><a href='012transform.cc.html#L46'>transform_all</a><span class="Delimiter">();</span> <span id="L219" class="LineNr">219 </span><span class="CommentedCode">//? cerr << to_original_string(get(Type_ordinal, "editor")) << '\n';</span> @@ -286,26 +289,26 @@ if ('onhashchange' in window) { <span id="L221" class="LineNr">221 </span><span class="CommentedCode">//? DUMP("");</span> <span id="L222" class="LineNr">222 </span><span class="CommentedCode">//? exit(0);</span> <span id="L223" class="LineNr">223 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='003trace.cc.html#L220'>trace_contains_errors</a><span class="Delimiter">())</span> <span class="Identifier">return</span> <span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L224" class="LineNr">224 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream && Run_tests<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L224" class="LineNr">224 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_stream</span> && <span class="Special">Run_tests</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L225" class="LineNr">225 </span> <span class="Comment">// We'll want a trace per test. Clear the trace.</span> -<span id="L226" class="LineNr">226 </span> <span class="Normal">delete</span> Trace_stream<span class="Delimiter">;</span> -<span id="L227" class="LineNr">227 </span> Trace_stream = <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L226" class="LineNr">226 </span> <span class="Normal">delete</span> <span class="Special">Trace_stream</span><span class="Delimiter">;</span> +<span id="L227" class="LineNr">227 </span> <span class="Special">Trace_stream</span> = <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L228" class="LineNr">228 </span><span class="Delimiter">}</span> <span id="L229" class="LineNr">229 </span>save_snapshots<span class="Delimiter">();</span> <span id="L230" class="LineNr">230 </span> <span id="L231" class="LineNr">231 </span><span class="Comment">//: Step 3: if we aren't running tests, locate a recipe called 'main' and</span> <span id="L232" class="LineNr">232 </span><span class="Comment">//: start running it.</span> <span id="L233" class="LineNr">233 </span><span class="Delimiter">:(before "End Main")</span> -<span id="L234" class="LineNr">234 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!Run_tests && <a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">)</span> && <a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> +<span id="L234" class="LineNr">234 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Run_tests</span> && <a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">)</span> && <a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> <span id="L235" class="LineNr">235 </span> <span class="Comment">// Running Main</span> <span id="L236" class="LineNr">236 </span> <a href='000organization.cc.html#L134'>reset</a><span class="Delimiter">();</span> <span id="L237" class="LineNr">237 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"=== Starting to run"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L238" class="LineNr">238 </span> assert<span class="Delimiter">(</span>Num_calls_to_transform_all == <span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L238" class="LineNr">238 </span> assert<span class="Delimiter">(</span><span class="Special">Num_calls_to_transform_all</span> == <span class="Constant">1</span><span class="Delimiter">);</span> <span id="L239" class="LineNr">239 </span> <a href='073scheduler.cc.html#L122'>run_main</a><span class="Delimiter">(</span>argc<span class="Delimiter">,</span> argv<span class="Delimiter">);</span> <span id="L240" class="LineNr">240 </span><span class="Delimiter">}</span> <span id="L241" class="LineNr">241 </span><span class="Delimiter">:(code)</span> <span id="L242" class="LineNr">242 </span><span class="Normal">void</span> <a href='073scheduler.cc.html#L122'>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="L243" class="LineNr">243 </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="L243" class="LineNr">243 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r = get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">);</span> <span id="L244" class="LineNr">244 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>r<span class="Delimiter">)</span> run<span class="Delimiter">(</span>r<span class="Delimiter">);</span> <span id="L245" class="LineNr">245 </span><span class="Delimiter">}</span> <span id="L246" class="LineNr">246 </span> @@ -317,7 +320,7 @@ if ('onhashchange' in window) { <span id="L252" class="LineNr">252 </span> <span class="Delimiter">}</span> <span id="L253" class="LineNr">253 </span> ifstream fin<span class="Delimiter">(</span>filename<span class="Delimiter">.</span>c_str<span class="Delimiter">());</span> <span id="L254" class="LineNr">254 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!fin<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L255" class="LineNr">255 </span> cerr << <span class="Constant">"no such file '"</span> << filename << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span class="Comment">// don't raise, just warn. just in case it's just a name for a scenario to run.</span> +<span id="L255" class="LineNr">255 </span> cerr << <span class="Constant">"no such file '"</span> << filename << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span class="Comment">// don't raise, just warn. just in case it's just a name for a scenario to run.</span> <span id="L256" class="LineNr">256 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L257" class="LineNr">257 </span> <span class="Delimiter">}</span> <span id="L258" class="LineNr">258 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9990</span><span class="Delimiter">,</span> <span class="Constant">"load"</span><span class="Delimiter">)</span> << <span class="Constant">"=== "</span> << filename << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> @@ -370,7 +373,7 @@ if ('onhashchange' in window) { <span id="L305" class="LineNr">305 </span> <span class="Comment">// End Preprocess read_memory(x)</span> <span id="L306" class="LineNr">306 </span> <span class="Normal">int</span> size = size_of<span class="Delimiter">(</span>x<span class="Delimiter">);</span> <span id="L307" class="LineNr">307 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> offset = <span class="Constant">0</span><span class="Delimiter">;</span> offset < size<span class="Delimiter">;</span> ++offset<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L308" class="LineNr">308 </span> <span class="Normal">double</span> val = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> x<span class="Delimiter">.</span>value+offset<span class="Delimiter">);</span> +<span id="L308" class="LineNr">308 </span> <span class="Normal">double</span> val = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> x<span class="Delimiter">.</span>value+offset<span class="Delimiter">);</span> <span id="L309" class="LineNr">309 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"location "</span> << x<span class="Delimiter">.</span>value+offset << <span class="Constant">" is "</span> << no_scientific<span class="Delimiter">(</span>val<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L310" class="LineNr">310 </span> result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>val<span class="Delimiter">);</span> <span id="L311" class="LineNr">311 </span> <span class="Delimiter">}</span> @@ -378,21 +381,21 @@ if ('onhashchange' in window) { <span id="L313" class="LineNr">313 </span><span class="Delimiter">}</span> <span id="L314" class="LineNr">314 </span> <span id="L315" class="LineNr">315 </span><span class="Normal">void</span> write_memory<span class="Delimiter">(</span>reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> x<span class="Delimiter">,</span> <span class="Normal">const</span> vector<<span class="Normal">double</span>>& data<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L316" class="LineNr">316 </span> assert<span class="Delimiter">(</span>Current_routine<span class="Delimiter">);</span> <span class="Comment">// run-time only</span> +<span id="L316" class="LineNr">316 </span> assert<span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">);</span> <span class="Comment">// run-time only</span> <span id="L317" class="LineNr">317 </span> <span class="Comment">// Begin Preprocess write_memory(x, data)</span> <span id="L318" class="LineNr">318 </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="L319" class="LineNr">319 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"can't write to '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">)</span> << <span class="Constant">"'; no type</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L319" class="LineNr">319 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"can't write to '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">)</span> << <span class="Constant">"'; no type\n"</span> << end<span class="Delimiter">();</span> <span id="L320" class="LineNr">320 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L321" class="LineNr">321 </span> <span class="Delimiter">}</span> <span id="L322" class="LineNr">322 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_dummy<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L323" class="LineNr">323 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_literal<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L324" class="LineNr">324 </span> <span class="Comment">// End Preprocess write_memory(x, data)</span> <span id="L325" class="LineNr">325 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L326" class="LineNr">326 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"can't write to location 0 in '"</span> << to_original_string<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L326" class="LineNr">326 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"can't write to location 0 in '"</span> << to_original_string<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L327" class="LineNr">327 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L328" class="LineNr">328 </span> <span class="Delimiter">}</span> <span id="L329" class="LineNr">329 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>size_mismatch<span class="Delimiter">(</span>x<span class="Delimiter">,</span> data<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L330" class="LineNr">330 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"size mismatch in storing to '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"' ("</span> << size_of<span class="Delimiter">(</span>x<span class="Delimiter">)</span> << <span class="Constant">" vs "</span> << <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>data<span class="Delimiter">)</span> << <span class="Constant">") at '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L330" class="LineNr">330 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"size mismatch in storing to '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"' ("</span> << size_of<span class="Delimiter">(</span>x<span class="Delimiter">)</span> << <span class="Constant">" vs "</span> << <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>data<span class="Delimiter">)</span> << <span class="Constant">") at '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L331" class="LineNr">331 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L332" class="LineNr">332 </span> <span class="Delimiter">}</span> <span id="L333" class="LineNr">333 </span> <span class="Comment">// End write_memory(x) Special-cases</span> @@ -400,7 +403,7 @@ if ('onhashchange' in window) { <span id="L335" class="LineNr">335 </span> assert<span class="Delimiter">(</span>x<span class="Delimiter">.</span>value+offset > <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L336" class="LineNr">336 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing "</span> << no_scientific<span class="Delimiter">(</span>data<span class="Delimiter">.</span>at<span class="Delimiter">(</span>offset<span class="Delimiter">))</span> << <span class="Constant">" in location "</span> << x<span class="Delimiter">.</span>value+offset << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L337" class="LineNr">337 </span><span class="CommentedCode">//? if (Foo) cerr << "mem: storing " << no_scientific(data.at(offset)) << " in location " << x.value+offset << '\n';</span> -<span id="L338" class="LineNr">338 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> x<span class="Delimiter">.</span>value+offset<span class="Delimiter">,</span> data<span class="Delimiter">.</span>at<span class="Delimiter">(</span>offset<span class="Delimiter">));</span> +<span id="L338" class="LineNr">338 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> x<span class="Delimiter">.</span>value+offset<span class="Delimiter">,</span> data<span class="Delimiter">.</span>at<span class="Delimiter">(</span>offset<span class="Delimiter">));</span> <span id="L339" class="LineNr">339 </span> <span class="Delimiter">}</span> <span id="L340" class="LineNr">340 </span><span class="Delimiter">}</span> <span id="L341" class="LineNr">341 </span> @@ -422,7 +425,7 @@ if ('onhashchange' in window) { <span id="L357" class="LineNr">357 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"invalid type "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L358" class="LineNr">358 </span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L359" class="LineNr">359 </span> <span class="Delimiter">}</span> -<span id="L360" class="LineNr">360 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == Address_type_ordinal<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">2</span><span class="Delimiter">;</span> <span class="Comment">// address and alloc id</span> +<span id="L360" class="LineNr">360 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == <span class="Special">Address_type_ordinal</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">2</span><span class="Delimiter">;</span> <span class="Comment">// address and alloc id</span> <span id="L361" class="LineNr">361 </span> <span class="Comment">// End size_of(type) Non-atom Special-cases</span> <span id="L362" class="LineNr">362 </span> <span class="Delimiter">}</span> <span id="L363" class="LineNr">363 </span> <span class="Comment">// End size_of(type) Special-cases</span> @@ -458,13 +461,13 @@ if ('onhashchange' in window) { <span id="L393" class="LineNr">393 </span> <a href='012transform.cc.html#L46'>transform_all</a><span class="Delimiter">();</span> <span id="L394" class="LineNr">394 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L395" class="LineNr">395 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='003trace.cc.html#L220'>trace_contains_errors</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L396" class="LineNr">396 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Save_trace && Trace_stream<span class="Delimiter">)</span> Trace_stream<span class="Delimiter">-></span><a href='003trace.cc.html#L133'>save</a><span class="Delimiter">();</span> +<span id="L396" class="LineNr">396 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Save_trace</span> && <span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Special">Trace_stream</span><span class="Delimiter">-></span><a href='003trace.cc.html#L133'>save</a><span class="Delimiter">();</span> <span id="L397" class="LineNr">397 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L398" class="LineNr">398 </span> <span class="Delimiter">}</span> <span id="L399" class="LineNr">399 </span> <span class="Comment">// if a test defines main, it probably wants to start there regardless of</span> <span id="L400" class="LineNr">400 </span> <span class="Comment">// definition order</span> -<span id="L401" class="LineNr">401 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">)))</span> -<span id="L402" class="LineNr">402 </span> run<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">));</span> +<span id="L401" class="LineNr">401 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">)))</span> +<span id="L402" class="LineNr">402 </span> run<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">));</span> <span id="L403" class="LineNr">403 </span> <span class="Normal">else</span> <span id="L404" class="LineNr">404 </span> run<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>front<span class="Delimiter">());</span> <span id="L405" class="LineNr">405 </span><span class="Delimiter">}</span> @@ -528,33 +531,33 @@ if ('onhashchange' in window) { <span id="L463" class="LineNr">463 </span><span class="SalientComment">//:: time.</span> <span id="L464" class="LineNr">464 </span> <span id="L465" class="LineNr">465 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L466" class="LineNr">466 </span><span class="Normal">bool</span> Run_profiler =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L466" class="LineNr">466 </span><span class="Normal">bool</span> <span class="Special">Run_profiler</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L467" class="LineNr">467 </span><span class="Comment">// We'll key profile information by recipe_ordinal rather than name because</span> <span id="L468" class="LineNr">468 </span><span class="Comment">// it's more efficient, and because later layers will show more than just the</span> <span id="L469" class="LineNr">469 </span><span class="Comment">// name of a recipe.</span> <span id="L470" class="LineNr">470 </span><span class="Comment">//</span> <span id="L471" class="LineNr">471 </span><span class="Comment">// One drawback: if you're clearing recipes your profile will be inaccurate.</span> <span id="L472" class="LineNr">472 </span><span class="Comment">// So far that happens in tests, and in 'run-sandboxed' in a later layer.</span> -<span id="L473" class="LineNr">473 </span>map<recipe_ordinal<span class="Delimiter">,</span> <span class="Normal">int</span>> Instructions_running<span class="Delimiter">;</span> +<span id="L473" class="LineNr">473 </span>map<recipe_ordinal<span class="Delimiter">,</span> <span class="Normal">int</span>> <span class="Special">Instructions_running</span><span class="Delimiter">;</span> <span id="L474" class="LineNr">474 </span><span class="Delimiter">:(before "End Commandline Options(*arg)")</span> <span id="L475" class="LineNr">475 </span><span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L73'>is_equal</a><span class="Delimiter">(</span>*arg<span class="Delimiter">,</span> <span class="Constant">"--profile"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L476" class="LineNr">476 </span> Run_profiler =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L476" class="LineNr">476 </span> <span class="Special">Run_profiler</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L477" class="LineNr">477 </span><span class="Delimiter">}</span> <span id="L478" class="LineNr">478 </span><span class="Delimiter">:(after "Running One Instruction")</span> -<span id="L479" class="LineNr">479 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Run_profiler<span class="Delimiter">)</span> Instructions_running[currently_running_recipe<span class="Delimiter">()</span>]++<span class="Delimiter">;</span> +<span id="L479" class="LineNr">479 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Run_profiler</span><span class="Delimiter">)</span> <span class="Special">Instructions_running</span>[currently_running_recipe<span class="Delimiter">()</span>]++<span class="Delimiter">;</span> <span id="L480" class="LineNr">480 </span><span class="Delimiter">:(before "End One-time Setup")</span> <span id="L481" class="LineNr">481 </span>atexit<span class="Delimiter">(</span>dump_profile<span class="Delimiter">);</span> <span id="L482" class="LineNr">482 </span><span class="Delimiter">:(code)</span> <span id="L483" class="LineNr">483 </span><span class="Normal">void</span> dump_profile<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L484" class="LineNr">484 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Run_profiler<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L485" class="LineNr">485 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Run_tests<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L486" class="LineNr">486 </span> cerr << <span class="Constant">"It's not a good idea to profile a run with tests, since tests can create conflicting recipes and mislead you. To try it anyway, comment out this check in the code.</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L484" class="LineNr">484 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Run_profiler</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L485" class="LineNr">485 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Run_tests</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L486" class="LineNr">486 </span> cerr << <span class="Constant">"It's not a good idea to profile a run with tests, since tests can create conflicting recipes and mislead you. To try it anyway, comment out this check in the code.\n"</span><span class="Delimiter">;</span> <span id="L487" class="LineNr">487 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L488" class="LineNr">488 </span> <span class="Delimiter">}</span> <span id="L489" class="LineNr">489 </span> ofstream fout<span class="Delimiter">;</span> <span id="L490" class="LineNr">490 </span> fout<span class="Delimiter">.</span>open<span class="Delimiter">(</span><span class="Constant">"profile.instructions"</span><span class="Delimiter">);</span> <span id="L491" class="LineNr">491 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>fout<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L492" class="LineNr">492 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<recipe_ordinal<span class="Delimiter">,</span> <span class="Normal">int</span>>::iterator p = Instructions_running<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Instructions_running<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L492" class="LineNr">492 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<recipe_ordinal<span class="Delimiter">,</span> <span class="Normal">int</span>>::iterator p = <span class="Special">Instructions_running</span><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Instructions_running</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L493" class="LineNr">493 </span> fout << std::setw<span class="Delimiter">(</span><span class="Constant">9</span><span class="Delimiter">)</span> << p<span class="Delimiter">-></span>second << <span class="Constant">' '</span> << header_label<span class="Delimiter">(</span>p<span class="Delimiter">-></span>first<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L494" class="LineNr">494 </span> <span class="Delimiter">}</span> <span id="L495" class="LineNr">495 </span> <span class="Delimiter">}</span> @@ -564,7 +567,7 @@ if ('onhashchange' in window) { <span id="L499" class="LineNr">499 </span> <span id="L500" class="LineNr">500 </span><span class="Comment">// overridden in a later layer</span> <span id="L501" class="LineNr">501 </span>string header_label<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="L502" class="LineNr">502 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">;</span> +<span id="L502" class="LineNr">502 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">;</span> <span id="L503" class="LineNr">503 </span><span class="Delimiter">}</span> </pre> </body> diff --git a/html/021check_instruction.cc.html b/html/021check_instruction.cc.html index 7d82f1f2..9a805f3b 100644 --- a/html/021check_instruction.cc.html +++ b/html/021check_instruction.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.traceContains { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } +.traceContains { color: #008000; } --> </style> @@ -59,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/021check_instruction.cc'>https://github.com/akkartik/mu/blob/master/021check_instruction.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Introduce a new transform to perform various checks in instructions before</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: we start running them. It'll be extensible, so that we can add checks for</span> @@ -71,25 +74,25 @@ if ('onhashchange' in window) { <span id="L9" class="LineNr"> 9 </span><span class="Comment">//: transform it in a separate layer or set of layers.</span> <span id="L10" class="LineNr"> 10 </span> <span id="L11" class="LineNr"> 11 </span><span class="Delimiter">:(before "End Checks")</span> -<span id="L12" class="LineNr"> 12 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='021check_instruction.cc.html#L15'>check_instruction</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L12" class="LineNr"> 12 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='021check_instruction.cc.html#L15'>check_instruction</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L13" class="LineNr"> 13 </span> <span id="L14" class="LineNr"> 14 </span><span class="Delimiter">:(code)</span> <span id="L15" class="LineNr"> 15 </span><span class="Normal">void</span> <a href='021check_instruction.cc.html#L15'>check_instruction</a><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="L16" class="LineNr"> 16 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- perform checks for <a href='010vm.cc.html#L19'>recipe</a> "</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L16" class="LineNr"> 16 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- perform checks for <a href='010vm.cc.html#L19'>recipe</a> "</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L17" class="LineNr"> 17 </span> map<string<span class="Delimiter">,</span> vector<type_ordinal> > metadata<span class="Delimiter">;</span> -<span id="L18" class="LineNr"> 18 </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#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L19" class="LineNr"> 19 </span> instruction& inst = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L18" class="LineNr"> 18 </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#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L19" class="LineNr"> 19 </span> instruction& inst = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L20" class="LineNr"> 20 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>is_label<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L21" class="LineNr"> 21 </span> <span class="Normal">switch</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L22" class="LineNr"> 22 </span> <span class="Comment">// Primitive Recipe Checks</span> <span id="L23" class="LineNr"> 23 </span> <span class="Normal">case</span> <a href='010vm.cc.html#L196'>COPY</a>: <span class="Delimiter">{</span> <span id="L24" class="LineNr"> 24 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L25" class="LineNr"> 25 </span> <a href='003trace.cc.html#L196'>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">"too many products in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L25" class="LineNr"> 25 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"too many products in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L26" class="LineNr"> 26 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L27" class="LineNr"> 27 </span> <span class="Delimiter">}</span> <span id="L28" class="LineNr"> 28 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L29" class="LineNr"> 29 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<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="L30" class="LineNr"> 30 </span> <a href='003trace.cc.html#L196'>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">"can't copy '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"' to '"</span> << inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'; types don't match</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L30" class="LineNr"> 30 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"can't copy '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"' to '"</span> << inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'; types don't match\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L31" class="LineNr"> 31 </span> <span class="Identifier">goto</span> finish_checking_instruction<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">}</span> @@ -181,7 +184,7 @@ if ('onhashchange' in window) { <span id="L119" class="LineNr">119 </span><span class="Comment">//: copy arguments for later layers</span> <span id="L120" class="LineNr">120 </span><span class="Normal">bool</span> <a href='021check_instruction.cc.html#L120'>types_strictly_match_sub</a><span class="Delimiter">(</span><span class="Normal">const</span> reagent& to<span class="Delimiter">,</span> <span class="Normal">const</span> reagent& from<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L121" class="LineNr">121 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>to<span class="Delimiter">.</span>type == <span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// error</span> -<span id="L122" class="LineNr">122 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_literal<span class="Delimiter">(</span>from<span class="Delimiter">)</span> && to<span class="Delimiter">.</span>type<span class="Delimiter">-></span>value == Number_type_ordinal<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L122" class="LineNr">122 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_literal<span class="Delimiter">(</span>from<span class="Delimiter">)</span> && to<span class="Delimiter">.</span>type<span class="Delimiter">-></span>value == <span class="Special">Number_type_ordinal</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L123" class="LineNr">123 </span> <span class="Comment">// to sidestep type-checking, use /unsafe in the source.</span> <span id="L124" class="LineNr">124 </span> <span class="Comment">// this will be highlighted in red inside vim. just for setting up some tests.</span> <span id="L125" class="LineNr">125 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='021check_instruction.cc.html#L180'>is_unsafe</a><span class="Delimiter">(</span>from<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> @@ -226,15 +229,15 @@ if ('onhashchange' in window) { <span id="L164" class="LineNr">164 </span><span class="Delimiter">}</span> <span id="L165" class="LineNr">165 </span> <span id="L166" class="LineNr">166 </span><span class="Normal">void</span> <a href='021check_instruction.cc.html#L166'>test_type_abbreviations_match_raw_types</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L167" class="LineNr">167 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> <span class="Constant">"text"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"address:array:character"</span><span class="Delimiter">));</span> +<span id="L167" class="LineNr">167 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> <span class="Constant">"text"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"address:array:character"</span><span class="Delimiter">));</span> <span id="L168" class="LineNr">168 </span> <span class="Comment">// a has type (address buffer (address array character))</span> <span id="L169" class="LineNr">169 </span> reagent a<span class="Delimiter">(</span><span class="Constant">"a:<a href='043space.cc.html#L101'>address</a>:buffer:text"</span><span class="Delimiter">);</span> <span id="L170" class="LineNr">170 </span> expand_type_abbreviations<span class="Delimiter">(</span>a<span class="Delimiter">.</span>type<span class="Delimiter">);</span> <span id="L171" class="LineNr">171 </span> <span class="Comment">// b has type (address buffer address array character)</span> <span id="L172" class="LineNr">172 </span> reagent b<span class="Delimiter">(</span><span class="Constant">"b:<a href='043space.cc.html#L101'>address</a>:buffer:<a href='043space.cc.html#L101'>address</a>:array:character"</span><span class="Delimiter">);</span> <span id="L173" class="LineNr">173 </span> <a href='002test.cc.html#L24'>CHECK</a><span class="Delimiter">(</span>types_strictly_match<span class="Delimiter">(</span>a<span class="Delimiter">,</span> b<span class="Delimiter">));</span> -<span id="L174" class="LineNr">174 </span> <span class="Normal">delete</span> Type_abbreviations[<span class="Constant">"text"</span>]<span class="Delimiter">;</span> -<span id="L175" class="LineNr">175 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> <span class="Constant">"text"</span><span class="Delimiter">,</span> <span class="Constant">NULL</span><span class="Delimiter">);</span> +<span id="L174" class="LineNr">174 </span> <span class="Normal">delete</span> <span class="Special">Type_abbreviations</span>[<span class="Constant">"text"</span>]<span class="Delimiter">;</span> +<span id="L175" class="LineNr">175 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> <span class="Constant">"text"</span><span class="Delimiter">,</span> <span class="Constant">NULL</span><span class="Delimiter">);</span> <span id="L176" class="LineNr">176 </span><span class="Delimiter">}</span> <span id="L177" class="LineNr">177 </span> <span id="L178" class="LineNr">178 </span><span class="Comment">//: helpers</span> @@ -255,7 +258,7 @@ if ('onhashchange' in window) { <span id="L193" class="LineNr">193 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"invalid type "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L194" class="LineNr">194 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L195" class="LineNr">195 </span> <span class="Delimiter">}</span> -<span id="L196" class="LineNr">196 </span> <span class="Identifier">return</span> type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == Array_type_ordinal<span class="Delimiter">;</span> +<span id="L196" class="LineNr">196 </span> <span class="Identifier">return</span> type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == <span class="Special">Array_type_ordinal</span><span class="Delimiter">;</span> <span id="L197" class="LineNr">197 </span><span class="Delimiter">}</span> <span id="L198" class="LineNr">198 </span> <span id="L199" class="LineNr">199 </span><span class="Normal">bool</span> <a href='021check_instruction.cc.html#L199'>is_mu_boolean</a><span class="Delimiter">(</span>reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -263,7 +266,7 @@ if ('onhashchange' in window) { <span id="L201" class="LineNr">201 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!r<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L202" class="LineNr">202 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_literal<span class="Delimiter">(</span>r<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L203" class="LineNr">203 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!r<span class="Delimiter">.</span>type<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="L204" class="LineNr">204 </span> <span class="Identifier">return</span> r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>value == Boolean_type_ordinal<span class="Delimiter">;</span> +<span id="L204" class="LineNr">204 </span> <span class="Identifier">return</span> r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>value == <span class="Special">Boolean_type_ordinal</span><span class="Delimiter">;</span> <span id="L205" class="LineNr">205 </span><span class="Delimiter">}</span> <span id="L206" class="LineNr">206 </span> <span id="L207" class="LineNr">207 </span><span class="Normal">bool</span> <a href='021check_instruction.cc.html#L207'>is_mu_number</a><span class="Delimiter">(</span>reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -279,7 +282,7 @@ if ('onhashchange' in window) { <span id="L217" class="LineNr">217 </span> <span class="Identifier">return</span> r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>name == <span class="Constant">"literal-fractional-number"</span> <span id="L218" class="LineNr">218 </span> || r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>name == <span class="Constant">"literal"</span><span class="Delimiter">;</span> <span id="L219" class="LineNr">219 </span> <span class="Delimiter">}</span> -<span id="L220" class="LineNr">220 </span> <span class="Identifier">return</span> r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>value == Number_type_ordinal<span class="Delimiter">;</span> +<span id="L220" class="LineNr">220 </span> <span class="Identifier">return</span> r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>value == <span class="Special">Number_type_ordinal</span><span class="Delimiter">;</span> <span id="L221" class="LineNr">221 </span><span class="Delimiter">}</span> <span id="L222" class="LineNr">222 </span> <span id="L223" class="LineNr">223 </span><span class="Normal">bool</span> is_mu_character<span class="Delimiter">(</span>reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -290,7 +293,7 @@ if ('onhashchange' in window) { <span id="L228" class="LineNr">228 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L229" class="LineNr">229 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<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="L230" class="LineNr">230 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_literal<span class="Delimiter">(</span>type<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L231" class="LineNr">231 </span> <span class="Identifier">return</span> type<span class="Delimiter">-></span>value == Character_type_ordinal<span class="Delimiter">;</span> +<span id="L231" class="LineNr">231 </span> <span class="Identifier">return</span> type<span class="Delimiter">-></span>value == <span class="Special">Character_type_ordinal</span><span class="Delimiter">;</span> <span id="L232" class="LineNr">232 </span><span class="Delimiter">}</span> </pre> </body> diff --git a/html/022arithmetic.cc.html b/html/022arithmetic.cc.html index 0b49bc79..7c92b039 100644 --- a/html/022arithmetic.cc.html +++ b/html/022arithmetic.cc.html @@ -11,21 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.traceContains { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.cSpecial { color: #008000; } +.Comment { color: #8080ff; } +.traceContains { color: #008000; } --> </style> @@ -59,28 +60,29 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/022arithmetic.cc'>https://github.com/akkartik/mu/blob/master/022arithmetic.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Arithmetic primitives</span> <span id="L2" class="LineNr"> 2 </span> <span id="L3" class="LineNr"> 3 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L4" class="LineNr"> 4 </span>ADD<span class="Delimiter">,</span> <span id="L5" class="LineNr"> 5 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L6" class="LineNr"> 6 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"add"</span><span class="Delimiter">,</span> ADD<span class="Delimiter">);</span> +<span id="L6" class="LineNr"> 6 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"add"</span><span class="Delimiter">,</span> ADD<span class="Delimiter">);</span> <span id="L7" class="LineNr"> 7 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L8" class="LineNr"> 8 </span><span class="Normal">case</span> ADD: <span class="Delimiter">{</span> <span id="L9" class="LineNr"> 9 </span> <span class="Comment">// primary goal of these checks is to forbid address arithmetic</span> <span id="L10" class="LineNr"> 10 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L11" class="LineNr"> 11 </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>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L12" class="LineNr"> 12 </span> <a href='003trace.cc.html#L196'>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">"'add' requires number ingredients, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L12" class="LineNr"> 12 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'add' requires number ingredients, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L13" class="LineNr"> 13 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L14" class="LineNr"> 14 </span> <span class="Delimiter">}</span> <span id="L15" class="LineNr"> 15 </span> <span class="Delimiter">}</span> <span id="L16" class="LineNr"> 16 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L17" class="LineNr"> 17 </span> <a href='003trace.cc.html#L196'>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">"'add' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L17" class="LineNr"> 17 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'add' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L18" class="LineNr"> 18 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L19" class="LineNr"> 19 </span> <span class="Delimiter">}</span> <span id="L20" class="LineNr"> 20 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_number<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="Delimiter">{</span> -<span id="L21" class="LineNr"> 21 </span> <a href='003trace.cc.html#L196'>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">"'add' should yield a number, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L21" class="LineNr"> 21 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'add' should yield a number, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L22" class="LineNr"> 22 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L23" class="LineNr"> 23 </span> <span class="Delimiter">}</span> <span id="L24" class="LineNr"> 24 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -133,25 +135,25 @@ if ('onhashchange' in window) { <span id="L71" class="LineNr"> 71 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L72" class="LineNr"> 72 </span>SUBTRACT<span class="Delimiter">,</span> <span id="L73" class="LineNr"> 73 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L74" class="LineNr"> 74 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"subtract"</span><span class="Delimiter">,</span> SUBTRACT<span class="Delimiter">);</span> +<span id="L74" class="LineNr"> 74 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"subtract"</span><span class="Delimiter">,</span> SUBTRACT<span class="Delimiter">);</span> <span id="L75" class="LineNr"> 75 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L76" class="LineNr"> 76 </span><span class="Normal">case</span> SUBTRACT: <span class="Delimiter">{</span> <span id="L77" class="LineNr"> 77 </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="L78" class="LineNr"> 78 </span> <a href='003trace.cc.html#L196'>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">"'subtract' has no ingredients</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L78" class="LineNr"> 78 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'subtract' has no ingredients\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L79" class="LineNr"> 79 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L80" class="LineNr"> 80 </span> <span class="Delimiter">}</span> <span id="L81" class="LineNr"> 81 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L82" class="LineNr"> 82 </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>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L83" class="LineNr"> 83 </span> <a href='003trace.cc.html#L196'>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">"'subtract' requires number ingredients, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L83" class="LineNr"> 83 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'subtract' requires number ingredients, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L84" class="LineNr"> 84 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L85" class="LineNr"> 85 </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="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L88" class="LineNr"> 88 </span> <a href='003trace.cc.html#L196'>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">"'subtract' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L88" class="LineNr"> 88 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'subtract' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L89" class="LineNr"> 89 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L90" class="LineNr"> 90 </span> <span class="Delimiter">}</span> <span id="L91" class="LineNr"> 91 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_number<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="Delimiter">{</span> -<span id="L92" class="LineNr"> 92 </span> <a href='003trace.cc.html#L196'>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">"'subtract' should yield a number, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L92" class="LineNr"> 92 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'subtract' should yield a number, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L93" class="LineNr"> 93 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L94" class="LineNr"> 94 </span> <span class="Delimiter">}</span> <span id="L95" class="LineNr"> 95 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -189,21 +191,21 @@ if ('onhashchange' in window) { <span id="L127" class="LineNr">127 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L128" class="LineNr">128 </span>MULTIPLY<span class="Delimiter">,</span> <span id="L129" class="LineNr">129 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L130" class="LineNr">130 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"multiply"</span><span class="Delimiter">,</span> MULTIPLY<span class="Delimiter">);</span> +<span id="L130" class="LineNr">130 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"multiply"</span><span class="Delimiter">,</span> MULTIPLY<span class="Delimiter">);</span> <span id="L131" class="LineNr">131 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L132" class="LineNr">132 </span><span class="Normal">case</span> MULTIPLY: <span class="Delimiter">{</span> <span id="L133" class="LineNr">133 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L134" class="LineNr">134 </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>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L135" class="LineNr">135 </span> <a href='003trace.cc.html#L196'>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">"'multiply' requires number ingredients, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L135" class="LineNr">135 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'multiply' requires number ingredients, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L136" class="LineNr">136 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L137" class="LineNr">137 </span> <span class="Delimiter">}</span> <span id="L138" class="LineNr">138 </span> <span class="Delimiter">}</span> <span id="L139" class="LineNr">139 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L140" class="LineNr">140 </span> <a href='003trace.cc.html#L196'>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">"'multiply' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L140" class="LineNr">140 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'multiply' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L141" class="LineNr">141 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L142" class="LineNr">142 </span> <span class="Delimiter">}</span> <span id="L143" class="LineNr">143 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_number<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="Delimiter">{</span> -<span id="L144" class="LineNr">144 </span> <a href='003trace.cc.html#L196'>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">"'multiply' should yield a number, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L144" class="LineNr">144 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'multiply' should yield a number, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L145" class="LineNr">145 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L146" class="LineNr">146 </span> <span class="Delimiter">}</span> <span id="L147" class="LineNr">147 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -242,25 +244,25 @@ if ('onhashchange' in window) { <span id="L180" class="LineNr">180 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L181" class="LineNr">181 </span>DIVIDE<span class="Delimiter">,</span> <span id="L182" class="LineNr">182 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L183" class="LineNr">183 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"divide"</span><span class="Delimiter">,</span> DIVIDE<span class="Delimiter">);</span> +<span id="L183" class="LineNr">183 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"divide"</span><span class="Delimiter">,</span> DIVIDE<span class="Delimiter">);</span> <span id="L184" class="LineNr">184 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L185" class="LineNr">185 </span><span class="Normal">case</span> DIVIDE: <span class="Delimiter">{</span> <span id="L186" class="LineNr">186 </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="L187" class="LineNr">187 </span> <a href='003trace.cc.html#L196'>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">"'divide' has no ingredients</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L187" class="LineNr">187 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'divide' has no ingredients\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L188" class="LineNr">188 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L189" class="LineNr">189 </span> <span class="Delimiter">}</span> <span id="L190" class="LineNr">190 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L191" class="LineNr">191 </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>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L192" class="LineNr">192 </span> <a href='003trace.cc.html#L196'>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">"'divide' requires number ingredients, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L192" class="LineNr">192 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'divide' requires number ingredients, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L193" class="LineNr">193 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L194" class="LineNr">194 </span> <span class="Delimiter">}</span> <span id="L195" class="LineNr">195 </span> <span class="Delimiter">}</span> <span id="L196" class="LineNr">196 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L197" class="LineNr">197 </span> <a href='003trace.cc.html#L196'>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">"'divide' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L197" class="LineNr">197 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'divide' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L198" class="LineNr">198 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L199" class="LineNr">199 </span> <span class="Delimiter">}</span> <span id="L200" class="LineNr">200 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_number<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="Delimiter">{</span> -<span id="L201" class="LineNr">201 </span> <a href='003trace.cc.html#L196'>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">"'divide' should yield a number, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L201" class="LineNr">201 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'divide' should yield a number, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L202" class="LineNr">202 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L203" class="LineNr">203 </span> <span class="Delimiter">}</span> <span id="L204" class="LineNr">204 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -300,24 +302,24 @@ if ('onhashchange' in window) { <span id="L238" class="LineNr">238 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L239" class="LineNr">239 </span>DIVIDE_WITH_REMAINDER<span class="Delimiter">,</span> <span id="L240" class="LineNr">240 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L241" class="LineNr">241 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"divide-with-remainder"</span><span class="Delimiter">,</span> DIVIDE_WITH_REMAINDER<span class="Delimiter">);</span> +<span id="L241" class="LineNr">241 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"divide-with-remainder"</span><span class="Delimiter">,</span> DIVIDE_WITH_REMAINDER<span class="Delimiter">);</span> <span id="L242" class="LineNr">242 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L243" class="LineNr">243 </span><span class="Normal">case</span> DIVIDE_WITH_REMAINDER: <span class="Delimiter">{</span> <span id="L244" class="LineNr">244 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L245" class="LineNr">245 </span> <a href='003trace.cc.html#L196'>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">"'divide-with-remainder' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L245" class="LineNr">245 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'divide-with-remainder' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L246" class="LineNr">246 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L247" class="LineNr">247 </span> <span class="Delimiter">}</span> <span id="L248" class="LineNr">248 </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> || !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="L249" class="LineNr">249 </span> <a href='003trace.cc.html#L196'>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">"'divide-with-remainder' requires number ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L249" class="LineNr">249 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'divide-with-remainder' requires number ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L250" class="LineNr">250 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L251" class="LineNr">251 </span> <span class="Delimiter">}</span> <span id="L252" class="LineNr">252 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">2</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L253" class="LineNr">253 </span> <a href='003trace.cc.html#L196'>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">"'divide-with-remainder' yields two products in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L253" class="LineNr">253 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'divide-with-remainder' yields two products in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L254" class="LineNr">254 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L255" class="LineNr">255 </span> <span class="Delimiter">}</span> <span id="L256" class="LineNr">256 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L257" class="LineNr">257 </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> && !is_mu_number<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="L258" class="LineNr">258 </span> <a href='003trace.cc.html#L196'>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">"'divide-with-remainder' should yield a number, but got '"</span> << inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L258" class="LineNr">258 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'divide-with-remainder' should yield a number, but got '"</span> << inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L259" class="LineNr">259 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L260" class="LineNr">260 </span> <span class="Delimiter">}</span> <span id="L261" class="LineNr">261 </span> <span class="Delimiter">}</span> @@ -330,7 +332,7 @@ if ('onhashchange' in window) { <span id="L268" class="LineNr">268 </span> <span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> a = <span class="Normal">static_cast</span><<span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span>><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="L269" class="LineNr">269 </span> <span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> b = <span class="Normal">static_cast</span><<span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span>><span class="Delimiter">(</span>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="L270" class="LineNr">270 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>b == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L271" class="LineNr">271 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"divide by zero in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L271" class="LineNr">271 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"divide by zero in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L272" class="LineNr">272 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span> <span id="L273" class="LineNr">273 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L274" class="LineNr">274 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> @@ -384,23 +386,23 @@ if ('onhashchange' in window) { <span id="L322" class="LineNr">322 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L323" class="LineNr">323 </span>SHIFT_LEFT<span class="Delimiter">,</span> <span id="L324" class="LineNr">324 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L325" class="LineNr">325 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"shift-left"</span><span class="Delimiter">,</span> SHIFT_LEFT<span class="Delimiter">);</span> +<span id="L325" class="LineNr">325 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"shift-left"</span><span class="Delimiter">,</span> SHIFT_LEFT<span class="Delimiter">);</span> <span id="L326" class="LineNr">326 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L327" class="LineNr">327 </span><span class="Normal">case</span> SHIFT_LEFT: <span class="Delimiter">{</span> <span id="L328" class="LineNr">328 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L329" class="LineNr">329 </span> <a href='003trace.cc.html#L196'>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">"'shift-left' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L329" class="LineNr">329 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'shift-left' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L330" class="LineNr">330 </span> <span class="Identifier">break</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>!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> || !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="L333" class="LineNr">333 </span> <a href='003trace.cc.html#L196'>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">"'shift-left' requires number ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L333" class="LineNr">333 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'shift-left' requires number ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L334" class="LineNr">334 </span> <span class="Identifier">break</span><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><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L337" class="LineNr">337 </span> <a href='003trace.cc.html#L196'>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">"'shift-left' yields one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L337" class="LineNr">337 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'shift-left' yields one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L338" class="LineNr">338 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L339" class="LineNr">339 </span> <span class="Delimiter">}</span> <span id="L340" class="LineNr">340 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_number<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="Delimiter">{</span> -<span id="L341" class="LineNr">341 </span> <a href='003trace.cc.html#L196'>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">"'shift-left' should yield a number, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L341" class="LineNr">341 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'shift-left' should yield a number, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L342" class="LineNr">342 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L343" class="LineNr">343 </span> <span class="Delimiter">}</span> <span id="L344" class="LineNr">344 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -412,7 +414,7 @@ if ('onhashchange' in window) { <span id="L350" class="LineNr">350 </span> <span class="Normal">int</span> b = <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span>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="L351" class="LineNr">351 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L352" class="LineNr">352 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>b < <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L353" class="LineNr">353 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"second ingredient can't be negative in '"</span> << to_original_string<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L353" class="LineNr">353 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"second ingredient can't be negative in '"</span> << to_original_string<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L354" class="LineNr">354 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L355" class="LineNr">355 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L356" class="LineNr">356 </span> <span class="Delimiter">}</span> @@ -455,23 +457,23 @@ if ('onhashchange' in window) { <span id="L393" class="LineNr">393 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L394" class="LineNr">394 </span>SHIFT_RIGHT<span class="Delimiter">,</span> <span id="L395" class="LineNr">395 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L396" class="LineNr">396 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"shift-right"</span><span class="Delimiter">,</span> SHIFT_RIGHT<span class="Delimiter">);</span> +<span id="L396" class="LineNr">396 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"shift-right"</span><span class="Delimiter">,</span> SHIFT_RIGHT<span class="Delimiter">);</span> <span id="L397" class="LineNr">397 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L398" class="LineNr">398 </span><span class="Normal">case</span> SHIFT_RIGHT: <span class="Delimiter">{</span> <span id="L399" class="LineNr">399 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L400" class="LineNr">400 </span> <a href='003trace.cc.html#L196'>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">"'shift-right' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L400" class="LineNr">400 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'shift-right' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L401" class="LineNr">401 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L402" class="LineNr">402 </span> <span class="Delimiter">}</span> <span id="L403" class="LineNr">403 </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> || !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="L404" class="LineNr">404 </span> <a href='003trace.cc.html#L196'>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">"'shift-right' requires number ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L404" class="LineNr">404 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'shift-right' requires number ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L405" class="LineNr">405 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L406" class="LineNr">406 </span> <span class="Delimiter">}</span> <span id="L407" class="LineNr">407 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L408" class="LineNr">408 </span> <a href='003trace.cc.html#L196'>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">"'shift-right' yields one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L408" class="LineNr">408 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'shift-right' yields one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L409" class="LineNr">409 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L410" class="LineNr">410 </span> <span class="Delimiter">}</span> <span id="L411" class="LineNr">411 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_number<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="Delimiter">{</span> -<span id="L412" class="LineNr">412 </span> <a href='003trace.cc.html#L196'>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">"'shift-right' should yield a number, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L412" class="LineNr">412 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'shift-right' should yield a number, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L413" class="LineNr">413 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L414" class="LineNr">414 </span> <span class="Delimiter">}</span> <span id="L415" class="LineNr">415 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -483,7 +485,7 @@ if ('onhashchange' in window) { <span id="L421" class="LineNr">421 </span> <span class="Normal">int</span> b = <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span>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="L422" class="LineNr">422 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L423" class="LineNr">423 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>b < <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L424" class="LineNr">424 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"second ingredient can't be negative in '"</span> << to_original_string<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L424" class="LineNr">424 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"second ingredient can't be negative in '"</span> << to_original_string<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L425" class="LineNr">425 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L426" class="LineNr">426 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L427" class="LineNr">427 </span> <span class="Delimiter">}</span> @@ -526,23 +528,23 @@ if ('onhashchange' in window) { <span id="L464" class="LineNr">464 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L465" class="LineNr">465 </span>AND_BITS<span class="Delimiter">,</span> <span id="L466" class="LineNr">466 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L467" class="LineNr">467 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"and-bits"</span><span class="Delimiter">,</span> AND_BITS<span class="Delimiter">);</span> +<span id="L467" class="LineNr">467 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"and-bits"</span><span class="Delimiter">,</span> AND_BITS<span class="Delimiter">);</span> <span id="L468" class="LineNr">468 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L469" class="LineNr">469 </span><span class="Normal">case</span> AND_BITS: <span class="Delimiter">{</span> <span id="L470" class="LineNr">470 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L471" class="LineNr">471 </span> <a href='003trace.cc.html#L196'>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">"'and-bits' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L471" class="LineNr">471 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'and-bits' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L472" class="LineNr">472 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L473" class="LineNr">473 </span> <span class="Delimiter">}</span> <span id="L474" class="LineNr">474 </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> || !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="L475" class="LineNr">475 </span> <a href='003trace.cc.html#L196'>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">"'and-bits' requires number ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L475" class="LineNr">475 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'and-bits' requires number ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L476" class="LineNr">476 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L477" class="LineNr">477 </span> <span class="Delimiter">}</span> <span id="L478" class="LineNr">478 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L479" class="LineNr">479 </span> <a href='003trace.cc.html#L196'>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">"'and-bits' yields one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L479" class="LineNr">479 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'and-bits' yields one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L480" class="LineNr">480 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L481" class="LineNr">481 </span> <span class="Delimiter">}</span> <span id="L482" class="LineNr">482 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_number<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="Delimiter">{</span> -<span id="L483" class="LineNr">483 </span> <a href='003trace.cc.html#L196'>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">"'and-bits' should yield a number, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L483" class="LineNr">483 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'and-bits' should yield a number, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L484" class="LineNr">484 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L485" class="LineNr">485 </span> <span class="Delimiter">}</span> <span id="L486" class="LineNr">486 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -584,23 +586,23 @@ if ('onhashchange' in window) { <span id="L522" class="LineNr">522 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L523" class="LineNr">523 </span>OR_BITS<span class="Delimiter">,</span> <span id="L524" class="LineNr">524 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L525" class="LineNr">525 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"or-bits"</span><span class="Delimiter">,</span> OR_BITS<span class="Delimiter">);</span> +<span id="L525" class="LineNr">525 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"or-bits"</span><span class="Delimiter">,</span> OR_BITS<span class="Delimiter">);</span> <span id="L526" class="LineNr">526 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L527" class="LineNr">527 </span><span class="Normal">case</span> OR_BITS: <span class="Delimiter">{</span> <span id="L528" class="LineNr">528 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L529" class="LineNr">529 </span> <a href='003trace.cc.html#L196'>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">"'or-bits' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L529" class="LineNr">529 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'or-bits' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L530" class="LineNr">530 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L531" class="LineNr">531 </span> <span class="Delimiter">}</span> <span id="L532" class="LineNr">532 </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> || !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="L533" class="LineNr">533 </span> <a href='003trace.cc.html#L196'>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">"'or-bits' requires number ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L533" class="LineNr">533 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'or-bits' requires number ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L534" class="LineNr">534 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L535" class="LineNr">535 </span> <span class="Delimiter">}</span> <span id="L536" class="LineNr">536 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L537" class="LineNr">537 </span> <a href='003trace.cc.html#L196'>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">"'or-bits' yields one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L537" class="LineNr">537 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'or-bits' yields one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L538" class="LineNr">538 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L539" class="LineNr">539 </span> <span class="Delimiter">}</span> <span id="L540" class="LineNr">540 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_number<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="Delimiter">{</span> -<span id="L541" class="LineNr">541 </span> <a href='003trace.cc.html#L196'>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">"'or-bits' should yield a number, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L541" class="LineNr">541 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'or-bits' should yield a number, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L542" class="LineNr">542 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L543" class="LineNr">543 </span> <span class="Delimiter">}</span> <span id="L544" class="LineNr">544 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -636,23 +638,23 @@ if ('onhashchange' in window) { <span id="L574" class="LineNr">574 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L575" class="LineNr">575 </span>XOR_BITS<span class="Delimiter">,</span> <span id="L576" class="LineNr">576 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L577" class="LineNr">577 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"xor-bits"</span><span class="Delimiter">,</span> XOR_BITS<span class="Delimiter">);</span> +<span id="L577" class="LineNr">577 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"xor-bits"</span><span class="Delimiter">,</span> XOR_BITS<span class="Delimiter">);</span> <span id="L578" class="LineNr">578 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L579" class="LineNr">579 </span><span class="Normal">case</span> XOR_BITS: <span class="Delimiter">{</span> <span id="L580" class="LineNr">580 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L581" class="LineNr">581 </span> <a href='003trace.cc.html#L196'>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">"'xor-bits' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L581" class="LineNr">581 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'xor-bits' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L582" class="LineNr">582 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L583" class="LineNr">583 </span> <span class="Delimiter">}</span> <span id="L584" class="LineNr">584 </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> || !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="L585" class="LineNr">585 </span> <a href='003trace.cc.html#L196'>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">"'xor-bits' requires number ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L585" class="LineNr">585 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'xor-bits' requires number ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L586" class="LineNr">586 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L587" class="LineNr">587 </span> <span class="Delimiter">}</span> <span id="L588" class="LineNr">588 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L589" class="LineNr">589 </span> <a href='003trace.cc.html#L196'>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">"'xor-bits' yields one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L589" class="LineNr">589 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'xor-bits' yields one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L590" class="LineNr">590 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L591" class="LineNr">591 </span> <span class="Delimiter">}</span> <span id="L592" class="LineNr">592 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_number<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="Delimiter">{</span> -<span id="L593" class="LineNr">593 </span> <a href='003trace.cc.html#L196'>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">"'xor-bits' should yield a number, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L593" class="LineNr">593 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'xor-bits' should yield a number, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L594" class="LineNr">594 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L595" class="LineNr">595 </span> <span class="Delimiter">}</span> <span id="L596" class="LineNr">596 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -688,23 +690,23 @@ if ('onhashchange' in window) { <span id="L626" class="LineNr">626 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L627" class="LineNr">627 </span>FLIP_BITS<span class="Delimiter">,</span> <span id="L628" class="LineNr">628 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L629" class="LineNr">629 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"flip-bits"</span><span class="Delimiter">,</span> FLIP_BITS<span class="Delimiter">);</span> +<span id="L629" class="LineNr">629 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"flip-bits"</span><span class="Delimiter">,</span> FLIP_BITS<span class="Delimiter">);</span> <span id="L630" class="LineNr">630 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L631" class="LineNr">631 </span><span class="Normal">case</span> FLIP_BITS: <span class="Delimiter">{</span> <span id="L632" class="LineNr">632 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L633" class="LineNr">633 </span> <a href='003trace.cc.html#L196'>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">"'flip-bits' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L633" class="LineNr">633 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'flip-bits' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L634" class="LineNr">634 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L635" class="LineNr">635 </span> <span class="Delimiter">}</span> <span id="L636" class="LineNr">636 </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="L637" class="LineNr">637 </span> <a href='003trace.cc.html#L196'>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">"'flip-bits' requires a number ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L637" class="LineNr">637 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'flip-bits' requires a number ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L638" class="LineNr">638 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L639" class="LineNr">639 </span> <span class="Delimiter">}</span> <span id="L640" class="LineNr">640 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L641" class="LineNr">641 </span> <a href='003trace.cc.html#L196'>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">"'flip-bits' yields one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L641" class="LineNr">641 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'flip-bits' yields one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L642" class="LineNr">642 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L643" class="LineNr">643 </span> <span class="Delimiter">}</span> <span id="L644" class="LineNr">644 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_number<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="Delimiter">{</span> -<span id="L645" class="LineNr">645 </span> <a href='003trace.cc.html#L196'>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">"'flip-bits' should yield a number, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L645" class="LineNr">645 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'flip-bits' should yield a number, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L646" class="LineNr">646 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L647" class="LineNr">647 </span> <span class="Delimiter">}</span> <span id="L648" class="LineNr">648 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -745,15 +747,15 @@ if ('onhashchange' in window) { <span id="L683" class="LineNr">683 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L684" class="LineNr">684 </span>ROUND<span class="Delimiter">,</span> <span id="L685" class="LineNr">685 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L686" class="LineNr">686 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"round"</span><span class="Delimiter">,</span> ROUND<span class="Delimiter">);</span> +<span id="L686" class="LineNr">686 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"round"</span><span class="Delimiter">,</span> ROUND<span class="Delimiter">);</span> <span id="L687" class="LineNr">687 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L688" class="LineNr">688 </span><span class="Normal">case</span> ROUND: <span class="Delimiter">{</span> <span id="L689" class="LineNr">689 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L690" class="LineNr">690 </span> <a href='003trace.cc.html#L196'>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">"'round' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L690" class="LineNr">690 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'round' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L691" class="LineNr">691 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L692" class="LineNr">692 </span> <span class="Delimiter">}</span> <span id="L693" class="LineNr">693 </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="L694" class="LineNr">694 </span> <a href='003trace.cc.html#L196'>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 'round' should be a number, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L694" class="LineNr">694 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'round' should be a number, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L695" class="LineNr">695 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L696" class="LineNr">696 </span> <span class="Delimiter">}</span> <span id="L697" class="LineNr">697 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -786,15 +788,15 @@ if ('onhashchange' in window) { <span id="L724" class="LineNr">724 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L725" class="LineNr">725 </span>TRUNCATE<span class="Delimiter">,</span> <span id="L726" class="LineNr">726 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L727" class="LineNr">727 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"truncate"</span><span class="Delimiter">,</span> TRUNCATE<span class="Delimiter">);</span> +<span id="L727" class="LineNr">727 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"truncate"</span><span class="Delimiter">,</span> TRUNCATE<span class="Delimiter">);</span> <span id="L728" class="LineNr">728 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L729" class="LineNr">729 </span><span class="Normal">case</span> TRUNCATE: <span class="Delimiter">{</span> <span id="L730" class="LineNr">730 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L731" class="LineNr">731 </span> <a href='003trace.cc.html#L196'>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">"'truncate' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L731" class="LineNr">731 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'truncate' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L732" class="LineNr">732 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L733" class="LineNr">733 </span> <span class="Delimiter">}</span> <span id="L734" class="LineNr">734 </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="L735" class="LineNr">735 </span> <a href='003trace.cc.html#L196'>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 'truncate' should be a number, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L735" class="LineNr">735 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'truncate' should be a number, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L736" class="LineNr">736 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L737" class="LineNr">737 </span> <span class="Delimiter">}</span> <span id="L738" class="LineNr">738 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -821,15 +823,15 @@ if ('onhashchange' in window) { <span id="L759" class="LineNr">759 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L760" class="LineNr">760 </span>SQUARE_ROOT<span class="Delimiter">,</span> <span id="L761" class="LineNr">761 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L762" class="LineNr">762 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"square-root"</span><span class="Delimiter">,</span> SQUARE_ROOT<span class="Delimiter">);</span> +<span id="L762" class="LineNr">762 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"square-root"</span><span class="Delimiter">,</span> SQUARE_ROOT<span class="Delimiter">);</span> <span id="L763" class="LineNr">763 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L764" class="LineNr">764 </span><span class="Normal">case</span> SQUARE_ROOT: <span class="Delimiter">{</span> <span id="L765" class="LineNr">765 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L766" class="LineNr">766 </span> <a href='003trace.cc.html#L196'>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">"'square-root' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L766" class="LineNr">766 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'square-root' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L767" class="LineNr">767 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L768" class="LineNr">768 </span> <span class="Delimiter">}</span> <span id="L769" class="LineNr">769 </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="L770" class="LineNr">770 </span> <a href='003trace.cc.html#L196'>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 'square-root' should be a number, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L770" class="LineNr">770 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'square-root' should be a number, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L771" class="LineNr">771 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L772" class="LineNr">772 </span> <span class="Delimiter">}</span> <span id="L773" class="LineNr">773 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -844,23 +846,23 @@ if ('onhashchange' in window) { <span id="L782" class="LineNr">782 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L783" class="LineNr">783 </span>CHARACTER_TO_CODE<span class="Delimiter">,</span> <span id="L784" class="LineNr">784 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L785" class="LineNr">785 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"character-to-code"</span><span class="Delimiter">,</span> CHARACTER_TO_CODE<span class="Delimiter">);</span> +<span id="L785" class="LineNr">785 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"character-to-code"</span><span class="Delimiter">,</span> CHARACTER_TO_CODE<span class="Delimiter">);</span> <span id="L786" class="LineNr">786 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L787" class="LineNr">787 </span><span class="Normal">case</span> CHARACTER_TO_CODE: <span class="Delimiter">{</span> <span id="L788" class="LineNr">788 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L789" class="LineNr">789 </span> <a href='003trace.cc.html#L196'>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">"'character-to-code' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L789" class="LineNr">789 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'character-to-code' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L790" class="LineNr">790 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L791" class="LineNr">791 </span> <span class="Delimiter">}</span> <span id="L792" class="LineNr">792 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_character<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="L793" class="LineNr">793 </span> <a href='003trace.cc.html#L196'>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 'character-to-code' should be a character, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L793" class="LineNr">793 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'character-to-code' should be a character, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L794" class="LineNr">794 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L795" class="LineNr">795 </span> <span class="Delimiter">}</span> <span id="L796" class="LineNr">796 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L797" class="LineNr">797 </span> <a href='003trace.cc.html#L196'>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">"'character-to-code' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L797" class="LineNr">797 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'character-to-code' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L798" class="LineNr">798 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L799" class="LineNr">799 </span> <span class="Delimiter">}</span> <span id="L800" class="LineNr">800 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_number<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="Delimiter">{</span> -<span id="L801" class="LineNr">801 </span> <a href='003trace.cc.html#L196'>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 product of 'character-to-code' should be a number, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L801" class="LineNr">801 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first product of 'character-to-code' should be a number, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L802" class="LineNr">802 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L803" class="LineNr">803 </span> <span class="Delimiter">}</span> <span id="L804" class="LineNr">804 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> diff --git a/html/023boolean.cc.html b/html/023boolean.cc.html index bda78f0c..1f73953a 100644 --- a/html/023boolean.cc.html +++ b/html/023boolean.cc.html @@ -11,21 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.traceContains { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.cSpecial { color: #008000; } +.Comment { color: #8080ff; } +.traceContains { color: #008000; } --> </style> @@ -59,27 +60,28 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/023boolean.cc'>https://github.com/akkartik/mu/blob/master/023boolean.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Boolean primitives</span> <span id="L2" class="LineNr"> 2 </span> <span id="L3" class="LineNr"> 3 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L4" class="LineNr"> 4 </span>AND<span class="Delimiter">,</span> <span id="L5" class="LineNr"> 5 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L6" class="LineNr"> 6 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"and"</span><span class="Delimiter">,</span> AND<span class="Delimiter">);</span> +<span id="L6" class="LineNr"> 6 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"and"</span><span class="Delimiter">,</span> AND<span class="Delimiter">);</span> <span id="L7" class="LineNr"> 7 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L8" class="LineNr"> 8 </span><span class="Normal">case</span> AND: <span class="Delimiter">{</span> <span id="L9" class="LineNr"> 9 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L10" class="LineNr"> 10 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_scalar<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="L11" class="LineNr"> 11 </span> <a href='003trace.cc.html#L196'>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">"'and' requires boolean ingredients, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L11" class="LineNr"> 11 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'and' requires boolean ingredients, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L12" class="LineNr"> 12 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L13" class="LineNr"> 13 </span> <span class="Delimiter">}</span> <span id="L14" class="LineNr"> 14 </span> <span class="Delimiter">}</span> <span id="L15" class="LineNr"> 15 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L16" class="LineNr"> 16 </span> <a href='003trace.cc.html#L196'>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">"'and' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L16" class="LineNr"> 16 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'and' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L17" class="LineNr"> 17 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L18" class="LineNr"> 18 </span> <span class="Delimiter">}</span> <span id="L19" class="LineNr"> 19 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_boolean<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="Delimiter">{</span> -<span id="L20" class="LineNr"> 20 </span> <a href='003trace.cc.html#L196'>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">"'and' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L20" class="LineNr"> 20 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'and' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L21" class="LineNr"> 21 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L22" class="LineNr"> 22 </span> <span class="Delimiter">}</span> <span id="L23" class="LineNr"> 23 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -129,21 +131,21 @@ if ('onhashchange' in window) { <span id="L67" class="LineNr"> 67 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L68" class="LineNr"> 68 </span>OR<span class="Delimiter">,</span> <span id="L69" class="LineNr"> 69 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L70" class="LineNr"> 70 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"or"</span><span class="Delimiter">,</span> OR<span class="Delimiter">);</span> +<span id="L70" class="LineNr"> 70 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"or"</span><span class="Delimiter">,</span> OR<span class="Delimiter">);</span> <span id="L71" class="LineNr"> 71 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L72" class="LineNr"> 72 </span><span class="Normal">case</span> OR: <span class="Delimiter">{</span> <span id="L73" class="LineNr"> 73 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L74" class="LineNr"> 74 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_scalar<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="L75" class="LineNr"> 75 </span> <a href='003trace.cc.html#L196'>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">"'and' requires boolean ingredients, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L75" class="LineNr"> 75 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'and' requires boolean ingredients, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L76" class="LineNr"> 76 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L77" class="LineNr"> 77 </span> <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">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L80" class="LineNr"> 80 </span> <a href='003trace.cc.html#L196'>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">"'or' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L80" class="LineNr"> 80 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'or' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L81" class="LineNr"> 81 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L82" class="LineNr"> 82 </span> <span class="Delimiter">}</span> <span id="L83" class="LineNr"> 83 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_boolean<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="Delimiter">{</span> -<span id="L84" class="LineNr"> 84 </span> <a href='003trace.cc.html#L196'>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">"'or' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L84" class="LineNr"> 84 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'or' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L85" class="LineNr"> 85 </span> <span class="Identifier">break</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">break</span><span class="Delimiter">;</span> @@ -187,23 +189,23 @@ if ('onhashchange' in window) { <span id="L125" class="LineNr">125 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L126" class="LineNr">126 </span>NOT<span class="Delimiter">,</span> <span id="L127" class="LineNr">127 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L128" class="LineNr">128 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"not"</span><span class="Delimiter">,</span> NOT<span class="Delimiter">);</span> +<span id="L128" class="LineNr">128 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"not"</span><span class="Delimiter">,</span> NOT<span class="Delimiter">);</span> <span id="L129" class="LineNr">129 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L130" class="LineNr">130 </span><span class="Normal">case</span> NOT: <span class="Delimiter">{</span> <span id="L131" class="LineNr">131 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> != <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L132" class="LineNr">132 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"ingredients and products should match in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L132" class="LineNr">132 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"ingredients and products should match in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L133" class="LineNr">133 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L134" class="LineNr">134 </span> <span class="Delimiter">}</span> <span id="L135" class="LineNr">135 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L136" class="LineNr">136 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_scalar<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> && !is_mu_address<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="L137" class="LineNr">137 </span> <a href='003trace.cc.html#L196'>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">"'not' requires ingredients that can be interpreted as boolean, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L137" class="LineNr">137 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'not' requires ingredients that can be interpreted as boolean, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L138" class="LineNr">138 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L139" class="LineNr">139 </span> <span class="Delimiter">}</span> <span id="L140" class="LineNr">140 </span> <span class="Delimiter">}</span> <span id="L141" class="LineNr">141 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L142" class="LineNr">142 </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="L143" class="LineNr">143 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_boolean<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="L144" class="LineNr">144 </span> <a href='003trace.cc.html#L196'>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">"'not' should yield a boolean, but got '"</span> << inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L144" class="LineNr">144 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'not' should yield a boolean, but got '"</span> << inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L145" class="LineNr">145 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L146" class="LineNr">146 </span> <span class="Delimiter">}</span> <span id="L147" class="LineNr">147 </span> <span class="Delimiter">}</span> diff --git a/html/024jump.cc.html b/html/024jump.cc.html index ad24795d..a0ccdc06 100644 --- a/html/024jump.cc.html +++ b/html/024jump.cc.html @@ -11,21 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .traceAbsent { color: #c00000; } -.Identifier { color: #c0a020; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.cSpecial { color: #008000; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -60,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/024jump.cc'>https://github.com/akkartik/mu/blob/master/024jump.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Jump primitives</span> <span id="L2" class="LineNr"> 2 </span> @@ -75,19 +77,19 @@ if ('onhashchange' in window) { <span id="L12" class="LineNr"> 12 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L13" class="LineNr"> 13 </span>JUMP<span class="Delimiter">,</span> <span id="L14" class="LineNr"> 14 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L15" class="LineNr"> 15 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"jump"</span><span class="Delimiter">,</span> JUMP<span class="Delimiter">);</span> +<span id="L15" class="LineNr"> 15 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"jump"</span><span class="Delimiter">,</span> JUMP<span class="Delimiter">);</span> <span id="L16" class="LineNr"> 16 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L17" class="LineNr"> 17 </span><span class="Normal">case</span> JUMP: <span class="Delimiter">{</span> <span id="L18" class="LineNr"> 18 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L19" class="LineNr"> 19 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' should get exactly one ingredient</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L19" class="LineNr"> 19 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' should get exactly one ingredient\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L20" class="LineNr"> 20 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L21" class="LineNr"> 21 </span> <span class="Delimiter">}</span> <span id="L22" class="LineNr"> 22 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<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="L23" class="LineNr"> 23 </span> <a href='003trace.cc.html#L196'>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 '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' should be a label or offset, but '"</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>name << <span class="Constant">"' has type '"</span> << names_to_string_without_quotes<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>type<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L23" class="LineNr"> 23 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' should be a label or offset, but '"</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>name << <span class="Constant">"' has type '"</span> << names_to_string_without_quotes<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>type<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L24" class="LineNr"> 24 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L25" class="LineNr"> 25 </span> <span class="Delimiter">}</span> <span id="L26" class="LineNr"> 26 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L27" class="LineNr"> 27 </span> <a href='003trace.cc.html#L196'>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">"'jump' instructions write no products</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L27" class="LineNr"> 27 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'jump' instructions write no products\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L28" class="LineNr"> 28 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L29" class="LineNr"> 29 </span> <span class="Delimiter">}</span> <span id="L30" class="LineNr"> 30 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -105,7 +107,7 @@ if ('onhashchange' in window) { <span id="L42" class="LineNr"> 42 </span> <span id="L43" class="LineNr"> 43 </span><span class="Comment">//: special type to designate jump targets</span> <span id="L44" class="LineNr"> 44 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> -<span id="L45" class="LineNr"> 45 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"offset"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L45" class="LineNr"> 45 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"offset"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L46" class="LineNr"> 46 </span> <span id="L47" class="LineNr"> 47 </span><span class="Delimiter">:(scenario jump_backward)</span> <span id="L48" class="LineNr"> 48 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ @@ -128,23 +130,23 @@ if ('onhashchange' in window) { <span id="L65" class="LineNr"> 65 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L66" class="LineNr"> 66 </span>JUMP_IF<span class="Delimiter">,</span> <span id="L67" class="LineNr"> 67 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L68" class="LineNr"> 68 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"jump-if"</span><span class="Delimiter">,</span> JUMP_IF<span class="Delimiter">);</span> +<span id="L68" class="LineNr"> 68 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"jump-if"</span><span class="Delimiter">,</span> JUMP_IF<span class="Delimiter">);</span> <span id="L69" class="LineNr"> 69 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L70" class="LineNr"> 70 </span><span class="Normal">case</span> JUMP_IF: <span class="Delimiter">{</span> <span id="L71" class="LineNr"> 71 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L72" class="LineNr"> 72 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' should get exactly two ingredients</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L72" class="LineNr"> 72 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' should get exactly two ingredients\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L73" class="LineNr"> 73 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L74" class="LineNr"> 74 </span> <span class="Delimiter">}</span> <span id="L75" class="LineNr"> 75 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_address<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> && !is_mu_scalar<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="L76" class="LineNr"> 76 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' requires a boolean for its first ingredient, but '"</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>name << <span class="Constant">"' has type '"</span> << names_to_string_without_quotes<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>type<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L76" class="LineNr"> 76 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' requires a boolean for its first ingredient, but '"</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>name << <span class="Constant">"' has type '"</span> << names_to_string_without_quotes<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>type<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L77" class="LineNr"> 77 </span> <span class="Identifier">break</span><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">if</span> <span class="Delimiter">(</span>!is_literal<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="L80" class="LineNr"> 80 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' requires a label or offset for its second ingredient, but '"</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>name << <span class="Constant">"' has type '"</span> << names_to_string_without_quotes<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>type<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L80" class="LineNr"> 80 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' requires a label or offset for its second ingredient, but '"</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>name << <span class="Constant">"' has type '"</span> << names_to_string_without_quotes<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>type<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L81" class="LineNr"> 81 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L82" class="LineNr"> 82 </span> <span class="Delimiter">}</span> <span id="L83" class="LineNr"> 83 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L84" class="LineNr"> 84 </span> <a href='003trace.cc.html#L196'>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">"'jump-if' instructions write no products</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L84" class="LineNr"> 84 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'jump-if' instructions write no products\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L85" class="LineNr"> 85 </span> <span class="Identifier">break</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="Comment">// End JUMP_IF Checks</span> @@ -199,23 +201,23 @@ if ('onhashchange' in window) { <span id="L136" class="LineNr">136 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L137" class="LineNr">137 </span>JUMP_UNLESS<span class="Delimiter">,</span> <span id="L138" class="LineNr">138 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L139" class="LineNr">139 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"jump-unless"</span><span class="Delimiter">,</span> JUMP_UNLESS<span class="Delimiter">);</span> +<span id="L139" class="LineNr">139 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"jump-unless"</span><span class="Delimiter">,</span> JUMP_UNLESS<span class="Delimiter">);</span> <span id="L140" class="LineNr">140 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L141" class="LineNr">141 </span><span class="Normal">case</span> JUMP_UNLESS: <span class="Delimiter">{</span> <span id="L142" class="LineNr">142 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L143" class="LineNr">143 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' should get exactly two ingredients</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L143" class="LineNr">143 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' should get exactly two ingredients\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L144" class="LineNr">144 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L145" class="LineNr">145 </span> <span class="Delimiter">}</span> <span id="L146" class="LineNr">146 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_address<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> && !is_mu_scalar<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="L147" class="LineNr">147 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' requires a boolean for its first ingredient, but '"</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>name << <span class="Constant">"' has type '"</span> << names_to_string_without_quotes<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>type<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L147" class="LineNr">147 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' requires a boolean for its first ingredient, but '"</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>name << <span class="Constant">"' has type '"</span> << names_to_string_without_quotes<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>type<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L148" class="LineNr">148 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L149" class="LineNr">149 </span> <span class="Delimiter">}</span> <span id="L150" class="LineNr">150 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<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="L151" class="LineNr">151 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' requires a label or offset for its second ingredient, but '"</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>name << <span class="Constant">"' has type '"</span> << names_to_string_without_quotes<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>type<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L151" class="LineNr">151 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' requires a label or offset for its second ingredient, but '"</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>name << <span class="Constant">"' has type '"</span> << names_to_string_without_quotes<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>type<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L152" class="LineNr">152 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L153" class="LineNr">153 </span> <span class="Delimiter">}</span> <span id="L154" class="LineNr">154 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L155" class="LineNr">155 </span> <a href='003trace.cc.html#L196'>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">"'jump' instructions write no products</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L155" class="LineNr">155 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'jump' instructions write no products\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L156" class="LineNr">156 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L157" class="LineNr">157 </span> <span class="Delimiter">}</span> <span id="L158" class="LineNr">158 </span> <span class="Comment">// End JUMP_UNLESS Checks</span> diff --git a/html/025compare.cc.html b/html/025compare.cc.html index ad8faf47..14586345 100644 --- a/html/025compare.cc.html +++ b/html/025compare.cc.html @@ -11,21 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.traceContains { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.cSpecial { color: #008000; } +.Comment { color: #8080ff; } +.traceContains { color: #008000; } --> </style> @@ -59,32 +60,33 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/025compare.cc'>https://github.com/akkartik/mu/blob/master/025compare.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Comparison primitives</span> <span id="L2" class="LineNr"> 2 </span> <span id="L3" class="LineNr"> 3 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L4" class="LineNr"> 4 </span>EQUAL<span class="Delimiter">,</span> <span id="L5" class="LineNr"> 5 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L6" class="LineNr"> 6 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"equal"</span><span class="Delimiter">,</span> EQUAL<span class="Delimiter">);</span> +<span id="L6" class="LineNr"> 6 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"equal"</span><span class="Delimiter">,</span> EQUAL<span class="Delimiter">);</span> <span id="L7" class="LineNr"> 7 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L8" class="LineNr"> 8 </span><span class="Normal">case</span> EQUAL: <span class="Delimiter">{</span> <span id="L9" class="LineNr"> 9 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L10" class="LineNr"> 10 </span> <a href='003trace.cc.html#L196'>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">"'equal' needs at least two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L10" class="LineNr"> 10 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'equal' needs at least two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L11" class="LineNr"> 11 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L12" class="LineNr"> 12 </span> <span class="Delimiter">}</span> <span id="L13" class="LineNr"> 13 </span> <span class="Normal">const</span> reagent& exemplar = 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 id="L14" class="LineNr"> 14 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Comment">/*</span><span class="Comment">skip exemplar</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L15" class="LineNr"> 15 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_match<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> exemplar<span class="Delimiter">)</span> && !types_match<span class="Delimiter">(</span>exemplar<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="L16" class="LineNr"> 16 </span> <a href='003trace.cc.html#L196'>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">"'equal' expects ingredients to be all of the same type, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L16" class="LineNr"> 16 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'equal' expects ingredients to be all of the same type, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L17" class="LineNr"> 17 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L18" class="LineNr"> 18 </span> <span class="Delimiter">}</span> <span id="L19" class="LineNr"> 19 </span> <span class="Delimiter">}</span> <span id="L20" class="LineNr"> 20 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L21" class="LineNr"> 21 </span> <a href='003trace.cc.html#L196'>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">"'equal' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L21" class="LineNr"> 21 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'equal' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L22" class="LineNr"> 22 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L23" class="LineNr"> 23 </span> <span class="Delimiter">}</span> <span id="L24" class="LineNr"> 24 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_boolean<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="Delimiter">{</span> -<span id="L25" class="LineNr"> 25 </span> <a href='003trace.cc.html#L196'>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">"'equal' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L25" class="LineNr"> 25 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'equal' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L26" class="LineNr"> 26 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L27" class="LineNr"> 27 </span> <span class="Delimiter">}</span> <span id="L28" class="LineNr"> 28 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -143,24 +145,24 @@ if ('onhashchange' in window) { <span id="L81" class="LineNr"> 81 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L82" class="LineNr"> 82 </span>NOT_EQUAL<span class="Delimiter">,</span> <span id="L83" class="LineNr"> 83 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L84" class="LineNr"> 84 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"not-equal"</span><span class="Delimiter">,</span> NOT_EQUAL<span class="Delimiter">);</span> +<span id="L84" class="LineNr"> 84 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"not-equal"</span><span class="Delimiter">,</span> NOT_EQUAL<span class="Delimiter">);</span> <span id="L85" class="LineNr"> 85 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L86" class="LineNr"> 86 </span><span class="Normal">case</span> NOT_EQUAL: <span class="Delimiter">{</span> <span id="L87" class="LineNr"> 87 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L88" class="LineNr"> 88 </span> <a href='003trace.cc.html#L196'>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">"'equal' needs two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L88" class="LineNr"> 88 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'equal' needs two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L89" class="LineNr"> 89 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L90" class="LineNr"> 90 </span> <span class="Delimiter">}</span> <span id="L91" class="LineNr"> 91 </span> <span class="Normal">const</span> reagent& exemplar = 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 id="L92" class="LineNr"> 92 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_match<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> exemplar<span class="Delimiter">)</span> && !types_match<span class="Delimiter">(</span>exemplar<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="L93" class="LineNr"> 93 </span> <a href='003trace.cc.html#L196'>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">"'equal' expects ingredients to be all of the same type, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L93" class="LineNr"> 93 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'equal' expects ingredients to be all of the same type, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L94" class="LineNr"> 94 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L95" class="LineNr"> 95 </span> <span class="Delimiter">}</span> <span id="L96" class="LineNr"> 96 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L97" class="LineNr"> 97 </span> <a href='003trace.cc.html#L196'>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">"'equal' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L97" class="LineNr"> 97 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'equal' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L98" class="LineNr"> 98 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L99" class="LineNr"> 99 </span> <span class="Delimiter">}</span> <span id="L100" class="LineNr">100 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_boolean<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="Delimiter">{</span> -<span id="L101" class="LineNr">101 </span> <a href='003trace.cc.html#L196'>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">"'equal' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L101" class="LineNr">101 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'equal' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L102" class="LineNr">102 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L103" class="LineNr">103 </span> <span class="Delimiter">}</span> <span id="L104" class="LineNr">104 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -201,25 +203,25 @@ if ('onhashchange' in window) { <span id="L139" class="LineNr">139 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L140" class="LineNr">140 </span>GREATER_THAN<span class="Delimiter">,</span> <span id="L141" class="LineNr">141 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L142" class="LineNr">142 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"greater-than"</span><span class="Delimiter">,</span> GREATER_THAN<span class="Delimiter">);</span> +<span id="L142" class="LineNr">142 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"greater-than"</span><span class="Delimiter">,</span> GREATER_THAN<span class="Delimiter">);</span> <span id="L143" class="LineNr">143 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L144" class="LineNr">144 </span><span class="Normal">case</span> GREATER_THAN: <span class="Delimiter">{</span> <span id="L145" class="LineNr">145 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L146" class="LineNr">146 </span> <a href='003trace.cc.html#L196'>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">"'greater-than' needs at least two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L146" class="LineNr">146 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'greater-than' needs at least two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L147" class="LineNr">147 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L148" class="LineNr">148 </span> <span class="Delimiter">}</span> <span id="L149" class="LineNr">149 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L150" class="LineNr">150 </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>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L151" class="LineNr">151 </span> <a href='003trace.cc.html#L196'>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">"'greater-than' can only compare numbers; got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L151" class="LineNr">151 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'greater-than' can only compare numbers; got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L152" class="LineNr">152 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L153" class="LineNr">153 </span> <span class="Delimiter">}</span> <span id="L154" class="LineNr">154 </span> <span class="Delimiter">}</span> <span id="L155" class="LineNr">155 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L156" class="LineNr">156 </span> <a href='003trace.cc.html#L196'>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">"'greater-than' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L156" class="LineNr">156 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'greater-than' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L157" class="LineNr">157 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L158" class="LineNr">158 </span> <span class="Delimiter">}</span> <span id="L159" class="LineNr">159 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_boolean<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="Delimiter">{</span> -<span id="L160" class="LineNr">160 </span> <a href='003trace.cc.html#L196'>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">"'greater-than' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L160" class="LineNr">160 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'greater-than' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L161" class="LineNr">161 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L162" class="LineNr">162 </span> <span class="Delimiter">}</span> <span id="L163" class="LineNr">163 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -268,25 +270,25 @@ if ('onhashchange' in window) { <span id="L206" class="LineNr">206 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L207" class="LineNr">207 </span>LESSER_THAN<span class="Delimiter">,</span> <span id="L208" class="LineNr">208 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L209" class="LineNr">209 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"lesser-than"</span><span class="Delimiter">,</span> LESSER_THAN<span class="Delimiter">);</span> +<span id="L209" class="LineNr">209 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"lesser-than"</span><span class="Delimiter">,</span> LESSER_THAN<span class="Delimiter">);</span> <span id="L210" class="LineNr">210 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L211" class="LineNr">211 </span><span class="Normal">case</span> LESSER_THAN: <span class="Delimiter">{</span> <span id="L212" class="LineNr">212 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L213" class="LineNr">213 </span> <a href='003trace.cc.html#L196'>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">"'lesser-than' needs at least two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L213" class="LineNr">213 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'lesser-than' needs at least two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L214" class="LineNr">214 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L215" class="LineNr">215 </span> <span class="Delimiter">}</span> <span id="L216" class="LineNr">216 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L217" class="LineNr">217 </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>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L218" class="LineNr">218 </span> <a href='003trace.cc.html#L196'>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">"'lesser-than' can only compare numbers; got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L218" class="LineNr">218 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'lesser-than' can only compare numbers; got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L219" class="LineNr">219 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L220" class="LineNr">220 </span> <span class="Delimiter">}</span> <span id="L221" class="LineNr">221 </span> <span class="Delimiter">}</span> <span id="L222" class="LineNr">222 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L223" class="LineNr">223 </span> <a href='003trace.cc.html#L196'>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">"'lesser-than' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L223" class="LineNr">223 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'lesser-than' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L224" class="LineNr">224 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L225" class="LineNr">225 </span> <span class="Delimiter">}</span> <span id="L226" class="LineNr">226 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_boolean<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="Delimiter">{</span> -<span id="L227" class="LineNr">227 </span> <a href='003trace.cc.html#L196'>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">"'lesser-than' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L227" class="LineNr">227 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'lesser-than' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L228" class="LineNr">228 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L229" class="LineNr">229 </span> <span class="Delimiter">}</span> <span id="L230" class="LineNr">230 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -335,25 +337,25 @@ if ('onhashchange' in window) { <span id="L273" class="LineNr">273 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L274" class="LineNr">274 </span>GREATER_OR_EQUAL<span class="Delimiter">,</span> <span id="L275" class="LineNr">275 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L276" class="LineNr">276 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"greater-or-equal"</span><span class="Delimiter">,</span> GREATER_OR_EQUAL<span class="Delimiter">);</span> +<span id="L276" class="LineNr">276 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"greater-or-equal"</span><span class="Delimiter">,</span> GREATER_OR_EQUAL<span class="Delimiter">);</span> <span id="L277" class="LineNr">277 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L278" class="LineNr">278 </span><span class="Normal">case</span> GREATER_OR_EQUAL: <span class="Delimiter">{</span> <span id="L279" class="LineNr">279 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L280" class="LineNr">280 </span> <a href='003trace.cc.html#L196'>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">"'greater-or-equal' needs at least two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L280" class="LineNr">280 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'greater-or-equal' needs at least two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L281" class="LineNr">281 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L282" class="LineNr">282 </span> <span class="Delimiter">}</span> <span id="L283" class="LineNr">283 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L284" class="LineNr">284 </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>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L285" class="LineNr">285 </span> <a href='003trace.cc.html#L196'>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">"'greater-or-equal' can only compare numbers; got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L285" class="LineNr">285 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'greater-or-equal' can only compare numbers; got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L286" class="LineNr">286 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L287" class="LineNr">287 </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><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L290" class="LineNr">290 </span> <a href='003trace.cc.html#L196'>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">"'greater-or-equal' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L290" class="LineNr">290 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'greater-or-equal' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L291" class="LineNr">291 </span> <span class="Identifier">break</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>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_boolean<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="Delimiter">{</span> -<span id="L294" class="LineNr">294 </span> <a href='003trace.cc.html#L196'>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">"'greater-or-equal' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L294" class="LineNr">294 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'greater-or-equal' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L295" class="LineNr">295 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L296" class="LineNr">296 </span> <span class="Delimiter">}</span> <span id="L297" class="LineNr">297 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -410,25 +412,25 @@ if ('onhashchange' in window) { <span id="L348" class="LineNr">348 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L349" class="LineNr">349 </span>LESSER_OR_EQUAL<span class="Delimiter">,</span> <span id="L350" class="LineNr">350 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L351" class="LineNr">351 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"lesser-or-equal"</span><span class="Delimiter">,</span> LESSER_OR_EQUAL<span class="Delimiter">);</span> +<span id="L351" class="LineNr">351 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"lesser-or-equal"</span><span class="Delimiter">,</span> LESSER_OR_EQUAL<span class="Delimiter">);</span> <span id="L352" class="LineNr">352 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L353" class="LineNr">353 </span><span class="Normal">case</span> LESSER_OR_EQUAL: <span class="Delimiter">{</span> <span id="L354" class="LineNr">354 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L355" class="LineNr">355 </span> <a href='003trace.cc.html#L196'>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">"'lesser-or-equal' needs at least two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L355" class="LineNr">355 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'lesser-or-equal' needs at least two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L356" class="LineNr">356 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L357" class="LineNr">357 </span> <span class="Delimiter">}</span> <span id="L358" class="LineNr">358 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L359" class="LineNr">359 </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>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L360" class="LineNr">360 </span> <a href='003trace.cc.html#L196'>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">"'lesser-or-equal' can only compare numbers; got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L360" class="LineNr">360 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'lesser-or-equal' can only compare numbers; got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L361" class="LineNr">361 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L362" class="LineNr">362 </span> <span class="Delimiter">}</span> <span id="L363" class="LineNr">363 </span> <span class="Delimiter">}</span> <span id="L364" class="LineNr">364 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L365" class="LineNr">365 </span> <a href='003trace.cc.html#L196'>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">"'greater-or-equal' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L365" class="LineNr">365 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'greater-or-equal' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L366" class="LineNr">366 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L367" class="LineNr">367 </span> <span class="Delimiter">}</span> <span id="L368" class="LineNr">368 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_boolean<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="Delimiter">{</span> -<span id="L369" class="LineNr">369 </span> <a href='003trace.cc.html#L196'>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">"'greater-or-equal' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L369" class="LineNr">369 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'greater-or-equal' should yield a boolean, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L370" class="LineNr">370 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L371" class="LineNr">371 </span> <span class="Delimiter">}</span> <span id="L372" class="LineNr">372 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -485,25 +487,25 @@ if ('onhashchange' in window) { <span id="L423" class="LineNr">423 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L424" class="LineNr">424 </span>MAX<span class="Delimiter">,</span> <span id="L425" class="LineNr">425 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L426" class="LineNr">426 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"max"</span><span class="Delimiter">,</span> MAX<span class="Delimiter">);</span> +<span id="L426" class="LineNr">426 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"max"</span><span class="Delimiter">,</span> MAX<span class="Delimiter">);</span> <span id="L427" class="LineNr">427 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L428" class="LineNr">428 </span><span class="Normal">case</span> MAX: <span class="Delimiter">{</span> <span id="L429" class="LineNr">429 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L430" class="LineNr">430 </span> <a href='003trace.cc.html#L196'>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">"'max' needs at least two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L430" class="LineNr">430 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'max' needs at least two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L431" class="LineNr">431 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L432" class="LineNr">432 </span> <span class="Delimiter">}</span> <span id="L433" class="LineNr">433 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L434" class="LineNr">434 </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>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L435" class="LineNr">435 </span> <a href='003trace.cc.html#L196'>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">"'max' can only compare numbers; got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L435" class="LineNr">435 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'max' can only compare numbers; got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L436" class="LineNr">436 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L437" class="LineNr">437 </span> <span class="Delimiter">}</span> <span id="L438" class="LineNr">438 </span> <span class="Delimiter">}</span> <span id="L439" class="LineNr">439 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L440" class="LineNr">440 </span> <a href='003trace.cc.html#L196'>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">"'max' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L440" class="LineNr">440 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'max' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L441" class="LineNr">441 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L442" class="LineNr">442 </span> <span class="Delimiter">}</span> <span id="L443" class="LineNr">443 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_number<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="Delimiter">{</span> -<span id="L444" class="LineNr">444 </span> <a href='003trace.cc.html#L196'>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">"'max' should yield a number, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L444" class="LineNr">444 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'max' should yield a number, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L445" class="LineNr">445 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L446" class="LineNr">446 </span> <span class="Delimiter">}</span> <span id="L447" class="LineNr">447 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -524,25 +526,25 @@ if ('onhashchange' in window) { <span id="L462" class="LineNr">462 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L463" class="LineNr">463 </span>MIN<span class="Delimiter">,</span> <span id="L464" class="LineNr">464 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L465" class="LineNr">465 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"min"</span><span class="Delimiter">,</span> MIN<span class="Delimiter">);</span> +<span id="L465" class="LineNr">465 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"min"</span><span class="Delimiter">,</span> MIN<span class="Delimiter">);</span> <span id="L466" class="LineNr">466 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L467" class="LineNr">467 </span><span class="Normal">case</span> MIN: <span class="Delimiter">{</span> <span id="L468" class="LineNr">468 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L469" class="LineNr">469 </span> <a href='003trace.cc.html#L196'>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">"'min' needs at least two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L469" class="LineNr">469 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'min' needs at least two ingredients to compare in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L470" class="LineNr">470 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L471" class="LineNr">471 </span> <span class="Delimiter">}</span> <span id="L472" class="LineNr">472 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L473" class="LineNr">473 </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>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L474" class="LineNr">474 </span> <a href='003trace.cc.html#L196'>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">"'min' can only compare numbers; got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L474" class="LineNr">474 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'min' can only compare numbers; got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L475" class="LineNr">475 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L476" class="LineNr">476 </span> <span class="Delimiter">}</span> <span id="L477" class="LineNr">477 </span> <span class="Delimiter">}</span> <span id="L478" class="LineNr">478 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L479" class="LineNr">479 </span> <a href='003trace.cc.html#L196'>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">"'min' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L479" class="LineNr">479 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'min' yields exactly one product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L480" class="LineNr">480 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L481" class="LineNr">481 </span> <span class="Delimiter">}</span> <span id="L482" class="LineNr">482 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<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><span class="Constant">0</span><span class="Delimiter">))</span> && !is_mu_number<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="Delimiter">{</span> -<span id="L483" class="LineNr">483 </span> <a href='003trace.cc.html#L196'>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">"'min' should yield a number, but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L483" class="LineNr">483 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'min' should yield a number, but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L484" class="LineNr">484 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L485" class="LineNr">485 </span> <span class="Delimiter">}</span> <span id="L486" class="LineNr">486 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> diff --git a/html/026call.cc.html b/html/026call.cc.html index 3d5c2634..b0db4565 100644 --- a/html/026call.cc.html +++ b/html/026call.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } -.Identifier { color: #c0a020; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.Identifier { color:#c0a020; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } .SalientComment { color: #00ffff; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } .traceContains { color: #008000; } --> @@ -61,6 +63,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/026call.cc'>https://github.com/akkartik/mu/blob/master/026call.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: So far the recipes we define can't run each other. Let's fix that.</span> <span id="L2" class="LineNr"> 2 </span> @@ -124,10 +127,10 @@ if ('onhashchange' in window) { <span id="L60" class="LineNr"> 60 </span><span class="Delimiter">};</span> <span id="L61" class="LineNr"> 61 </span><span class="Delimiter">:(code)</span> <span id="L62" class="LineNr"> 62 </span>routine::routine<span class="Delimiter">(</span><a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L63" class="LineNr"> 63 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L64" class="LineNr"> 64 </span> ++Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> -<span id="L65" class="LineNr"> 65 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"new routine; incrementing callstack depth to "</span> << Trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L66" class="LineNr"> 66 </span> assert<span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> +<span id="L63" class="LineNr"> 63 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L64" class="LineNr"> 64 </span> ++<span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> +<span id="L65" class="LineNr"> 65 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"new routine; incrementing callstack depth to "</span> << <span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L66" class="LineNr"> 66 </span> assert<span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> <span id="L67" class="LineNr"> 67 </span> <span class="Delimiter">}</span> <span id="L68" class="LineNr"> 68 </span> calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>call<span class="Delimiter">(</span>r<span class="Delimiter">));</span> <span id="L69" class="LineNr"> 69 </span> <span class="Comment">// End routine Constructor</span> @@ -199,29 +202,29 @@ if ('onhashchange' in window) { <span id="L135" class="LineNr">135 </span> <span id="L136" class="LineNr">136 </span><span class="Delimiter">:(code)</span> <span id="L137" class="LineNr">137 </span><span class="Normal">void</span> dump_callstack<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L138" class="LineNr">138 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Current_routine<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L139" class="LineNr">139 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>size<span class="Delimiter">()</span> <= <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L140" class="LineNr">140 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::const_iterator p = ++Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> -<span id="L141" class="LineNr">141 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" called from "</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name << <span class="Constant">": "</span> << to_original_string<span class="Delimiter">(</span><a href='026call.cc.html#L88'>to_instruction</a><span class="Delimiter">(</span>*p<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L138" class="LineNr">138 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Current_routine</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L139" class="LineNr">139 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>size<span class="Delimiter">()</span> <= <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L140" class="LineNr">140 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::const_iterator p = ++<span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> +<span id="L141" class="LineNr">141 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" called from "</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name << <span class="Constant">": "</span> << to_original_string<span class="Delimiter">(</span><a href='026call.cc.html#L88'>to_instruction</a><span class="Delimiter">(</span>*p<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L142" class="LineNr">142 </span><span class="Delimiter">}</span> <span id="L143" class="LineNr">143 </span> <span id="L144" class="LineNr">144 </span><span class="Delimiter">:(after "Defined Recipe Checks")</span> <span id="L145" class="LineNr">145 </span><span class="Comment">// not a primitive; check that it's present in the book of recipes</span> -<span id="L146" class="LineNr">146 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L147" class="LineNr">147 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"undefined operation in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L146" class="LineNr">146 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L147" class="LineNr">147 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"undefined operation in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L148" class="LineNr">148 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L149" class="LineNr">149 </span><span class="Delimiter">}</span> <span id="L150" class="LineNr">150 </span><span class="Delimiter">:(replace{} "default:" following "End Primitive Recipe Implementations")</span> <span id="L151" class="LineNr">151 </span><span class="Normal">default</span>: <span class="Delimiter">{</span> -<span id="L152" class="LineNr">152 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// error already raised in Checks above</span> +<span id="L152" class="LineNr">152 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// error already raised in Checks above</span> <span id="L153" class="LineNr">153 </span> <span class="Comment">// not a primitive; look up the book of recipes</span> -<span id="L154" class="LineNr">154 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L155" class="LineNr">155 </span> ++Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> -<span id="L156" class="LineNr">156 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"incrementing callstack depth to "</span> << Trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L157" class="LineNr">157 </span> assert<span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> +<span id="L154" class="LineNr">154 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L155" class="LineNr">155 </span> ++<span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> +<span id="L156" class="LineNr">156 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"incrementing callstack depth to "</span> << <span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L157" class="LineNr">157 </span> assert<span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> <span id="L158" class="LineNr">158 </span> <span class="Delimiter">}</span> <span id="L159" class="LineNr">159 </span> <span class="Normal">const</span> call& caller_frame = <a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">();</span> -<span id="L160" class="LineNr">160 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>call<span class="Delimiter">(</span><a href='026call.cc.html#L88'>to_instruction</a><span class="Delimiter">(</span>caller_frame<span class="Delimiter">).</span>operation<span class="Delimiter">));</span> +<span id="L160" class="LineNr">160 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>call<span class="Delimiter">(</span><a href='026call.cc.html#L88'>to_instruction</a><span class="Delimiter">(</span>caller_frame<span class="Delimiter">).</span>operation<span class="Delimiter">));</span> <span id="L161" class="LineNr">161 </span> finish_call_housekeeping<span class="Delimiter">(</span><a href='026call.cc.html#L88'>to_instruction</a><span class="Delimiter">(</span>caller_frame<span class="Delimiter">),</span> ingredients<span class="Delimiter">);</span> <span id="L162" class="LineNr">162 </span> <span class="Comment">// not done with caller</span> <span id="L163" class="LineNr">163 </span> write_products =<span class="Constant"> false</span><span class="Delimiter">;</span> @@ -258,21 +261,21 @@ if ('onhashchange' in window) { <span id="L194" class="LineNr">194 </span><span class="Delimiter">:(replace{} "const vector<instruction>& routine::steps() const")</span> <span id="L195" class="LineNr">195 </span><span class="Normal">const</span> vector<instruction>& routine::steps<span class="Delimiter">()</span> <span class="Normal">const</span> <span class="Delimiter">{</span> <span id="L196" class="LineNr">196 </span> assert<span class="Delimiter">(</span>!calls<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L197" class="LineNr">197 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">;</span> +<span id="L197" class="LineNr">197 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">;</span> <span id="L198" class="LineNr">198 </span><span class="Delimiter">}</span> <span id="L199" class="LineNr">199 </span> <span id="L200" class="LineNr">200 </span><span class="Delimiter">:(after "Running One Instruction")</span> <span id="L201" class="LineNr">201 </span><span class="Comment">// when we reach the end of one call, we may reach the end of the one below</span> <span id="L202" class="LineNr">202 </span><span class="Comment">// it, and the one below that, and so on</span> -<span id="L203" class="LineNr">203 </span><span class="Normal">while</span> <span class="Delimiter">(</span><a href='026call.cc.html#L84'>current_step_index</a><span class="Delimiter">()</span> >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>steps<span class="Delimiter">()))</span> <span class="Delimiter">{</span> +<span id="L203" class="LineNr">203 </span><span class="Normal">while</span> <span class="Delimiter">(</span><a href='026call.cc.html#L84'>current_step_index</a><span class="Delimiter">()</span> >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>steps<span class="Delimiter">()))</span> <span class="Delimiter">{</span> <span id="L204" class="LineNr">204 </span> <span class="Comment">// Falling Through End Of Recipe</span> -<span id="L205" class="LineNr">205 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L206" class="LineNr">206 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"fall-through: exiting "</span> << <a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">()</span> << <span class="Constant">"; decrementing callstack depth from "</span> << Trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L207" class="LineNr">207 </span> --Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> -<span id="L208" class="LineNr">208 </span> assert<span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth >= <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L205" class="LineNr">205 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L206" class="LineNr">206 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"fall-through: exiting "</span> << <a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">()</span> << <span class="Constant">"; decrementing callstack depth from "</span> << <span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L207" class="LineNr">207 </span> --<span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> +<span id="L208" class="LineNr">208 </span> assert<span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth >= <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L209" class="LineNr">209 </span> <span class="Delimiter">}</span> -<span id="L210" class="LineNr">210 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> -<span id="L211" class="LineNr">211 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">goto</span> stop_running_current_routine<span class="Delimiter">;</span> +<span id="L210" class="LineNr">210 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> +<span id="L211" class="LineNr">211 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">goto</span> stop_running_current_routine<span class="Delimiter">;</span> <span id="L212" class="LineNr">212 </span> <span class="Comment">// Complete Call Fallthrough</span> <span id="L213" class="LineNr">213 </span> <span class="Comment">// todo: fail if no products returned</span> <span id="L214" class="LineNr">214 </span> ++current_step_index<span class="Delimiter">();</span> @@ -281,20 +284,20 @@ if ('onhashchange' in window) { <span id="L217" class="LineNr">217 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L218" class="LineNr">218 </span>_DUMP_CALL_STACK<span class="Delimiter">,</span> <span id="L219" class="LineNr">219 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L220" class="LineNr">220 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$dump-call-stack"</span><span class="Delimiter">,</span> _DUMP_CALL_STACK<span class="Delimiter">);</span> +<span id="L220" class="LineNr">220 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$dump-call-stack"</span><span class="Delimiter">,</span> _DUMP_CALL_STACK<span class="Delimiter">);</span> <span id="L221" class="LineNr">221 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L222" class="LineNr">222 </span><span class="Normal">case</span> _DUMP_CALL_STACK: <span class="Delimiter">{</span> <span id="L223" class="LineNr">223 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L224" class="LineNr">224 </span><span class="Delimiter">}</span> <span id="L225" class="LineNr">225 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L226" class="LineNr">226 </span><span class="Normal">case</span> _DUMP_CALL_STACK: <span class="Delimiter">{</span> -<span id="L227" class="LineNr">227 </span> dump<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">);</span> +<span id="L227" class="LineNr">227 </span> dump<span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">);</span> <span id="L228" class="LineNr">228 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L229" class="LineNr">229 </span><span class="Delimiter">}</span> <span id="L230" class="LineNr">230 </span><span class="Delimiter">:(code)</span> <span id="L231" class="LineNr">231 </span><span class="Normal">void</span> dump<span class="Delimiter">(</span><span class="Normal">const</span> call_stack& calls<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L232" class="LineNr">232 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::const_reverse_iterator p = calls<span class="Delimiter">.</span>rbegin<span class="Delimiter">();</span> p != calls<span class="Delimiter">.</span>rend<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> -<span id="L233" class="LineNr">233 </span> cerr << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name << <span class="Constant">":"</span> << p<span class="Delimiter">-></span>running_step_index << <span class="Constant">" -- "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L88'>to_instruction</a><span class="Delimiter">(</span>*p<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L233" class="LineNr">233 </span> cerr << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name << <span class="Constant">":"</span> << p<span class="Delimiter">-></span>running_step_index << <span class="Constant">" -- "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L88'>to_instruction</a><span class="Delimiter">(</span>*p<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L234" class="LineNr">234 </span><span class="Delimiter">}</span> </pre> </body> diff --git a/html/027call_ingredient.cc.html b/html/027call_ingredient.cc.html index 02e9a0d7..e8c7bee2 100644 --- a/html/027call_ingredient.cc.html +++ b/html/027call_ingredient.cc.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -59,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/027call_ingredient.cc'>https://github.com/akkartik/mu/blob/master/027call_ingredient.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Calls can take ingredients just like primitives. To access a recipe's</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: ingredients, use 'next-ingredient'.</span> @@ -101,19 +104,19 @@ if ('onhashchange' in window) { <span id="L39" class="LineNr"> 39 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L40" class="LineNr"> 40 </span>NEXT_INGREDIENT<span class="Delimiter">,</span> <span id="L41" class="LineNr"> 41 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L42" class="LineNr"> 42 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"next-ingredient"</span><span class="Delimiter">,</span> NEXT_INGREDIENT<span class="Delimiter">);</span> -<span id="L43" class="LineNr"> 43 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"next-input"</span><span class="Delimiter">,</span> NEXT_INGREDIENT<span class="Delimiter">);</span> +<span id="L42" class="LineNr"> 42 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"next-ingredient"</span><span class="Delimiter">,</span> NEXT_INGREDIENT<span class="Delimiter">);</span> +<span id="L43" class="LineNr"> 43 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"next-input"</span><span class="Delimiter">,</span> NEXT_INGREDIENT<span class="Delimiter">);</span> <span id="L44" class="LineNr"> 44 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L45" class="LineNr"> 45 </span><span class="Normal">case</span> NEXT_INGREDIENT: <span class="Delimiter">{</span> <span id="L46" class="LineNr"> 46 </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="L47" class="LineNr"> 47 </span> <a href='003trace.cc.html#L196'>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">"'next-ingredient' didn't expect any ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L47" class="LineNr"> 47 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'next-ingredient' didn't expect any ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L48" class="LineNr"> 48 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L49" class="LineNr"> 49 </span> <span class="Delimiter">}</span> <span id="L50" class="LineNr"> 50 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L51" class="LineNr"> 51 </span><span class="Delimiter">}</span> <span id="L52" class="LineNr"> 52 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L53" class="LineNr"> 53 </span><span class="Normal">case</span> NEXT_INGREDIENT: <span class="Delimiter">{</span> -<span id="L54" class="LineNr"> 54 </span> assert<span class="Delimiter">(</span>!Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L54" class="LineNr"> 54 </span> assert<span class="Delimiter">(</span>!<span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> <span id="L55" class="LineNr"> 55 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L56" class="LineNr"> 56 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> product = <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L57" class="LineNr"> 57 </span> <span class="Comment">// End Preprocess NEXT_INGREDIENT product</span> @@ -121,7 +124,7 @@ if ('onhashchange' in window) { <span id="L59" class="LineNr"> 59 </span> <span class="Comment">// no ingredient types since the call might be implicit; assume ingredients are always strings</span> <span id="L60" class="LineNr"> 60 </span> <span class="Comment">// todo: how to test this?</span> <span id="L61" class="LineNr"> 61 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_text<span class="Delimiter">(</span>product<span class="Delimiter">))</span> -<span id="L62" class="LineNr"> 62 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"main: wrong type for ingredient '"</span> << product<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L62" class="LineNr"> 62 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"main: wrong type for ingredient '"</span> << product<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L63" class="LineNr"> 63 </span> <span class="Delimiter">}</span> <span id="L64" class="LineNr"> 64 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>product<span class="Delimiter">,</span> <span id="L65" class="LineNr"> 65 </span> <a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process<span class="Delimiter">)))</span> <span class="Delimiter">{</span> @@ -136,7 +139,7 @@ if ('onhashchange' in window) { <span id="L74" class="LineNr"> 74 </span> <span class="Delimiter">}</span> <span id="L75" class="LineNr"> 75 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L76" class="LineNr"> 76 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">)</span> < <span class="Constant">2</span><span class="Delimiter">)</span> -<span id="L77" class="LineNr"> 77 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"no ingredient to <a href='003trace.cc.html#L133'>save</a> in '"</span> << current_instruction<span class="Delimiter">().</span>products<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#L225'>end</a><span class="Delimiter">();</span> +<span id="L77" class="LineNr"> 77 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"no ingredient to <a href='003trace.cc.html#L133'>save</a> in '"</span> << current_instruction<span class="Delimiter">().</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L78" class="LineNr"> 78 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L79" class="LineNr"> 79 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span> <span id="L80" class="LineNr"> 80 </span> <span class="Comment">// pad the first product with sufficient zeros to match its type</span> @@ -174,8 +177,8 @@ if ('onhashchange' in window) { <span id="L112" class="LineNr">112 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L113" class="LineNr">113 </span>REWIND_INGREDIENTS<span class="Delimiter">,</span> <span id="L114" class="LineNr">114 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L115" class="LineNr">115 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"rewind-ingredients"</span><span class="Delimiter">,</span> REWIND_INGREDIENTS<span class="Delimiter">);</span> -<span id="L116" class="LineNr">116 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"rewind-inputs"</span><span class="Delimiter">,</span> REWIND_INGREDIENTS<span class="Delimiter">);</span> +<span id="L115" class="LineNr">115 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"rewind-ingredients"</span><span class="Delimiter">,</span> REWIND_INGREDIENTS<span class="Delimiter">);</span> +<span id="L116" class="LineNr">116 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"rewind-inputs"</span><span class="Delimiter">,</span> REWIND_INGREDIENTS<span class="Delimiter">);</span> <span id="L117" class="LineNr">117 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L118" class="LineNr">118 </span><span class="Normal">case</span> REWIND_INGREDIENTS: <span class="Delimiter">{</span> <span id="L119" class="LineNr">119 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -202,16 +205,16 @@ if ('onhashchange' in window) { <span id="L140" class="LineNr">140 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L141" class="LineNr">141 </span>INGREDIENT<span class="Delimiter">,</span> <span id="L142" class="LineNr">142 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L143" class="LineNr">143 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"ingredient"</span><span class="Delimiter">,</span> INGREDIENT<span class="Delimiter">);</span> -<span id="L144" class="LineNr">144 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"input"</span><span class="Delimiter">,</span> INGREDIENT<span class="Delimiter">);</span> +<span id="L143" class="LineNr">143 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"ingredient"</span><span class="Delimiter">,</span> INGREDIENT<span class="Delimiter">);</span> +<span id="L144" class="LineNr">144 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"input"</span><span class="Delimiter">,</span> INGREDIENT<span class="Delimiter">);</span> <span id="L145" class="LineNr">145 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L146" class="LineNr">146 </span><span class="Normal">case</span> INGREDIENT: <span class="Delimiter">{</span> <span id="L147" class="LineNr">147 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L148" class="LineNr">148 </span> <a href='003trace.cc.html#L196'>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">"'ingredient' expects exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L148" class="LineNr">148 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'ingredient' expects exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L149" class="LineNr">149 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L150" class="LineNr">150 </span> <span class="Delimiter">}</span> <span id="L151" class="LineNr">151 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<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> && !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="L152" class="LineNr">152 </span> <a href='003trace.cc.html#L196'>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">"'ingredient' expects a literal ingredient, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L152" class="LineNr">152 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'ingredient' expects a literal ingredient, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L153" class="LineNr">153 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L154" class="LineNr">154 </span> <span class="Delimiter">}</span> <span id="L155" class="LineNr">155 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -243,14 +246,14 @@ if ('onhashchange' in window) { <span id="L181" class="LineNr">181 </span> <span class="Identifier">return</span> x<span class="Delimiter">.</span>type <span id="L182" class="LineNr">182 </span> && !x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom <span id="L183" class="LineNr">183 </span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom -<span id="L184" class="LineNr">184 </span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == Address_type_ordinal +<span id="L184" class="LineNr">184 </span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == <span class="Special">Address_type_ordinal</span> <span id="L185" class="LineNr">185 </span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right <span id="L186" class="LineNr">186 </span> && !x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>atom <span id="L187" class="LineNr">187 </span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom -<span id="L188" class="LineNr">188 </span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == Array_type_ordinal +<span id="L188" class="LineNr">188 </span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == <span class="Special">Array_type_ordinal</span> <span id="L189" class="LineNr">189 </span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right <span id="L190" class="LineNr">190 </span> && !x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>atom -<span id="L191" class="LineNr">191 </span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == Character_type_ordinal +<span id="L191" class="LineNr">191 </span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == <span class="Special">Character_type_ordinal</span> <span id="L192" class="LineNr">192 </span> && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right == <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L193" class="LineNr">193 </span><span class="Delimiter">}</span> </pre> diff --git a/html/028call_return.cc.html b/html/028call_return.cc.html index 8e7af8f6..ec56773e 100644 --- a/html/028call_return.cc.html +++ b/html/028call_return.cc.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -59,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/028call_return.cc'>https://github.com/akkartik/mu/blob/master/028call_return.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Calls can also generate products, using 'reply' or 'return'.</span> <span id="L2" class="LineNr"> 2 </span> @@ -89,9 +92,9 @@ if ('onhashchange' in window) { <span id="L27" class="LineNr"> 27 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L28" class="LineNr"> 28 </span>RETURN<span class="Delimiter">,</span> <span id="L29" class="LineNr"> 29 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L30" class="LineNr"> 30 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"return"</span><span class="Delimiter">,</span> RETURN<span class="Delimiter">);</span> -<span id="L31" class="LineNr"> 31 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"reply"</span><span class="Delimiter">,</span> RETURN<span class="Delimiter">);</span> <span class="Comment">// synonym while teaching</span> -<span id="L32" class="LineNr"> 32 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"output"</span><span class="Delimiter">,</span> RETURN<span class="Delimiter">);</span> <span class="Comment">// experiment</span> +<span id="L30" class="LineNr"> 30 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"return"</span><span class="Delimiter">,</span> RETURN<span class="Delimiter">);</span> +<span id="L31" class="LineNr"> 31 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"reply"</span><span class="Delimiter">,</span> RETURN<span class="Delimiter">);</span> <span class="Comment">// synonym while teaching</span> +<span id="L32" class="LineNr"> 32 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"output"</span><span class="Delimiter">,</span> RETURN<span class="Delimiter">);</span> <span class="Comment">// experiment</span> <span id="L33" class="LineNr"> 33 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L34" class="LineNr"> 34 </span><span class="Normal">case</span> RETURN: <span class="Delimiter">{</span> <span id="L35" class="LineNr"> 35 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// checks will be performed by a transform below</span> @@ -99,17 +102,17 @@ if ('onhashchange' in window) { <span id="L37" class="LineNr"> 37 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L38" class="LineNr"> 38 </span><span class="Normal">case</span> RETURN: <span class="Delimiter">{</span> <span id="L39" class="LineNr"> 39 </span> <span class="Comment">// Begin Return</span> -<span id="L40" class="LineNr"> 40 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L41" class="LineNr"> 41 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>name << <span class="Constant">": decrementing callstack depth from "</span> << Trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L42" class="LineNr"> 42 </span> --Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> -<span id="L43" class="LineNr"> 43 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth < <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L44" class="LineNr"> 44 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L40" class="LineNr"> 40 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L41" class="LineNr"> 41 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>name << <span class="Constant">": decrementing callstack depth from "</span> << <span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L42" class="LineNr"> 42 </span> --<span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> +<span id="L43" class="LineNr"> 43 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth < <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L44" class="LineNr"> 44 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L45" class="LineNr"> 45 </span> <span class="Identifier">goto</span> stop_running_current_routine<span class="Delimiter">;</span> <span id="L46" class="LineNr"> 46 </span> <span class="Delimiter">}</span> <span id="L47" class="LineNr"> 47 </span> <span class="Delimiter">}</span> -<span id="L48" class="LineNr"> 48 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> +<span id="L48" class="LineNr"> 48 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> <span id="L49" class="LineNr"> 49 </span> <span class="Comment">// just in case 'main' returns a value, drop it for now</span> -<span id="L50" class="LineNr"> 50 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">goto</span> stop_running_current_routine<span class="Delimiter">;</span> +<span id="L50" class="LineNr"> 50 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">goto</span> stop_running_current_routine<span class="Delimiter">;</span> <span id="L51" class="LineNr"> 51 </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#L141'>SIZE</a><span class="Delimiter">(</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L52" class="LineNr"> 52 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"result "</span> << i << <span class="Constant">" is "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L53" class="LineNr"> 53 </span> <span class="Comment">// make return products available to caller</span> @@ -121,17 +124,17 @@ if ('onhashchange' in window) { <span id="L59" class="LineNr"> 59 </span><span class="Comment">//: Types in return instructions are checked ahead of time.</span> <span id="L60" class="LineNr"> 60 </span> <span id="L61" class="LineNr"> 61 </span><span class="Delimiter">:(before "End Checks")</span> -<span id="L62" class="LineNr"> 62 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='028call_return.cc.html#L64'>check_types_of_return_instructions</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L62" class="LineNr"> 62 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='028call_return.cc.html#L64'>check_types_of_return_instructions</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L63" class="LineNr"> 63 </span><span class="Delimiter">:(code)</span> <span id="L64" class="LineNr"> 64 </span><span class="Normal">void</span> <a href='028call_return.cc.html#L64'>check_types_of_return_instructions</a><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="L65" class="LineNr"> 65 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L65" class="LineNr"> 65 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L66" class="LineNr"> 66 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- check types of return instructions in <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L67" class="LineNr"> 67 </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#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L68" class="LineNr"> 68 </span> <span class="Normal">const</span> instruction& caller_instruction = caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L69" class="LineNr"> 69 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>is_label<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L70" class="LineNr"> 70 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L71" class="LineNr"> 71 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='028call_return.cc.html#L115'>is_primitive</a><span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L72" class="LineNr"> 72 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> caller_instruction<span class="Delimiter">.</span>operation<span class="Delimiter">);</span> +<span id="L72" class="LineNr"> 72 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> caller_instruction<span class="Delimiter">.</span>operation<span class="Delimiter">);</span> <span id="L73" class="LineNr"> 73 </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#L141'>SIZE</a><span class="Delimiter">(</span>callee<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L74" class="LineNr"> 74 </span> <span class="Normal">const</span> instruction& return_inst = callee<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L75" class="LineNr"> 75 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>return_inst<span class="Delimiter">.</span>operation != RETURN<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> @@ -145,8 +148,8 @@ if ('onhashchange' in window) { <span id="L83" class="LineNr"> 83 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> rhs = caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L84" class="LineNr"> 84 </span> <span class="Comment">// End Check RETURN Copy(lhs, rhs)</span> <span id="L85" class="LineNr"> 85 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>rhs<span class="Delimiter">,</span> lhs<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L86" class="LineNr"> 86 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>callee<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << return_inst<span class="Delimiter">.</span>name << <span class="Constant">" ingredient '"</span> << lhs<span class="Delimiter">.</span>original_string << <span class="Constant">"' can't be saved in '"</span> << rhs<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="L87" class="LineNr"> 87 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" ['"</span> << to_string<span class="Delimiter">(</span>lhs<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">"' vs '"</span> << to_string<span class="Delimiter">(</span>rhs<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">"']</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L86" class="LineNr"> 86 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>callee<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << return_inst<span class="Delimiter">.</span>name << <span class="Constant">" ingredient '"</span> << lhs<span class="Delimiter">.</span>original_string << <span class="Constant">"' can't be saved in '"</span> << rhs<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> +<span id="L87" class="LineNr"> 87 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" ['"</span> << to_string<span class="Delimiter">(</span>lhs<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">"' vs '"</span> << to_string<span class="Delimiter">(</span>rhs<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">"']\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L88" class="LineNr"> 88 </span> <span class="Identifier">goto</span> finish_return_check<span class="Delimiter">;</span> <span id="L89" class="LineNr"> 89 </span> <span class="Delimiter">}</span> <span id="L90" class="LineNr"> 90 </span> <span class="Delimiter">}</span> @@ -156,16 +159,16 @@ if ('onhashchange' in window) { <span id="L94" class="LineNr"> 94 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>has_property<span class="Delimiter">(</span>return_inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> <span class="Constant">"same-as-ingredient"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L95" class="LineNr"> 95 </span> string_tree* tmp = property<span class="Delimiter">(</span>return_inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> <span class="Constant">"same-as-ingredient"</span><span class="Delimiter">);</span> <span id="L96" class="LineNr"> 96 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!tmp || !tmp<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L97" class="LineNr"> 97 </span> <a href='003trace.cc.html#L196'>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">"'same-as-ingredient' metadata should take exactly one value in '"</span> << to_original_string<span class="Delimiter">(</span>return_inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L97" class="LineNr"> 97 </span> <a href='003trace.cc.html#L196'>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">"'same-as-ingredient' metadata should take exactly one value in '"</span> << to_original_string<span class="Delimiter">(</span>return_inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L98" class="LineNr"> 98 </span> <span class="Identifier">goto</span> finish_return_check<span class="Delimiter">;</span> <span id="L99" class="LineNr"> 99 </span> <span class="Delimiter">}</span> <span id="L100" class="LineNr">100 </span> <span class="Normal">int</span> ingredient_index = to_integer<span class="Delimiter">(</span>tmp<span class="Delimiter">-></span>value<span class="Delimiter">);</span> <span id="L101" class="LineNr">101 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>ingredient_index >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L102" class="LineNr">102 </span> <a href='003trace.cc.html#L196'>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">"too few ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>caller_instruction<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L102" class="LineNr">102 </span> <a href='003trace.cc.html#L196'>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">"too few ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>caller_instruction<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L103" class="LineNr">103 </span> <span class="Identifier">goto</span> finish_return_check<span class="Delimiter">;</span> <span id="L104" class="LineNr">104 </span> <span class="Delimiter">}</span> <span id="L105" class="LineNr">105 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_dummy<span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> && !is_literal<span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">))</span> && caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name != caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">).</span>name<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L106" class="LineNr">106 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << to_original_string<span class="Delimiter">(</span>caller_instruction<span class="Delimiter">)</span> << <span class="Constant">"' should write to '"</span> << caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">).</span>original_string << <span class="Constant">"' rather than '"</span> << caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L106" class="LineNr">106 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << to_original_string<span class="Delimiter">(</span>caller_instruction<span class="Delimiter">)</span> << <span class="Constant">"' should write to '"</span> << caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">).</span>original_string << <span class="Constant">"' rather than '"</span> << caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L107" class="LineNr">107 </span> <span class="Delimiter">}</span> <span id="L108" class="LineNr">108 </span> <span class="Delimiter">}</span> <span id="L109" class="LineNr">109 </span> <span class="Delimiter">}</span> diff --git a/html/029tools.cc.html b/html/029tools.cc.html index ea3c2618..ec7d9a3b 100644 --- a/html/029tools.cc.html +++ b/html/029tools.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } .CommentedCode { color: #6c6c6c; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } .traceContains { color: #008000; } --> @@ -61,31 +63,32 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/029tools.cc'>https://github.com/akkartik/mu/blob/master/029tools.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Allow Mu programs to log facts just like we've been doing in C++ so far.</span> <span id="L2" class="LineNr"> 2 </span> <span id="L3" class="LineNr"> 3 </span><span class="Delimiter">:(scenario trace)</span> <span id="L4" class="LineNr"> 4 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L5" class="LineNr"> 5 </span> <a href='003trace.cc.html#L189'>trace</a> <span class="Constant">1</span><span class="Delimiter">,</span> [foo]<span class="Delimiter">,</span> [<span class="Normal">this</span> is a <a href='003trace.cc.html#L189'>trace</a> in Mu] +<span id="L5" class="LineNr"> 5 </span> <a href='003trace.cc.html#L189'>trace</a> <span class="Constant">1</span><span class="Delimiter">,</span> [foo]<span class="Delimiter">,</span> [<span class="Normal">this</span> is a <a href='003trace.cc.html#L189'>trace</a> in <span class="Special">Mu</span>] <span id="L6" class="LineNr"> 6 </span>] <span id="L7" class="LineNr"> 7 </span><span class="traceContains">+foo: this is a <a href='003trace.cc.html#L189'>trace</a> in Mu</span> <span id="L8" class="LineNr"> 8 </span> <span id="L9" class="LineNr"> 9 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L10" class="LineNr"> 10 </span>TRACE<span class="Delimiter">,</span> <span id="L11" class="LineNr"> 11 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L12" class="LineNr"> 12 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"trace"</span><span class="Delimiter">,</span> TRACE<span class="Delimiter">);</span> +<span id="L12" class="LineNr"> 12 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"trace"</span><span class="Delimiter">,</span> TRACE<span class="Delimiter">);</span> <span id="L13" class="LineNr"> 13 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L14" class="LineNr"> 14 </span><span class="Normal">case</span> TRACE: <span class="Delimiter">{</span> <span id="L15" class="LineNr"> 15 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> < <span class="Constant">3</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L16" class="LineNr"> 16 </span> <a href='003trace.cc.html#L196'>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">"'trace' takes three or more ingredients rather than '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L16" class="LineNr"> 16 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'trace' takes three or more ingredients rather than '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L17" class="LineNr"> 17 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L18" class="LineNr"> 18 </span> <span class="Delimiter">}</span> <span id="L19" class="LineNr"> 19 </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="L20" class="LineNr"> 20 </span> <a href='003trace.cc.html#L196'>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 'trace' should be a number (depth), 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L20" class="LineNr"> 20 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'trace' should be a number (depth), 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L21" class="LineNr"> 21 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L22" class="LineNr"> 22 </span> <span class="Delimiter">}</span> <span id="L23" class="LineNr"> 23 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal_text<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="L24" class="LineNr"> 24 </span> <a href='003trace.cc.html#L196'>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 'trace' should be a literal string (label), 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L24" class="LineNr"> 24 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second ingredient of 'trace' should be a literal string (label), 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L25" class="LineNr"> 25 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L26" class="LineNr"> 26 </span> <span class="Delimiter">}</span> <span id="L27" class="LineNr"> 27 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -108,7 +111,7 @@ if ('onhashchange' in window) { <span id="L44" class="LineNr"> 44 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L45" class="LineNr"> 45 </span>STASH<span class="Delimiter">,</span> <span id="L46" class="LineNr"> 46 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L47" class="LineNr"> 47 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"stash"</span><span class="Delimiter">,</span> STASH<span class="Delimiter">);</span> +<span id="L47" class="LineNr"> 47 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"stash"</span><span class="Delimiter">,</span> STASH<span class="Delimiter">);</span> <span id="L48" class="LineNr"> 48 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L49" class="LineNr"> 49 </span><span class="Normal">case</span> STASH: <span class="Delimiter">{</span> <span id="L50" class="LineNr"> 50 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -159,43 +162,43 @@ if ('onhashchange' in window) { <span id="L95" class="LineNr"> 95 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L96" class="LineNr"> 96 </span>HIDE_ERRORS<span class="Delimiter">,</span> <span id="L97" class="LineNr"> 97 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L98" class="LineNr"> 98 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"hide-errors"</span><span class="Delimiter">,</span> HIDE_ERRORS<span class="Delimiter">);</span> +<span id="L98" class="LineNr"> 98 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"hide-errors"</span><span class="Delimiter">,</span> HIDE_ERRORS<span class="Delimiter">);</span> <span id="L99" class="LineNr"> 99 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L100" class="LineNr">100 </span><span class="Normal">case</span> HIDE_ERRORS: <span class="Delimiter">{</span> <span id="L101" class="LineNr">101 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L102" class="LineNr">102 </span><span class="Delimiter">}</span> <span id="L103" class="LineNr">103 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L104" class="LineNr">104 </span><span class="Normal">case</span> HIDE_ERRORS: <span class="Delimiter">{</span> -<span id="L105" class="LineNr">105 </span> Hide_errors =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L105" class="LineNr">105 </span> <span class="Special">Hide_errors</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L106" class="LineNr">106 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L107" class="LineNr">107 </span><span class="Delimiter">}</span> <span id="L108" class="LineNr">108 </span> <span id="L109" class="LineNr">109 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L110" class="LineNr">110 </span>SHOW_ERRORS<span class="Delimiter">,</span> <span id="L111" class="LineNr">111 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L112" class="LineNr">112 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"show-errors"</span><span class="Delimiter">,</span> SHOW_ERRORS<span class="Delimiter">);</span> +<span id="L112" class="LineNr">112 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"show-errors"</span><span class="Delimiter">,</span> SHOW_ERRORS<span class="Delimiter">);</span> <span id="L113" class="LineNr">113 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L114" class="LineNr">114 </span><span class="Normal">case</span> SHOW_ERRORS: <span class="Delimiter">{</span> <span id="L115" class="LineNr">115 </span> <span class="Identifier">break</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">:(before "End Primitive Recipe Implementations")</span> <span id="L118" class="LineNr">118 </span><span class="Normal">case</span> SHOW_ERRORS: <span class="Delimiter">{</span> -<span id="L119" class="LineNr">119 </span> Hide_errors =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L119" class="LineNr">119 </span> <span class="Special">Hide_errors</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L120" class="LineNr">120 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L121" class="LineNr">121 </span><span class="Delimiter">}</span> <span id="L122" class="LineNr">122 </span> <span id="L123" class="LineNr">123 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L124" class="LineNr">124 </span>TRACE_UNTIL<span class="Delimiter">,</span> <span id="L125" class="LineNr">125 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L126" class="LineNr">126 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"trace-until"</span><span class="Delimiter">,</span> TRACE_UNTIL<span class="Delimiter">);</span> +<span id="L126" class="LineNr">126 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"trace-until"</span><span class="Delimiter">,</span> TRACE_UNTIL<span class="Delimiter">);</span> <span id="L127" class="LineNr">127 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L128" class="LineNr">128 </span><span class="Normal">case</span> TRACE_UNTIL: <span class="Delimiter">{</span> <span id="L129" class="LineNr">129 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L130" class="LineNr">130 </span><span class="Delimiter">}</span> <span id="L131" class="LineNr">131 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L132" class="LineNr">132 </span><span class="Normal">case</span> TRACE_UNTIL: <span class="Delimiter">{</span> -<span id="L133" class="LineNr">133 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L134" class="LineNr">134 </span> Trace_stream<span class="Delimiter">-></span>collect_depth = 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="L133" class="LineNr">133 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L134" class="LineNr">134 </span> <span class="Special">Trace_stream</span><span class="Delimiter">-></span>collect_depth = 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="L135" class="LineNr">135 </span> <span class="Delimiter">}</span> <span id="L136" class="LineNr">136 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L137" class="LineNr">137 </span><span class="Delimiter">}</span> @@ -203,7 +206,7 @@ if ('onhashchange' in window) { <span id="L139" class="LineNr">139 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L140" class="LineNr">140 </span>_DUMP_TRACE<span class="Delimiter">,</span> <span id="L141" class="LineNr">141 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L142" class="LineNr">142 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$dump-trace"</span><span class="Delimiter">,</span> _DUMP_TRACE<span class="Delimiter">);</span> +<span id="L142" class="LineNr">142 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$dump-trace"</span><span class="Delimiter">,</span> _DUMP_TRACE<span class="Delimiter">);</span> <span id="L143" class="LineNr">143 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L144" class="LineNr">144 </span><span class="Normal">case</span> _DUMP_TRACE: <span class="Delimiter">{</span> <span id="L145" class="LineNr">145 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -222,28 +225,28 @@ if ('onhashchange' in window) { <span id="L158" class="LineNr">158 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L159" class="LineNr">159 </span>_CLEAR_TRACE<span class="Delimiter">,</span> <span id="L160" class="LineNr">160 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L161" class="LineNr">161 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$clear-trace"</span><span class="Delimiter">,</span> _CLEAR_TRACE<span class="Delimiter">);</span> +<span id="L161" class="LineNr">161 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$clear-trace"</span><span class="Delimiter">,</span> _CLEAR_TRACE<span class="Delimiter">);</span> <span id="L162" class="LineNr">162 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L163" class="LineNr">163 </span><span class="Normal">case</span> _CLEAR_TRACE: <span class="Delimiter">{</span> <span id="L164" class="LineNr">164 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L165" class="LineNr">165 </span><span class="Delimiter">}</span> <span id="L166" class="LineNr">166 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L167" class="LineNr">167 </span><span class="Normal">case</span> _CLEAR_TRACE: <span class="Delimiter">{</span> -<span id="L168" class="LineNr">168 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L168" class="LineNr">168 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L169" class="LineNr">169 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L170" class="LineNr">170 </span><span class="Delimiter">}</span> <span id="L171" class="LineNr">171 </span> <span id="L172" class="LineNr">172 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L173" class="LineNr">173 </span>_SAVE_TRACE<span class="Delimiter">,</span> <span id="L174" class="LineNr">174 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L175" class="LineNr">175 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$save-trace"</span><span class="Delimiter">,</span> _SAVE_TRACE<span class="Delimiter">);</span> +<span id="L175" class="LineNr">175 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$save-trace"</span><span class="Delimiter">,</span> _SAVE_TRACE<span class="Delimiter">);</span> <span id="L176" class="LineNr">176 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L177" class="LineNr">177 </span><span class="Normal">case</span> _SAVE_TRACE: <span class="Delimiter">{</span> <span id="L178" class="LineNr">178 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L179" class="LineNr">179 </span><span class="Delimiter">}</span> <span id="L180" class="LineNr">180 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L181" class="LineNr">181 </span><span class="Normal">case</span> _SAVE_TRACE: <span class="Delimiter">{</span> -<span id="L182" class="LineNr">182 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Save_trace<span class="Delimiter">)</span> Trace_stream<span class="Delimiter">-></span><a href='003trace.cc.html#L133'>save</a><span class="Delimiter">();</span> +<span id="L182" class="LineNr">182 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Save_trace</span><span class="Delimiter">)</span> <span class="Special">Trace_stream</span><span class="Delimiter">-></span><a href='003trace.cc.html#L133'>save</a><span class="Delimiter">();</span> <span id="L183" class="LineNr">183 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L184" class="LineNr">184 </span><span class="Delimiter">}</span> <span id="L185" class="LineNr">185 </span> @@ -252,7 +255,7 @@ if ('onhashchange' in window) { <span id="L188" class="LineNr">188 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L189" class="LineNr">189 </span>_PRINT<span class="Delimiter">,</span> <span id="L190" class="LineNr">190 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L191" class="LineNr">191 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$print"</span><span class="Delimiter">,</span> _PRINT<span class="Delimiter">);</span> +<span id="L191" class="LineNr">191 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$print"</span><span class="Delimiter">,</span> _PRINT<span class="Delimiter">);</span> <span id="L192" class="LineNr">192 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L193" class="LineNr">193 </span><span class="Normal">case</span> _PRINT: <span class="Delimiter">{</span> <span id="L194" class="LineNr">194 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -287,7 +290,7 @@ if ('onhashchange' in window) { <span id="L223" class="LineNr">223 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L224" class="LineNr">224 </span>_EXIT<span class="Delimiter">,</span> <span id="L225" class="LineNr">225 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L226" class="LineNr">226 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$exit"</span><span class="Delimiter">,</span> _EXIT<span class="Delimiter">);</span> +<span id="L226" class="LineNr">226 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$exit"</span><span class="Delimiter">,</span> _EXIT<span class="Delimiter">);</span> <span id="L227" class="LineNr">227 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L228" class="LineNr">228 </span><span class="Normal">case</span> _EXIT: <span class="Delimiter">{</span> <span id="L229" class="LineNr">229 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -301,15 +304,15 @@ if ('onhashchange' in window) { <span id="L237" class="LineNr">237 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L238" class="LineNr">238 </span>_SYSTEM<span class="Delimiter">,</span> <span id="L239" class="LineNr">239 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L240" class="LineNr">240 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$system"</span><span class="Delimiter">,</span> _SYSTEM<span class="Delimiter">);</span> +<span id="L240" class="LineNr">240 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$system"</span><span class="Delimiter">,</span> _SYSTEM<span class="Delimiter">);</span> <span id="L241" class="LineNr">241 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L242" class="LineNr">242 </span><span class="Normal">case</span> _SYSTEM: <span class="Delimiter">{</span> <span id="L243" class="LineNr">243 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L244" class="LineNr">244 </span> <a href='003trace.cc.html#L196'>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">"'$system' requires exactly one ingredient, but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L244" class="LineNr">244 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$system' requires exactly one ingredient, but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L245" class="LineNr">245 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L246" class="LineNr">246 </span> <span class="Delimiter">}</span> <span id="L247" class="LineNr">247 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal_text<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="L248" class="LineNr">248 </span> <a href='003trace.cc.html#L196'>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">"ingredient to '$system' must be a literal text, but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L248" class="LineNr">248 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"ingredient to '$system' must be a literal text, but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L249" class="LineNr">249 </span> <span class="Delimiter">}</span> <span id="L250" class="LineNr">250 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L251" class="LineNr">251 </span><span class="Delimiter">}</span> @@ -324,7 +327,7 @@ if ('onhashchange' in window) { <span id="L260" class="LineNr">260 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L261" class="LineNr">261 </span>_DUMP_MEMORY<span class="Delimiter">,</span> <span id="L262" class="LineNr">262 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L263" class="LineNr">263 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$dump-memory"</span><span class="Delimiter">,</span> _DUMP_MEMORY<span class="Delimiter">);</span> +<span id="L263" class="LineNr">263 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$dump-memory"</span><span class="Delimiter">,</span> _DUMP_MEMORY<span class="Delimiter">);</span> <span id="L264" class="LineNr">264 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L265" class="LineNr">265 </span><span class="Normal">case</span> _DUMP_MEMORY: <span class="Delimiter">{</span> <span id="L266" class="LineNr">266 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -346,7 +349,7 @@ if ('onhashchange' in window) { <span id="L282" class="LineNr">282 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L283" class="LineNr">283 </span>_LOG<span class="Delimiter">,</span> <span id="L284" class="LineNr">284 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L285" class="LineNr">285 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$log"</span><span class="Delimiter">,</span> _LOG<span class="Delimiter">);</span> +<span id="L285" class="LineNr">285 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$log"</span><span class="Delimiter">,</span> _LOG<span class="Delimiter">);</span> <span id="L286" class="LineNr">286 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L287" class="LineNr">287 </span><span class="Normal">case</span> _LOG: <span class="Delimiter">{</span> <span id="L288" class="LineNr">288 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -364,18 +367,18 @@ if ('onhashchange' in window) { <span id="L300" class="LineNr">300 </span><span class="Comment">//: set a variable from within Mu code</span> <span id="L301" class="LineNr">301 </span><span class="Comment">//: useful for selectively tracing or printing after some point</span> <span id="L302" class="LineNr">302 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L303" class="LineNr">303 </span><span class="Normal">bool</span> Foo =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L303" class="LineNr">303 </span><span class="Normal">bool</span> <span class="Special">Foo</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L304" class="LineNr">304 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L305" class="LineNr">305 </span>_FOO<span class="Delimiter">,</span> <span id="L306" class="LineNr">306 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L307" class="LineNr">307 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$foo"</span><span class="Delimiter">,</span> _FOO<span class="Delimiter">);</span> +<span id="L307" class="LineNr">307 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$foo"</span><span class="Delimiter">,</span> _FOO<span class="Delimiter">);</span> <span id="L308" class="LineNr">308 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L309" class="LineNr">309 </span><span class="Normal">case</span> _FOO: <span class="Delimiter">{</span> <span id="L310" class="LineNr">310 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L311" class="LineNr">311 </span><span class="Delimiter">}</span> <span id="L312" class="LineNr">312 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L313" class="LineNr">313 </span><span class="Normal">case</span> _FOO: <span class="Delimiter">{</span> -<span id="L314" class="LineNr">314 </span> Foo =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L314" class="LineNr">314 </span> <span class="Special">Foo</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L315" class="LineNr">315 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L316" class="LineNr">316 </span><span class="Delimiter">}</span> </pre> diff --git a/html/030container.cc.html b/html/030container.cc.html index be3a144c..6b0c1910 100644 --- a/html/030container.cc.html +++ b/html/030container.cc.html @@ -11,23 +11,25 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } .SalientComment { color: #00ffff; } .traceAbsent { color: #c00000; } .muRecipe { color: #ff8700; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .cSpecial { color: #008000; } .muData { color: #ffff00; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -62,17 +64,18 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/030container.cc'>https://github.com/akkartik/mu/blob/master/030container.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Containers contain a fixed number of elements of different types.</span> <span id="L2" class="LineNr"> 2 </span> <span id="L3" class="LineNr"> 3 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> <span id="L4" class="LineNr"> 4 </span><span class="Comment">//: We'll use this container as a running example in scenarios below.</span> -<span id="L5" class="LineNr"> 5 </span><a href='010vm.cc.html#L125'>type_ordinal</a> point = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"point"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L6" class="LineNr"> 6 </span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point<span class="Delimiter">);</span> <span class="Comment">// initialize</span> -<span id="L7" class="LineNr"> 7 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point<span class="Delimiter">).</span>kind = <a href='010vm.cc.html#L180'>CONTAINER</a><span class="Delimiter">;</span> -<span id="L8" class="LineNr"> 8 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point<span class="Delimiter">).</span>name = <span class="Constant">"point"</span><span class="Delimiter">;</span> -<span id="L9" class="LineNr"> 9 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point<span class="Delimiter">).</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"x:number"</span><span class="Delimiter">));</span> -<span id="L10" class="LineNr"> 10 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point<span class="Delimiter">).</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"y:number"</span><span class="Delimiter">));</span> +<span id="L5" class="LineNr"> 5 </span><a href='010vm.cc.html#L125'>type_ordinal</a> point = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"point"</span><span class="Delimiter">,</span> <span class="Special">Next_type_ordinal</span>++<span class="Delimiter">);</span> +<span id="L6" class="LineNr"> 6 </span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> point<span class="Delimiter">);</span> <span class="Comment">// initialize</span> +<span id="L7" class="LineNr"> 7 </span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> point<span class="Delimiter">).</span>kind = <a href='010vm.cc.html#L180'>CONTAINER</a><span class="Delimiter">;</span> +<span id="L8" class="LineNr"> 8 </span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> point<span class="Delimiter">).</span>name = <span class="Constant">"point"</span><span class="Delimiter">;</span> +<span id="L9" class="LineNr"> 9 </span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> point<span class="Delimiter">).</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"x:number"</span><span class="Delimiter">));</span> +<span id="L10" class="LineNr"> 10 </span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> point<span class="Delimiter">).</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"y:number"</span><span class="Delimiter">));</span> <span id="L11" class="LineNr"> 11 </span> <span id="L12" class="LineNr"> 12 </span><span class="Comment">//: Containers can be copied around with a single instruction just like</span> <span id="L13" class="LineNr"> 13 </span><span class="Comment">//: numbers, no matter how large they are.</span> @@ -100,12 +103,12 @@ if ('onhashchange' in window) { <span id="L35" class="LineNr"> 35 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> <span id="L36" class="LineNr"> 36 </span><span class="Comment">// A more complex example container, containing another container as one of</span> <span id="L37" class="LineNr"> 37 </span><span class="Comment">// its elements.</span> -<span id="L38" class="LineNr"> 38 </span><a href='010vm.cc.html#L125'>type_ordinal</a> point_number = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"point-number"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L39" class="LineNr"> 39 </span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point_number<span class="Delimiter">);</span> <span class="Comment">// initialize</span> -<span id="L40" class="LineNr"> 40 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point_number<span class="Delimiter">).</span>kind = <a href='010vm.cc.html#L180'>CONTAINER</a><span class="Delimiter">;</span> -<span id="L41" class="LineNr"> 41 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point_number<span class="Delimiter">).</span>name = <span class="Constant">"point-number"</span><span class="Delimiter">;</span> -<span id="L42" class="LineNr"> 42 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point_number<span class="Delimiter">).</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"xy:point"</span><span class="Delimiter">));</span> -<span id="L43" class="LineNr"> 43 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> point_number<span class="Delimiter">).</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"z:number"</span><span class="Delimiter">));</span> +<span id="L38" class="LineNr"> 38 </span><a href='010vm.cc.html#L125'>type_ordinal</a> point_number = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"point-number"</span><span class="Delimiter">,</span> <span class="Special">Next_type_ordinal</span>++<span class="Delimiter">);</span> +<span id="L39" class="LineNr"> 39 </span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> point_number<span class="Delimiter">);</span> <span class="Comment">// initialize</span> +<span id="L40" class="LineNr"> 40 </span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> point_number<span class="Delimiter">).</span>kind = <a href='010vm.cc.html#L180'>CONTAINER</a><span class="Delimiter">;</span> +<span id="L41" class="LineNr"> 41 </span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> point_number<span class="Delimiter">).</span>name = <span class="Constant">"point-number"</span><span class="Delimiter">;</span> +<span id="L42" class="LineNr"> 42 </span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> point_number<span class="Delimiter">).</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"xy:point"</span><span class="Delimiter">));</span> +<span id="L43" class="LineNr"> 43 </span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> point_number<span class="Delimiter">).</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"z:number"</span><span class="Delimiter">));</span> <span id="L44" class="LineNr"> 44 </span> <span id="L45" class="LineNr"> 45 </span><span class="Delimiter">:(scenario copy_handles_nested_container_elements)</span> <span id="L46" class="LineNr"> 46 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ @@ -160,18 +163,18 @@ if ('onhashchange' in window) { <span id="L95" class="LineNr"> 95 </span><span class="Delimiter">:(before "End size_of(type) Special-cases")</span> <span id="L96" class="LineNr"> 96 </span><span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>value == -<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// error value, but we'll raise it elsewhere</span> <span id="L97" class="LineNr"> 97 </span><span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L98" class="LineNr"> 98 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L98" class="LineNr"> 98 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L99" class="LineNr"> 99 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"no such type "</span> << type<span class="Delimiter">-></span>value << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L100" class="LineNr">100 </span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L101" class="LineNr">101 </span><span class="Delimiter">}</span> -<span id="L102" class="LineNr">102 </span>type_info t = get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> +<span id="L102" class="LineNr">102 </span>type_info t = get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> <span id="L103" class="LineNr">103 </span><span class="Normal">if</span> <span class="Delimiter">(</span>t<span class="Delimiter">.</span>kind == <a href='010vm.cc.html#L180'>CONTAINER</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L104" class="LineNr">104 </span> <span class="Comment">// size of a container is the sum of the sizes of its elements</span> <span id="L105" class="LineNr">105 </span> <span class="Normal">int</span> result = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L106" class="LineNr">106 </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#L141'>SIZE</a><span class="Delimiter">(</span>t<span class="Delimiter">.</span>elements<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L107" class="LineNr">107 </span> <span class="Comment">// todo: strengthen assertion to disallow mutual type recursion</span> <span id="L108" class="LineNr">108 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>t<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">-></span>value == type<span class="Delimiter">-></span>value<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L109" class="LineNr">109 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"container "</span> << t<span class="Delimiter">.</span>name << <span class="Constant">" can't include itself as a member</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L109" class="LineNr">109 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"container "</span> << t<span class="Delimiter">.</span>name << <span class="Constant">" can't include itself as a member\n"</span> << end<span class="Delimiter">();</span> <span id="L110" class="LineNr">110 </span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L111" class="LineNr">111 </span> <span class="Delimiter">}</span> <span id="L112" class="LineNr">112 </span> result += size_of<span class="Delimiter">(</span><a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>type<span class="Delimiter">,</span> i<span class="Delimiter">));</span> @@ -203,28 +206,28 @@ if ('onhashchange' in window) { <span id="L138" class="LineNr">138 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L139" class="LineNr">139 </span>GET<span class="Delimiter">,</span> <span id="L140" class="LineNr">140 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L141" class="LineNr">141 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"get"</span><span class="Delimiter">,</span> GET<span class="Delimiter">);</span> +<span id="L141" class="LineNr">141 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"get"</span><span class="Delimiter">,</span> GET<span class="Delimiter">);</span> <span id="L142" class="LineNr">142 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L143" class="LineNr">143 </span><span class="Normal">case</span> GET: <span class="Delimiter">{</span> <span id="L144" class="LineNr">144 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L145" class="LineNr">145 </span> <a href='003trace.cc.html#L196'>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">"'get' expects exactly 2 ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L145" class="LineNr">145 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'get' expects exactly 2 ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L146" class="LineNr">146 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L147" class="LineNr">147 </span> <span class="Delimiter">}</span> <span id="L148" class="LineNr">148 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> base = 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="Comment">// new copy for every invocation</span> <span id="L149" class="LineNr">149 </span> <span class="Comment">// Update GET base in Check</span> <span id="L150" class="LineNr">150 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!base<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L151" class="LineNr">151 </span> <a href='003trace.cc.html#L196'>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 'get' should be a container, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L151" class="LineNr">151 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'get' should be a container, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L152" class="LineNr">152 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L153" class="LineNr">153 </span> <span class="Delimiter">}</span> <span id="L154" class="LineNr">154 </span> <span class="Normal">const</span> type_tree* base_type = base<span class="Delimiter">.</span>type<span class="Delimiter">;</span> <span id="L155" class="LineNr">155 </span> <span class="Comment">// Update GET base_type in Check</span> -<span id="L156" class="LineNr">156 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!base_type<span class="Delimiter">-></span>atom || base_type<span class="Delimiter">-></span>value == <span class="Constant">0</span> || !contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">)</span> || get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>kind != <a href='010vm.cc.html#L180'>CONTAINER</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L157" class="LineNr">157 </span> <a href='003trace.cc.html#L196'>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 'get' should be a container, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L156" class="LineNr">156 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!base_type<span class="Delimiter">-></span>atom || base_type<span class="Delimiter">-></span>value == <span class="Constant">0</span> || !contains_key<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">)</span> || get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>kind != <a href='010vm.cc.html#L180'>CONTAINER</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L157" class="LineNr">157 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'get' should be a container, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L158" class="LineNr">158 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L159" class="LineNr">159 </span> <span class="Delimiter">}</span> <span id="L160" class="LineNr">160 </span> <span class="Normal">const</span> reagent& offset = 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 id="L161" class="LineNr">161 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<span class="Delimiter">(</span>offset<span class="Delimiter">)</span> || !is_mu_scalar<span class="Delimiter">(</span>offset<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L162" class="LineNr">162 </span> <a href='003trace.cc.html#L196'>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 'get' should have type 'offset', 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L162" class="LineNr">162 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second ingredient of 'get' should have type 'offset', 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L163" class="LineNr">163 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L164" class="LineNr">164 </span> <span class="Delimiter">}</span> <span id="L165" class="LineNr">165 </span> <span class="Normal">int</span> offset_value = <span class="Constant">0</span><span class="Delimiter">;</span> @@ -232,8 +235,8 @@ if ('onhashchange' in window) { <span id="L167" class="LineNr">167 </span> offset_value = to_integer<span class="Delimiter">(</span>offset<span class="Delimiter">.</span>name<span class="Delimiter">);</span> <span id="L168" class="LineNr">168 </span> <span class="Delimiter">}</span> <span id="L169" class="LineNr">169 </span> <span class="Comment">// End update GET offset_value in Check</span> -<span id="L170" class="LineNr">170 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset_value < <span class="Constant">0</span> || offset_value >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L171" class="LineNr">171 </span> <a href='003trace.cc.html#L196'>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">"invalid offset '"</span> << offset_value << <span class="Constant">"' for '"</span> << get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L170" class="LineNr">170 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset_value < <span class="Constant">0</span> || offset_value >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L171" class="LineNr">171 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"invalid offset '"</span> << offset_value << <span class="Constant">"' for '"</span> << get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>name << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L172" class="LineNr">172 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L173" class="LineNr">173 </span> <span class="Delimiter">}</span> <span id="L174" class="LineNr">174 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -242,7 +245,7 @@ if ('onhashchange' in window) { <span id="L177" class="LineNr">177 </span> <span class="Comment">//: use base.type rather than base_type because later layers will introduce compound types</span> <span id="L178" class="LineNr">178 </span> <span class="Normal">const</span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> element = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>base<span class="Delimiter">.</span>type<span class="Delimiter">,</span> offset_value<span class="Delimiter">);</span> <span id="L179" class="LineNr">179 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>product<span class="Delimiter">,</span> element<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L180" class="LineNr">180 </span> <a href='003trace.cc.html#L196'>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">"'get "</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">", "</span> << offset<span class="Delimiter">.</span>original_string << <span class="Constant">"' should write to "</span> << names_to_string_without_quotes<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">" but '"</span> << product<span class="Delimiter">.</span>name << <span class="Constant">"' has type "</span> << names_to_string_without_quotes<span class="Delimiter">(</span>product<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L180" class="LineNr">180 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'get "</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">", "</span> << offset<span class="Delimiter">.</span>original_string << <span class="Constant">"' should write to "</span> << names_to_string_without_quotes<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">" but '"</span> << product<span class="Delimiter">.</span>name << <span class="Constant">"' has type "</span> << names_to_string_without_quotes<span class="Delimiter">(</span>product<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L181" class="LineNr">181 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L182" class="LineNr">182 </span> <span class="Delimiter">}</span> <span id="L183" class="LineNr">183 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -253,13 +256,13 @@ if ('onhashchange' in window) { <span id="L188" class="LineNr">188 </span> <span class="Comment">// Update GET base in Run</span> <span id="L189" class="LineNr">189 </span> <span class="Normal">int</span> base_address = base<span class="Delimiter">.</span>value<span class="Delimiter">;</span> <span id="L190" class="LineNr">190 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base_address == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L191" class="LineNr">191 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L191" class="LineNr">191 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L192" class="LineNr">192 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L193" class="LineNr">193 </span> <span class="Delimiter">}</span> <span id="L194" class="LineNr">194 </span> <span class="Normal">const</span> type_tree* base_type = base<span class="Delimiter">.</span>type<span class="Delimiter">;</span> <span id="L195" class="LineNr">195 </span> <span class="Comment">// Update GET base_type in Run</span> <span id="L196" class="LineNr">196 </span> <span class="Normal">int</span> offset = 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="L197" class="LineNr">197 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset < <span class="Constant">0</span> || offset >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// copied from Check above</span> +<span id="L197" class="LineNr">197 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset < <span class="Constant">0</span> || offset >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// copied from Check above</span> <span id="L198" class="LineNr">198 </span> <span class="Normal">int</span> src = base_address<span class="Delimiter">;</span> <span id="L199" class="LineNr">199 </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 < offset<span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> <span id="L200" class="LineNr">200 </span> src += size_of<span class="Delimiter">(</span><a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>base<span class="Delimiter">.</span>type<span class="Delimiter">,</span> i<span class="Delimiter">));</span> @@ -278,9 +281,9 @@ if ('onhashchange' in window) { <span id="L213" class="LineNr">213 </span> assert<span class="Delimiter">(</span>offset_value >= <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L214" class="LineNr">214 </span> <span class="Normal">const</span> type_tree* base_type = type<span class="Delimiter">;</span> <span id="L215" class="LineNr">215 </span> <span class="Comment">// Update base_type in element_type</span> -<span id="L216" class="LineNr">216 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">));</span> -<span id="L217" class="LineNr">217 </span> assert<span class="Delimiter">(</span>!get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L218" class="LineNr">218 </span> <span class="Normal">const</span> type_info& info = get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> +<span id="L216" class="LineNr">216 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">));</span> +<span id="L217" class="LineNr">217 </span> assert<span class="Delimiter">(</span>!get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L218" class="LineNr">218 </span> <span class="Normal">const</span> type_info& info = get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> <span id="L219" class="LineNr">219 </span> assert<span class="Delimiter">(</span>info<span class="Delimiter">.</span>kind == <a href='010vm.cc.html#L180'>CONTAINER</a><span class="Delimiter">);</span> <span id="L220" class="LineNr">220 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset_value >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>info<span class="Delimiter">.</span>elements<span class="Delimiter">))</span> <span class="Identifier">return</span> reagent<span class="Delimiter">();</span> <span class="Comment">// error handled elsewhere</span> <span id="L221" class="LineNr">221 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> element = info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>at<span class="Delimiter">(</span>offset_value<span class="Delimiter">);</span> @@ -352,37 +355,37 @@ if ('onhashchange' in window) { <span id="L287" class="LineNr">287 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L288" class="LineNr">288 </span>PUT<span class="Delimiter">,</span> <span id="L289" class="LineNr">289 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L290" class="LineNr">290 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"put"</span><span class="Delimiter">,</span> PUT<span class="Delimiter">);</span> +<span id="L290" class="LineNr">290 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"put"</span><span class="Delimiter">,</span> PUT<span class="Delimiter">);</span> <span id="L291" class="LineNr">291 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L292" class="LineNr">292 </span><span class="Normal">case</span> PUT: <span class="Delimiter">{</span> <span id="L293" class="LineNr">293 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">3</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L294" class="LineNr">294 </span> <a href='003trace.cc.html#L196'>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">"'put' expects exactly 3 ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L294" class="LineNr">294 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'put' expects exactly 3 ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L295" class="LineNr">295 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L296" class="LineNr">296 </span> <span class="Delimiter">}</span> <span id="L297" class="LineNr">297 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> base = 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 id="L298" class="LineNr">298 </span> <span class="Comment">// Update PUT base in Check</span> <span id="L299" class="LineNr">299 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!base<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L300" class="LineNr">300 </span> <a href='003trace.cc.html#L196'>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 'put' should be a container, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L300" class="LineNr">300 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'put' should be a container, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L301" class="LineNr">301 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L302" class="LineNr">302 </span> <span class="Delimiter">}</span> <span id="L303" class="LineNr">303 </span> <span class="Normal">const</span> type_tree* base_type = base<span class="Delimiter">.</span>type<span class="Delimiter">;</span> <span id="L304" class="LineNr">304 </span> <span class="Comment">// Update PUT base_type in Check</span> -<span id="L305" class="LineNr">305 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!base_type<span class="Delimiter">-></span>atom || base_type<span class="Delimiter">-></span>value == <span class="Constant">0</span> || !contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">)</span> || get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>kind != <a href='010vm.cc.html#L180'>CONTAINER</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L306" class="LineNr">306 </span> <a href='003trace.cc.html#L196'>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 'put' should be a container, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L305" class="LineNr">305 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!base_type<span class="Delimiter">-></span>atom || base_type<span class="Delimiter">-></span>value == <span class="Constant">0</span> || !contains_key<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">)</span> || get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>kind != <a href='010vm.cc.html#L180'>CONTAINER</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L306" class="LineNr">306 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'put' should be a container, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L307" class="LineNr">307 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L308" class="LineNr">308 </span> <span class="Delimiter">}</span> <span id="L309" class="LineNr">309 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> offset = 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 id="L310" class="LineNr">310 </span> <span class="Comment">// Update PUT offset in Check</span> <span id="L311" class="LineNr">311 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<span class="Delimiter">(</span>offset<span class="Delimiter">)</span> || !is_mu_scalar<span class="Delimiter">(</span>offset<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L312" class="LineNr">312 </span> <a href='003trace.cc.html#L196'>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 'put' should have type 'offset', 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L312" class="LineNr">312 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second ingredient of 'put' should have type 'offset', 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L313" class="LineNr">313 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L314" class="LineNr">314 </span> <span class="Delimiter">}</span> <span id="L315" class="LineNr">315 </span> <span class="Normal">int</span> offset_value = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L316" class="LineNr">316 </span> <span class="Comment">//: later layers will permit non-integer offsets</span> <span id="L317" class="LineNr">317 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_integer<span class="Delimiter">(</span>offset<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L318" class="LineNr">318 </span> offset_value = to_integer<span class="Delimiter">(</span>offset<span class="Delimiter">.</span>name<span class="Delimiter">);</span> -<span id="L319" class="LineNr">319 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset_value < <span class="Constant">0</span> || offset_value >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L320" class="LineNr">320 </span> <a href='003trace.cc.html#L196'>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">"invalid offset '"</span> << offset_value << <span class="Constant">"' for '"</span> << get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L319" class="LineNr">319 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset_value < <span class="Constant">0</span> || offset_value >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L320" class="LineNr">320 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"invalid offset '"</span> << offset_value << <span class="Constant">"' for '"</span> << get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>name << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L321" class="LineNr">321 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L322" class="LineNr">322 </span> <span class="Delimiter">}</span> <span id="L323" class="LineNr">323 </span> <span class="Delimiter">}</span> @@ -393,12 +396,12 @@ if ('onhashchange' in window) { <span id="L328" class="LineNr">328 </span> <span class="Comment">//: use base.type rather than base_type because later layers will introduce compound types</span> <span id="L329" class="LineNr">329 </span> <span class="Normal">const</span> reagent& element = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>base<span class="Delimiter">.</span>type<span class="Delimiter">,</span> offset_value<span class="Delimiter">);</span> <span id="L330" class="LineNr">330 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>element<span class="Delimiter">,</span> value<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L331" class="LineNr">331 </span> <a href='003trace.cc.html#L196'>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">"'put "</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">", "</span> << offset<span class="Delimiter">.</span>original_string << <span class="Constant">"' should write to "</span> << names_to_string_without_quotes<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">" but '"</span> << value<span class="Delimiter">.</span>name << <span class="Constant">"' has type "</span> << names_to_string_without_quotes<span class="Delimiter">(</span>value<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L331" class="LineNr">331 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'put "</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">", "</span> << offset<span class="Delimiter">.</span>original_string << <span class="Constant">"' should write to "</span> << names_to_string_without_quotes<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">" but '"</span> << value<span class="Delimiter">.</span>name << <span class="Constant">"' has type "</span> << names_to_string_without_quotes<span class="Delimiter">(</span>value<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L332" class="LineNr">332 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L333" class="LineNr">333 </span> <span class="Delimiter">}</span> <span id="L334" class="LineNr">334 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// no more checks necessary</span> <span id="L335" class="LineNr">335 </span> <span class="Normal">if</span> <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>name != inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L336" class="LineNr">336 </span> <a href='003trace.cc.html#L196'>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">"product of 'put' must be first ingredient '"</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">"', but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L336" class="LineNr">336 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"product of 'put' must be first ingredient '"</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">"', but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L337" class="LineNr">337 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L338" class="LineNr">338 </span> <span class="Delimiter">}</span> <span id="L339" class="LineNr">339 </span> <span class="Comment">// End PUT Product Checks</span> @@ -410,13 +413,13 @@ if ('onhashchange' in window) { <span id="L345" class="LineNr">345 </span> <span class="Comment">// Update PUT base in Run</span> <span id="L346" class="LineNr">346 </span> <span class="Normal">int</span> base_address = base<span class="Delimiter">.</span>value<span class="Delimiter">;</span> <span id="L347" class="LineNr">347 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base_address == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L348" class="LineNr">348 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L348" class="LineNr">348 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L349" class="LineNr">349 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L350" class="LineNr">350 </span> <span class="Delimiter">}</span> <span id="L351" class="LineNr">351 </span> <span class="Normal">const</span> type_tree* base_type = base<span class="Delimiter">.</span>type<span class="Delimiter">;</span> <span id="L352" class="LineNr">352 </span> <span class="Comment">// Update PUT base_type in Run</span> <span id="L353" class="LineNr">353 </span> <span class="Normal">int</span> offset = 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="L354" class="LineNr">354 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset < <span class="Constant">0</span> || offset >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// copied from Check above</span> +<span id="L354" class="LineNr">354 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset < <span class="Constant">0</span> || offset >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// copied from Check above</span> <span id="L355" class="LineNr">355 </span> <span class="Normal">int</span> <a href='043space.cc.html#L101'>address</a> = base_address<span class="Delimiter">;</span> <span id="L356" class="LineNr">356 </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 < offset<span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> <span id="L357" class="LineNr">357 </span> <a href='043space.cc.html#L101'>address</a> += size_of<span class="Delimiter">(</span><a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>base<span class="Delimiter">.</span>type<span class="Delimiter">,</span> i<span class="Delimiter">));</span> @@ -427,7 +430,7 @@ if ('onhashchange' in window) { <span id="L362" class="LineNr">362 </span> write_products =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L363" class="LineNr">363 </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#L141'>SIZE</a><span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">));</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L364" class="LineNr">364 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing "</span> << no_scientific<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <span class="Constant">" in location "</span> << address+i << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L365" class="LineNr">365 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> address+i<span class="Delimiter">,</span> ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> +<span id="L365" class="LineNr">365 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> address+i<span class="Delimiter">,</span> ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span id="L366" class="LineNr">366 </span> <span class="Delimiter">}</span> <span id="L367" class="LineNr">367 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L368" class="LineNr">368 </span><span class="Delimiter">}</span> @@ -503,9 +506,9 @@ if ('onhashchange' in window) { <span id="L438" class="LineNr">438 </span><span class="Comment">//: a call to transform_all. But we do want to detect this situation and raise</span> <span id="L439" class="LineNr">439 </span><span class="Comment">//: an error. This field will help us raise such errors.</span> <span id="L440" class="LineNr">440 </span><span class="Delimiter">:(before "End type_info Fields")</span> -<span id="L441" class="LineNr">441 </span><span class="Normal">int</span> Num_calls_to_transform_all_at_first_definition<span class="Delimiter">;</span> +<span id="L441" class="LineNr">441 </span><span class="Normal">int</span> <span class="Special">Num_calls_to_transform_all_at_first_definition</span><span class="Delimiter">;</span> <span id="L442" class="LineNr">442 </span><span class="Delimiter">:(before "End type_info Constructor")</span> -<span id="L443" class="LineNr">443 </span>Num_calls_to_transform_all_at_first_definition = -<span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L443" class="LineNr">443 </span><span class="Special">Num_calls_to_transform_all_at_first_definition</span> = -<span class="Constant">1</span><span class="Delimiter">;</span> <span id="L444" class="LineNr">444 </span> <span id="L445" class="LineNr">445 </span><span class="Delimiter">:(code)</span> <span id="L446" class="LineNr">446 </span><span class="Normal">void</span> <a href='030container.cc.html#L446'>insert_container</a><span class="Delimiter">(</span><span class="Normal">const</span> string& command<span class="Delimiter">,</span> <a href='010vm.cc.html#L178'>kind_of_type</a> kind<span class="Delimiter">,</span> istream& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -513,25 +516,25 @@ if ('onhashchange' in window) { <span id="L448" class="LineNr">448 </span> string name = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L449" class="LineNr">449 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L450" class="LineNr">450 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L451" class="LineNr">451 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete container definition at <a href='003trace.cc.html#L225'>end</a> of file (0)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L451" class="LineNr">451 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete container definition at <a href='003trace.cc.html#L225'>end</a> of file (0)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L452" class="LineNr">452 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L453" class="LineNr">453 </span> <span class="Delimiter">}</span> <span id="L454" class="LineNr">454 </span> <span class="Comment">// End container Name Refinements</span> <span id="L455" class="LineNr">455 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"--- defining "</span> << command << <span class="Constant">' '</span> << name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L456" class="LineNr">456 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">)</span> -<span id="L457" class="LineNr">457 </span> || get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L458" class="LineNr">458 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> +<span id="L456" class="LineNr">456 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> name<span class="Delimiter">)</span> +<span id="L457" class="LineNr">457 </span> || get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> name<span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L458" class="LineNr">458 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> name<span class="Delimiter">,</span> <span class="Special">Next_type_ordinal</span>++<span class="Delimiter">);</span> <span id="L459" class="LineNr">459 </span> <span class="Delimiter">}</span> -<span id="L460" class="LineNr">460 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"type number: "</span> << get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L460" class="LineNr">460 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"type number: "</span> << get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> name<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L461" class="LineNr">461 </span> <a href='030container.cc.html#L518'>skip_bracket</a><span class="Delimiter">(</span>in<span class="Delimiter">,</span> <span class="Constant">"'"</span>+command+<span class="Constant">"' must begin with '['"</span><span class="Delimiter">);</span> -<span id="L462" class="LineNr">462 </span> type_info& info = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">));</span> -<span id="L463" class="LineNr">463 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>info<span class="Delimiter">.</span>Num_calls_to_transform_all_at_first_definition == -<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L462" class="LineNr">462 </span> type_info& info = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> name<span class="Delimiter">));</span> +<span id="L463" class="LineNr">463 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>info<span class="Delimiter">.</span><span class="Special">Num_calls_to_transform_all_at_first_definition</span> == -<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L464" class="LineNr">464 </span> <span class="Comment">// initial definition of this container</span> -<span id="L465" class="LineNr">465 </span> info<span class="Delimiter">.</span>Num_calls_to_transform_all_at_first_definition = Num_calls_to_transform_all<span class="Delimiter">;</span> +<span id="L465" class="LineNr">465 </span> info<span class="Delimiter">.</span><span class="Special">Num_calls_to_transform_all_at_first_definition</span> = <span class="Special">Num_calls_to_transform_all</span><span class="Delimiter">;</span> <span id="L466" class="LineNr">466 </span> <span class="Delimiter">}</span> -<span id="L467" class="LineNr">467 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>info<span class="Delimiter">.</span>Num_calls_to_transform_all_at_first_definition != Num_calls_to_transform_all<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L467" class="LineNr">467 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>info<span class="Delimiter">.</span><span class="Special">Num_calls_to_transform_all_at_first_definition</span> != <span class="Special">Num_calls_to_transform_all</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L468" class="LineNr">468 </span> <span class="Comment">// extension after transform_all</span> -<span id="L469" class="LineNr">469 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"there was a call to transform_all() between the definition of container '"</span> << name << <span class="Constant">"' and a subsequent extension. This is not supported, since any recipes that used '"</span> << name << <span class="Constant">"' values have already been transformed and </span><span class="cSpecial">\"</span><span class="Constant">frozen</span><span class="cSpecial">\"</span><span class="Constant">.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L469" class="LineNr">469 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"there was a call to transform_all() between the definition of container '"</span> << name << <span class="Constant">"' and a subsequent extension. This is not supported, since any recipes that used '"</span> << name << <span class="Constant">"' values have already been transformed and \"</span>frozen\<span class="Constant">".\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L470" class="LineNr">470 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L471" class="LineNr">471 </span> <span class="Delimiter">}</span> <span id="L472" class="LineNr">472 </span> info<span class="Delimiter">.</span>name = name<span class="Delimiter">;</span> @@ -541,12 +544,12 @@ if ('onhashchange' in window) { <span id="L476" class="LineNr">476 </span> string element = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L477" class="LineNr">477 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>element<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L478" class="LineNr">478 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L479" class="LineNr">479 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete container definition at <a href='003trace.cc.html#L225'>end</a> of file (1)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L479" class="LineNr">479 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete container definition at <a href='003trace.cc.html#L225'>end</a> of file (1)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L480" class="LineNr">480 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L481" class="LineNr">481 </span> <span class="Delimiter">}</span> <span id="L482" class="LineNr">482 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>element == <span class="Constant">"]"</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L483" class="LineNr">483 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L484" class="LineNr">484 </span> <a href='003trace.cc.html#L196'>raise</a> << command << <span class="Constant">" '"</span> << name << <span class="Constant">"' contains multiple elements on a single line. Containers and exclusive containers must only contain elements, one to a line, no code.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L484" class="LineNr">484 </span> <a href='003trace.cc.html#L196'>raise</a> << command << <span class="Constant">" '"</span> << name << <span class="Constant">"' contains multiple elements on a single line. Containers and exclusive containers must only contain elements, one to a line, no code.\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L485" class="LineNr">485 </span> <span class="Comment">// skip rest of container declaration</span> <span id="L486" class="LineNr">486 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L487" class="LineNr">487 </span> <a href='011load.cc.html#L211'>skip_whitespace_and_comments</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> @@ -570,13 +573,13 @@ if ('onhashchange' in window) { <span id="L505" class="LineNr">505 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L506" class="LineNr">506 </span> <span class="Delimiter">}</span> <span id="L507" class="LineNr">507 </span> assert<span class="Delimiter">(</span>!type<span class="Delimiter">-></span>name<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L508" class="LineNr">508 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L509" class="LineNr">509 </span> type<span class="Delimiter">-></span>value = get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> +<span id="L508" class="LineNr">508 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L509" class="LineNr">509 </span> type<span class="Delimiter">-></span>value = get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> <span id="L510" class="LineNr">510 </span> <span class="Delimiter">}</span> <span id="L511" class="LineNr">511 </span> <span class="Comment">// End insert_container Special-cases</span> <span id="L512" class="LineNr">512 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>name != <span class="Constant">"->"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Comment">// used in recipe types</span> -<span id="L513" class="LineNr">513 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L514" class="LineNr">514 </span> type<span class="Delimiter">-></span>value = get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> +<span id="L513" class="LineNr">513 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">,</span> <span class="Special">Next_type_ordinal</span>++<span class="Delimiter">);</span> +<span id="L514" class="LineNr">514 </span> type<span class="Delimiter">-></span>value = get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> <span id="L515" class="LineNr">515 </span> <span class="Delimiter">}</span> <span id="L516" class="LineNr">516 </span><span class="Delimiter">}</span> <span id="L517" class="LineNr">517 </span> @@ -607,12 +610,12 @@ if ('onhashchange' in window) { <span id="L542" class="LineNr">542 </span><span class="traceContains">+mem: storing 34 in location 2</span> <span id="L543" class="LineNr">543 </span> <span id="L544" class="LineNr">544 </span><span class="Delimiter">:(after "Transform.push_back(expand_type_abbreviations)")</span> -<span id="L545" class="LineNr">545 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='030container.cc.html#L549'>expand_type_abbreviations_in_containers</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L545" class="LineNr">545 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='030container.cc.html#L549'>expand_type_abbreviations_in_containers</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L546" class="LineNr">546 </span><span class="Delimiter">:(code)</span> <span id="L547" class="LineNr">547 </span><span class="Comment">// extremely inefficient; we process all types over and over again, once for every single recipe</span> <span id="L548" class="LineNr">548 </span><span class="Comment">// but it doesn't seem to cause any noticeable slowdown</span> <span id="L549" class="LineNr">549 </span><span class="Normal">void</span> <a href='030container.cc.html#L549'>expand_type_abbreviations_in_containers</a><span class="Delimiter">(</span><span class="Normal">const</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> <span class="Comment">/*</span><span class="Comment">unused</span><span class="Comment">*/</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L550" class="LineNr">550 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<type_ordinal<span class="Delimiter">,</span> type_info>::iterator p = Type<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Type<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L550" class="LineNr">550 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<type_ordinal<span class="Delimiter">,</span> type_info>::iterator p = <span class="Special">Type</span><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Type</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L551" class="LineNr">551 </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#L141'>SIZE</a><span class="Delimiter">(</span>p<span class="Delimiter">-></span>second<span class="Delimiter">.</span>elements<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L552" class="LineNr">552 </span> expand_type_abbreviations<span class="Delimiter">(</span>p<span class="Delimiter">-></span>second<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">);</span> <span id="L553" class="LineNr">553 </span> <span class="Delimiter">}</span> @@ -621,23 +624,23 @@ if ('onhashchange' in window) { <span id="L556" class="LineNr">556 </span><span class="Comment">//: ensure scenarios are consistent by always starting new container</span> <span id="L557" class="LineNr">557 </span><span class="Comment">//: declarations at the same type number</span> <span id="L558" class="LineNr">558 </span><span class="Delimiter">:(before "End Reset")</span> <span class="Comment">//: for tests</span> -<span id="L559" class="LineNr">559 </span>Next_type_ordinal = <span class="Constant">1000</span><span class="Delimiter">;</span> +<span id="L559" class="LineNr">559 </span><span class="Special">Next_type_ordinal</span> = <span class="Constant">1000</span><span class="Delimiter">;</span> <span id="L560" class="LineNr">560 </span><span class="Delimiter">:(before "End Test Run Initialization")</span> -<span id="L561" class="LineNr">561 </span>assert<span class="Delimiter">(</span>Next_type_ordinal < <span class="Constant">1000</span><span class="Delimiter">);</span> +<span id="L561" class="LineNr">561 </span>assert<span class="Delimiter">(</span><span class="Special">Next_type_ordinal</span> < <span class="Constant">1000</span><span class="Delimiter">);</span> <span id="L562" class="LineNr">562 </span> <span id="L563" class="LineNr">563 </span><span class="Delimiter">:(code)</span> <span id="L564" class="LineNr">564 </span><span class="Normal">void</span> test_error_on_transform_all_between_container_definition_and_extension<span class="Delimiter">()</span> <span class="Delimiter">{</span> <span id="L565" class="LineNr">565 </span> <span class="Comment">// define a container</span> -<span id="L566" class="LineNr">566 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L567" class="LineNr">567 </span> <span class="Constant">" a:num</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L568" class="LineNr">568 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L566" class="LineNr">566 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo [\n"</span> +<span id="L567" class="LineNr">567 </span> <span class="Constant">" a:num\n"</span> +<span id="L568" class="LineNr">568 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L569" class="LineNr">569 </span> <span class="Comment">// try to extend the container after transform</span> <span id="L570" class="LineNr">570 </span> <a href='012transform.cc.html#L46'>transform_all</a><span class="Delimiter">();</span> <span id="L571" class="LineNr">571 </span> <a href='003trace.cc.html#L256'>CHECK_TRACE_DOESNT_CONTAIN_ERRORS</a><span class="Delimiter">();</span> -<span id="L572" class="LineNr">572 </span> Hide_errors =<span class="Constant"> true</span><span class="Delimiter">;</span> -<span id="L573" class="LineNr">573 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L574" class="LineNr">574 </span> <span class="Constant">" b:num</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L575" class="LineNr">575 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L572" class="LineNr">572 </span> <span class="Special">Hide_errors</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L573" class="LineNr">573 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo [\n"</span> +<span id="L574" class="LineNr">574 </span> <span class="Constant">" b:num\n"</span> +<span id="L575" class="LineNr">575 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L576" class="LineNr">576 </span> <a href='003trace.cc.html#L255'>CHECK_TRACE_CONTAINS_ERRORS</a><span class="Delimiter">();</span> <span id="L577" class="LineNr">577 </span><span class="Delimiter">}</span> <span id="L578" class="LineNr">578 </span> @@ -662,11 +665,11 @@ if ('onhashchange' in window) { <span id="L597" class="LineNr">597 </span>$error: <span class="Constant">0</span> <span id="L598" class="LineNr">598 </span> <span id="L599" class="LineNr">599 </span><span class="Delimiter">:(before "End Type Modifying Transforms")</span> -<span id="L600" class="LineNr">600 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_or_set_invalid_types<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L600" class="LineNr">600 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_or_set_invalid_types<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L601" class="LineNr">601 </span> <span id="L602" class="LineNr">602 </span><span class="Delimiter">:(code)</span> <span id="L603" class="LineNr">603 </span><span class="Normal">void</span> check_or_set_invalid_types<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="L604" class="LineNr">604 </span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L604" class="LineNr">604 </span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L605" class="LineNr">605 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- check for invalid types in <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L606" class="LineNr">606 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L607" class="LineNr">607 </span> instruction& inst = caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> @@ -692,10 +695,10 @@ if ('onhashchange' in window) { <span id="L627" class="LineNr">627 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L628" class="LineNr">628 </span> <span class="Delimiter">}</span> <span id="L629" class="LineNr">629 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L630" class="LineNr">630 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L630" class="LineNr">630 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L631" class="LineNr">631 </span> assert<span class="Delimiter">(</span>!type<span class="Delimiter">-></span>name<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L632" class="LineNr">632 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> -<span id="L633" class="LineNr">633 </span> type<span class="Delimiter">-></span>value = get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> +<span id="L632" class="LineNr">632 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> +<span id="L633" class="LineNr">633 </span> type<span class="Delimiter">-></span>value = get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> <span id="L634" class="LineNr">634 </span> <span class="Normal">else</span> <span id="L635" class="LineNr">635 </span> <a href='003trace.cc.html#L196'>raise</a> << location_for_error_messages << <span class="Constant">"unknown type "</span> << type<span class="Delimiter">-></span>name << <span class="Constant">" in "</span> << name_for_error_messages << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L636" class="LineNr">636 </span> <span class="Delimiter">}</span> @@ -730,7 +733,7 @@ if ('onhashchange' in window) { <span id="L665" class="LineNr">665 </span> <span id="L666" class="LineNr">666 </span><span class="Delimiter">:(code)</span> <span id="L667" class="LineNr">667 </span><span class="Normal">void</span> check_container_field_types<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L668" class="LineNr">668 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<type_ordinal<span class="Delimiter">,</span> type_info>::iterator p = Type<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Type<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L668" class="LineNr">668 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<type_ordinal<span class="Delimiter">,</span> type_info>::iterator p = <span class="Special">Type</span><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Type</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L669" class="LineNr">669 </span> <span class="Normal">const</span> type_info& info = p<span class="Delimiter">-></span>second<span class="Delimiter">;</span> <span id="L670" class="LineNr">670 </span> <span class="Comment">// Check Container Field Types(info)</span> <span id="L671" class="LineNr">671 </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#L141'>SIZE</a><span class="Delimiter">(</span>info<span class="Delimiter">.</span>elements<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> @@ -746,21 +749,21 @@ if ('onhashchange' in window) { <span id="L681" class="LineNr">681 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L682" class="LineNr">682 </span> <span class="Delimiter">}</span> <span id="L683" class="LineNr">683 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>value != <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Comment">// value 0 = compound types (layer parse_tree) or type ingredients (layer shape_shifting_container)</span> -<span id="L684" class="LineNr">684 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> +<span id="L684" class="LineNr">684 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span id="L685" class="LineNr">685 </span> <a href='003trace.cc.html#L196'>raise</a> << location_for_error_messages << <span class="Constant">"unknown type in "</span> << name_for_error_messages << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L686" class="LineNr">686 </span> <span class="Delimiter">}</span> <span id="L687" class="LineNr">687 </span><span class="Delimiter">}</span> <span id="L688" class="LineNr">688 </span> <span id="L689" class="LineNr">689 </span>string to_original_string<span class="Delimiter">(</span><span class="Normal">const</span> <a href='010vm.cc.html#L125'>type_ordinal</a> t<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L690" class="LineNr">690 </span> ostringstream out<span class="Delimiter">;</span> -<span id="L691" class="LineNr">691 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> t<span class="Delimiter">))</span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> -<span id="L692" class="LineNr">692 </span> <span class="Normal">const</span> type_info& info = get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> t<span class="Delimiter">);</span> +<span id="L691" class="LineNr">691 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> t<span class="Delimiter">))</span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> +<span id="L692" class="LineNr">692 </span> <span class="Normal">const</span> type_info& info = get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> t<span class="Delimiter">);</span> <span id="L693" class="LineNr">693 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>info<span class="Delimiter">.</span>kind == <a href='010vm.cc.html#L179'>PRIMITIVE</a><span class="Delimiter">)</span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> -<span id="L694" class="LineNr">694 </span> out << <span class="Delimiter">(</span>info<span class="Delimiter">.</span>kind == <a href='010vm.cc.html#L180'>CONTAINER</a> ? <span class="Constant">"container"</span> : <span class="Constant">"exclusive-container"</span><span class="Delimiter">)</span> << <span class="Constant">" "</span> << info<span class="Delimiter">.</span>name << <span class="Constant">" [</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L694" class="LineNr">694 </span> out << <span class="Delimiter">(</span>info<span class="Delimiter">.</span>kind == <a href='010vm.cc.html#L180'>CONTAINER</a> ? <span class="Constant">"container"</span> : <span class="Constant">"exclusive-container"</span><span class="Delimiter">)</span> << <span class="Constant">" "</span> << info<span class="Delimiter">.</span>name << <span class="Constant">" [\n"</span><span class="Delimiter">;</span> <span id="L695" class="LineNr">695 </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#L141'>SIZE</a><span class="Delimiter">(</span>info<span class="Delimiter">.</span>elements<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L696" class="LineNr">696 </span> out << <span class="Constant">" "</span> << info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L696" class="LineNr">696 </span> out << <span class="Constant">" "</span> << info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"\n"</span><span class="Delimiter">;</span> <span id="L697" class="LineNr">697 </span> <span class="Delimiter">}</span> -<span id="L698" class="LineNr">698 </span> out << <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L698" class="LineNr">698 </span> out << <span class="Constant">"]\n"</span><span class="Delimiter">;</span> <span id="L699" class="LineNr">699 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> <span id="L700" class="LineNr">700 </span><span class="Delimiter">}</span> </pre> diff --git a/html/031merge.cc.html b/html/031merge.cc.html index 2650b295..a2e757bd 100644 --- a/html/031merge.cc.html +++ b/html/031merge.cc.html @@ -11,21 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.cSpecial { color: #008000; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -60,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/031merge.cc'>https://github.com/akkartik/mu/blob/master/031merge.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Construct types out of their constituent fields.</span> <span id="L2" class="LineNr"> 2 </span> @@ -77,7 +79,7 @@ if ('onhashchange' in window) { <span id="L14" class="LineNr"> 14 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L15" class="LineNr"> 15 </span>MERGE<span class="Delimiter">,</span> <span id="L16" class="LineNr"> 16 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L17" class="LineNr"> 17 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"merge"</span><span class="Delimiter">,</span> MERGE<span class="Delimiter">);</span> +<span id="L17" class="LineNr"> 17 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"merge"</span><span class="Delimiter">,</span> MERGE<span class="Delimiter">);</span> <span id="L18" class="LineNr"> 18 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L19" class="LineNr"> 19 </span><span class="Normal">case</span> MERGE: <span class="Delimiter">{</span> <span id="L20" class="LineNr"> 20 </span> <span class="Comment">// type-checking in a separate transform below</span> @@ -173,29 +175,29 @@ if ('onhashchange' in window) { <span id="L110" class="LineNr">110 </span><span class="Delimiter">};</span> <span id="L111" class="LineNr">111 </span> <span id="L112" class="LineNr">112 </span><span class="Delimiter">:(before "End Checks")</span> -<span id="L113" class="LineNr">113 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='031merge.cc.html#L115'>check_merge_calls</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L113" class="LineNr">113 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='031merge.cc.html#L115'>check_merge_calls</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L114" class="LineNr">114 </span><span class="Delimiter">:(code)</span> <span id="L115" class="LineNr">115 </span><span class="Normal">void</span> <a href='031merge.cc.html#L115'>check_merge_calls</a><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="L116" class="LineNr">116 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L116" class="LineNr">116 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L117" class="LineNr">117 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- type-check merge instructions in <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><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#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L119" class="LineNr">119 </span> <span class="Normal">const</span> instruction& inst = caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L120" class="LineNr">120 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name != <span class="Constant">"merge"</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L121" class="LineNr">121 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L122" class="LineNr">122 </span> <a href='003trace.cc.html#L196'>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">"'merge' should yield a single product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L122" class="LineNr">122 </span> <a href='003trace.cc.html#L196'>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">"'merge' should yield a single product in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L123" class="LineNr">123 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L124" class="LineNr">124 </span> <span class="Delimiter">}</span> <span id="L125" class="LineNr">125 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> product = 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 id="L126" class="LineNr">126 </span> <span class="Comment">// Update product While Type-checking Merge</span> <span id="L127" class="LineNr">127 </span> <span class="Normal">const</span> type_tree* product_base_type = product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom ? product<span class="Delimiter">.</span>type : product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">;</span> <span id="L128" class="LineNr">128 </span> assert<span class="Delimiter">(</span>product_base_type<span class="Delimiter">-></span>atom<span class="Delimiter">);</span> -<span id="L129" class="LineNr">129 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>product_base_type<span class="Delimiter">-></span>value == <span class="Constant">0</span> || !contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> product_base_type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L130" class="LineNr">130 </span> <a href='003trace.cc.html#L196'>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">"'merge' should yield a container in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L129" class="LineNr">129 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>product_base_type<span class="Delimiter">-></span>value == <span class="Constant">0</span> || !contains_key<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> product_base_type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L130" class="LineNr">130 </span> <a href='003trace.cc.html#L196'>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">"'merge' should yield a container in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L131" class="LineNr">131 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L132" class="LineNr">132 </span> <span class="Delimiter">}</span> -<span id="L133" class="LineNr">133 </span> <span class="Normal">const</span> type_info& info = get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> product_base_type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> +<span id="L133" class="LineNr">133 </span> <span class="Normal">const</span> type_info& info = get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> product_base_type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> <span id="L134" class="LineNr">134 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>info<span class="Delimiter">.</span>kind != <a href='010vm.cc.html#L180'>CONTAINER</a> && info<span class="Delimiter">.</span>kind != <a href='010vm.cc.html#L181'>EXCLUSIVE_CONTAINER</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L135" class="LineNr">135 </span> <a href='003trace.cc.html#L196'>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">"'merge' should yield a container in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L135" class="LineNr">135 </span> <a href='003trace.cc.html#L196'>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">"'merge' should yield a container in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L136" class="LineNr">136 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L137" class="LineNr">137 </span> <span class="Delimiter">}</span> <span id="L138" class="LineNr">138 </span> <a href='031merge.cc.html#L142'>check_merge_call</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">,</span> product<span class="Delimiter">,</span> caller<span class="Delimiter">,</span> inst<span class="Delimiter">);</span> @@ -210,14 +212,14 @@ if ('onhashchange' in window) { <span id="L147" class="LineNr">147 </span> assert<span class="Delimiter">(</span>!state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> <span id="L148" class="LineNr">148 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"transform"</span><span class="Delimiter">)</span> << ingredient_index << <span class="Constant">" vs "</span> << <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>ingredients<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L149" class="LineNr">149 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>ingredient_index >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>ingredients<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L150" class="LineNr">150 </span> <a href='003trace.cc.html#L196'>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">"too few ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L150" class="LineNr">150 </span> <a href='003trace.cc.html#L196'>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">"too few ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L151" class="LineNr">151 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L152" class="LineNr">152 </span> <span class="Delimiter">}</span> <span id="L153" class="LineNr">153 </span> reagent& container = state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>top<span class="Delimiter">().</span>container<span class="Delimiter">;</span> <span id="L154" class="LineNr">154 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!container<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">// error handled elsewhere</span> <span id="L155" class="LineNr">155 </span> <span class="Normal">const</span> type_tree* top_root_type = container<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom ? container<span class="Delimiter">.</span>type : container<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">;</span> <span id="L156" class="LineNr">156 </span> assert<span class="Delimiter">(</span>top_root_type<span class="Delimiter">-></span>atom<span class="Delimiter">);</span> -<span id="L157" class="LineNr">157 </span> type_info& container_info = get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> top_root_type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> +<span id="L157" class="LineNr">157 </span> type_info& container_info = get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> top_root_type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> <span id="L158" class="LineNr">158 </span> <span class="Normal">switch</span> <span class="Delimiter">(</span>container_info<span class="Delimiter">.</span>kind<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L159" class="LineNr">159 </span> <span class="Normal">case</span> <a href='010vm.cc.html#L180'>CONTAINER</a>: <span class="Delimiter">{</span> <span id="L160" class="LineNr">160 </span> <span class="Comment">// degenerate case: merge with the same type always succeeds</span> @@ -229,11 +231,11 @@ if ('onhashchange' in window) { <span id="L166" class="LineNr">166 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='021check_instruction.cc.html#L91'>types_coercible</a><span class="Delimiter">(</span>expected_ingredient<span class="Delimiter">,</span> ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">)))</span> <span class="Delimiter">{</span> <span id="L167" class="LineNr">167 </span> ++ingredient_index<span class="Delimiter">;</span> <span id="L168" class="LineNr">168 </span> ++state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>top<span class="Delimiter">().</span>container_element_index<span class="Delimiter">;</span> -<span id="L169" class="LineNr">169 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>top<span class="Delimiter">().</span>container_element_index >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> get_base_type<span class="Delimiter">(</span>state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>top<span class="Delimiter">().</span>container<span class="Delimiter">.</span>type<span class="Delimiter">)-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L169" class="LineNr">169 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>top<span class="Delimiter">().</span>container_element_index >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> get_base_type<span class="Delimiter">(</span>state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>top<span class="Delimiter">().</span>container<span class="Delimiter">.</span>type<span class="Delimiter">)-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L170" class="LineNr">170 </span> state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>pop<span class="Delimiter">();</span> <span id="L171" class="LineNr">171 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L172" class="LineNr">172 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>ingredient_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>ingredients<span class="Delimiter">))</span> -<span id="L173" class="LineNr">173 </span> <a href='003trace.cc.html#L196'>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">"too many ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L173" class="LineNr">173 </span> <a href='003trace.cc.html#L196'>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">"too many ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L174" class="LineNr">174 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L175" class="LineNr">175 </span> <span class="Delimiter">}</span> <span id="L176" class="LineNr">176 </span> ++state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>top<span class="Delimiter">().</span>container_element_index<span class="Delimiter">;</span> @@ -249,9 +251,9 @@ if ('onhashchange' in window) { <span id="L186" class="LineNr">186 </span> <span class="Comment">// End check_merge_call Special-cases</span> <span id="L187" class="LineNr">187 </span> <span class="Normal">default</span>: <span class="Delimiter">{</span> <span id="L188" class="LineNr">188 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>container<span class="Delimiter">,</span> ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L189" class="LineNr">189 </span> <a href='003trace.cc.html#L196'>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">"incorrect type of ingredient "</span> << ingredient_index << <span class="Constant">" in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L190" class="LineNr">190 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" (expected '"</span> << debug_string<span class="Delimiter">(</span>container<span class="Delimiter">)</span> << <span class="Constant">"')</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L191" class="LineNr">191 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" (got '"</span> << debug_string<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">))</span> << <span class="Constant">"')</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L189" class="LineNr">189 </span> <a href='003trace.cc.html#L196'>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">"incorrect type of ingredient "</span> << ingredient_index << <span class="Constant">" in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L190" class="LineNr">190 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" (expected '"</span> << debug_string<span class="Delimiter">(</span>container<span class="Delimiter">)</span> << <span class="Constant">"')\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L191" class="LineNr">191 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" (got '"</span> << debug_string<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">))</span> << <span class="Constant">"')\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L192" class="LineNr">192 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L193" class="LineNr">193 </span> <span class="Delimiter">}</span> <span id="L194" class="LineNr">194 </span> ++ingredient_index<span class="Delimiter">;</span> @@ -260,11 +262,11 @@ if ('onhashchange' in window) { <span id="L197" class="LineNr">197 </span> state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>pop<span class="Delimiter">();</span> <span id="L198" class="LineNr">198 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L199" class="LineNr">199 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>ingredient_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>ingredients<span class="Delimiter">))</span> -<span id="L200" class="LineNr">200 </span> <a href='003trace.cc.html#L196'>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">"too many ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L200" class="LineNr">200 </span> <a href='003trace.cc.html#L196'>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">"too many ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L201" class="LineNr">201 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L202" class="LineNr">202 </span> <span class="Delimiter">}</span> <span id="L203" class="LineNr">203 </span> ++state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>top<span class="Delimiter">().</span>container_element_index<span class="Delimiter">;</span> -<span id="L204" class="LineNr">204 </span> <span class="Delimiter">}</span> <span class="Normal">while</span> <span class="Delimiter">(</span>state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>top<span class="Delimiter">().</span>container_element_index >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> get_base_type<span class="Delimiter">(</span>state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>top<span class="Delimiter">().</span>container<span class="Delimiter">.</span>type<span class="Delimiter">)-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">));</span> +<span id="L204" class="LineNr">204 </span> <span class="Delimiter">}</span> <span class="Normal">while</span> <span class="Delimiter">(</span>state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>top<span class="Delimiter">().</span>container_element_index >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> get_base_type<span class="Delimiter">(</span>state<span class="Delimiter">.</span>data<span class="Delimiter">.</span>top<span class="Delimiter">().</span>container<span class="Delimiter">.</span>type<span class="Delimiter">)-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">));</span> <span id="L205" class="LineNr">205 </span> <span class="Delimiter">}</span> <span id="L206" class="LineNr">206 </span> <span class="Delimiter">}</span> <span id="L207" class="LineNr">207 </span> <span class="Delimiter">}</span> diff --git a/html/032array.cc.html b/html/032array.cc.html index 57c3220b..8e3b58b5 100644 --- a/html/032array.cc.html +++ b/html/032array.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } .traceContains { color: #008000; } --> @@ -61,6 +63,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/032array.cc'>https://github.com/akkartik/mu/blob/master/032array.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Arrays contain a variable number of elements of the same type. Their value</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: starts with the length of the array.</span> @@ -80,33 +83,33 @@ if ('onhashchange' in window) { <span id="L16" class="LineNr"> 16 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L17" class="LineNr"> 17 </span>CREATE_ARRAY<span class="Delimiter">,</span> <span id="L18" class="LineNr"> 18 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L19" class="LineNr"> 19 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"create-array"</span><span class="Delimiter">,</span> CREATE_ARRAY<span class="Delimiter">);</span> +<span id="L19" class="LineNr"> 19 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"create-array"</span><span class="Delimiter">,</span> CREATE_ARRAY<span class="Delimiter">);</span> <span id="L20" class="LineNr"> 20 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L21" class="LineNr"> 21 </span><span class="Normal">case</span> CREATE_ARRAY: <span class="Delimiter">{</span> <span id="L22" class="LineNr"> 22 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L23" class="LineNr"> 23 </span> <a href='003trace.cc.html#L196'>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">"'create-array' needs one product and no ingredients but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> +<span id="L23" class="LineNr"> 23 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'create-array' needs one product and no ingredients but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span id="L24" class="LineNr"> 24 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L25" class="LineNr"> 25 </span> <span class="Delimiter">}</span> <span id="L26" class="LineNr"> 26 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> product = 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 id="L27" class="LineNr"> 27 </span> <span class="Comment">// Update CREATE_ARRAY product in Check</span> <span id="L28" class="LineNr"> 28 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_array<span class="Delimiter">(</span>product<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L29" class="LineNr"> 29 </span> <a href='003trace.cc.html#L196'>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">"'create-array' cannot create non-array '"</span> << product<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L29" class="LineNr"> 29 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'create-array' cannot create non-array '"</span> << product<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L30" class="LineNr"> 30 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L31" class="LineNr"> 31 </span> <span class="Delimiter">}</span> <span id="L32" class="LineNr"> 32 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L33" class="LineNr"> 33 </span> <a href='003trace.cc.html#L196'>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">"create array of what? '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L33" class="LineNr"> 33 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"create array of what? '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L34" class="LineNr"> 34 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L35" class="LineNr"> 35 </span> <span class="Delimiter">}</span> <span id="L36" class="LineNr"> 36 </span> <span class="Comment">// 'create-array' will need to check properties rather than types</span> <span id="L37" class="LineNr"> 37 </span> type_tree* array_length_from_type = product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">;</span> <span id="L38" class="LineNr"> 38 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!array_length_from_type<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L39" class="LineNr"> 39 </span> <a href='003trace.cc.html#L196'>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">"create array of what size? '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L39" class="LineNr"> 39 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"create array of what size? '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L40" class="LineNr"> 40 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L41" class="LineNr"> 41 </span> <span class="Delimiter">}</span> <span id="L42" class="LineNr"> 42 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span id="L43" class="LineNr"> 43 </span> array_length_from_type = array_length_from_type<span class="Delimiter">-></span>left<span class="Delimiter">;</span> <span id="L44" class="LineNr"> 44 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_integer<span class="Delimiter">(</span>array_length_from_type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L45" class="LineNr"> 45 </span> <a href='003trace.cc.html#L196'>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">"'create-array' product should specify size of array after its element type, but got '"</span> << product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L45" class="LineNr"> 45 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'create-array' product should specify size of array after its element type, but got '"</span> << product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>name << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L46" class="LineNr"> 46 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L47" class="LineNr"> 47 </span> <span class="Delimiter">}</span> <span id="L48" class="LineNr"> 48 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -122,12 +125,12 @@ if ('onhashchange' in window) { <span id="L58" class="LineNr"> 58 </span> <span class="Normal">int</span> <a href='032array.cc.html#L319'>array_length</a> = to_integer<span class="Delimiter">(</span>array_length_from_type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> <span id="L59" class="LineNr"> 59 </span> <span class="Comment">// initialize array length, so that size_of will work</span> <span id="L60" class="LineNr"> 60 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing "</span> << <a href='032array.cc.html#L319'>array_length</a> << <span class="Constant">" in location "</span> << base_address << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L61" class="LineNr"> 61 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address<span class="Delimiter">,</span> <a href='032array.cc.html#L319'>array_length</a><span class="Delimiter">);</span> <span class="Comment">// in array elements</span> +<span id="L61" class="LineNr"> 61 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> base_address<span class="Delimiter">,</span> <a href='032array.cc.html#L319'>array_length</a><span class="Delimiter">);</span> <span class="Comment">// in array elements</span> <span id="L62" class="LineNr"> 62 </span> <span class="Normal">int</span> size = size_of<span class="Delimiter">(</span>product<span class="Delimiter">);</span> <span class="Comment">// in locations</span> <span id="L63" class="LineNr"> 63 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"creating array from "</span> << size << <span class="Constant">" locations"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L64" class="LineNr"> 64 </span> <span class="Comment">// initialize array</span> <span id="L65" class="LineNr"> 65 </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_of<span class="Delimiter">(</span>product<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> -<span id="L66" class="LineNr"> 66 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address+i<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L66" class="LineNr"> 66 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> base_address+i<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L67" class="LineNr"> 67 </span> <span class="Comment">// no need to update product</span> <span id="L68" class="LineNr"> 68 </span> write_products =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L69" class="LineNr"> 69 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -167,16 +170,16 @@ if ('onhashchange' in window) { <span id="L103" class="LineNr">103 </span> <span class="Identifier">return</span> types_strictly_match<span class="Delimiter">(</span><a href='032array.cc.html#L303'>array_element</a><span class="Delimiter">(</span>from<span class="Delimiter">.</span>type<span class="Delimiter">),</span> <a href='032array.cc.html#L303'>array_element</a><span class="Delimiter">(</span>to<span class="Delimiter">.</span>type<span class="Delimiter">));</span> <span id="L104" class="LineNr">104 </span> <span id="L105" class="LineNr">105 </span><span class="Delimiter">:(before "End size_of(reagent r) Special-cases")</span> -<span id="L106" class="LineNr">106 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom && r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom && r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == Array_type_ordinal<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L106" class="LineNr">106 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom && r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom && r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == <span class="Special">Array_type_ordinal</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L107" class="LineNr">107 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L108" class="LineNr">108 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"'"</span> << r<span class="Delimiter">.</span>original_string << <span class="Constant">"' is an array of what?</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L108" class="LineNr">108 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"'"</span> << r<span class="Delimiter">.</span>original_string << <span class="Constant">"' is an array of what?\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L109" class="LineNr">109 </span> <span class="Identifier">return</span> <span class="Constant">1</span><span class="Delimiter">;</span> <span id="L110" class="LineNr">110 </span> <span class="Delimiter">}</span> <span id="L111" class="LineNr">111 </span> <span class="Identifier">return</span> <span class="Comment">/*</span><span class="Comment">space for length</span><span class="Comment">*/</span><span class="Constant">1</span> + <a href='032array.cc.html#L319'>array_length</a><span class="Delimiter">(</span>r<span class="Delimiter">)</span>*size_of<span class="Delimiter">(</span><a href='032array.cc.html#L303'>array_element</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">));</span> <span id="L112" class="LineNr">112 </span><span class="Delimiter">}</span> <span id="L113" class="LineNr">113 </span> <span id="L114" class="LineNr">114 </span><span class="Delimiter">:(before "End size_of(type) Non-atom Special-cases")</span> -<span id="L115" class="LineNr">115 </span><span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == Array_type_ordinal<span class="Delimiter">)</span> <span class="Identifier">return</span> <a href='032array.cc.html#L117'>static_array_length</a><span class="Delimiter">(</span>type<span class="Delimiter">);</span> +<span id="L115" class="LineNr">115 </span><span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == <span class="Special">Array_type_ordinal</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <a href='032array.cc.html#L117'>static_array_length</a><span class="Delimiter">(</span>type<span class="Delimiter">);</span> <span id="L116" class="LineNr">116 </span><span class="Delimiter">:(code)</span> <span id="L117" class="LineNr">117 </span><span class="Normal">int</span> <a href='032array.cc.html#L117'>static_array_length</a><span class="Delimiter">(</span><span class="Normal">const</span> type_tree* type<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L118" class="LineNr">118 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>atom && type<span class="Delimiter">-></span>right && !type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>atom && type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right && !type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>atom && !type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right <span class="Comment">// exactly 3 types</span> @@ -191,7 +194,7 @@ if ('onhashchange' in window) { <span id="L127" class="LineNr">127 </span><span class="Comment">//: disable the size mismatch check for arrays since the destination array</span> <span id="L128" class="LineNr">128 </span><span class="Comment">//: need not be initialized</span> <span id="L129" class="LineNr">129 </span><span class="Delimiter">:(before "End size_mismatch(x) Special-cases")</span> -<span id="L130" class="LineNr">130 </span><span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>type && !x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == Array_type_ordinal<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L130" class="LineNr">130 </span><span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>type && !x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == <span class="Special">Array_type_ordinal</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L131" class="LineNr">131 </span> <span id="L132" class="LineNr">132 </span><span class="SalientComment">//:: arrays inside containers</span> <span id="L133" class="LineNr">133 </span><span class="Comment">//: arrays are disallowed inside containers unless their length is fixed in</span> @@ -219,16 +222,16 @@ if ('onhashchange' in window) { <span id="L155" class="LineNr">155 </span><span class="Delimiter">{</span> <span id="L156" class="LineNr">156 </span> <span class="Normal">const</span> type_tree* type = info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>back<span class="Delimiter">().</span>type<span class="Delimiter">;</span> <span id="L157" class="LineNr">157 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type && type<span class="Delimiter">-></span>atom && type<span class="Delimiter">-></span>name == <span class="Constant">"array"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L158" class="LineNr">158 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"container '"</span> << name << <span class="Constant">"' doesn't specify type of array elements for '"</span> << info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>back<span class="Delimiter">().</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L158" class="LineNr">158 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"container '"</span> << name << <span class="Constant">"' doesn't specify type of array elements for '"</span> << info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>back<span class="Delimiter">().</span>name << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L159" class="LineNr">159 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L160" class="LineNr">160 </span> <span class="Delimiter">}</span> <span id="L161" class="LineNr">161 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type && !type<span class="Delimiter">-></span>atom && type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom && type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>name == <span class="Constant">"array"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L162" class="LineNr">162 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>right<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L163" class="LineNr">163 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"container '"</span> << name << <span class="Constant">"' doesn't specify type of array elements for '"</span> << info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>back<span class="Delimiter">().</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L163" class="LineNr">163 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"container '"</span> << name << <span class="Constant">"' doesn't specify type of array elements for '"</span> << info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>back<span class="Delimiter">().</span>name << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L164" class="LineNr">164 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L165" class="LineNr">165 </span> <span class="Delimiter">}</span> <span id="L166" class="LineNr">166 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right || !is_integer<span class="Delimiter">(</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// array has no length</span> -<span id="L167" class="LineNr">167 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"container '"</span> << name << <span class="Constant">"' cannot determine size of element '"</span> << info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>back<span class="Delimiter">().</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L167" class="LineNr">167 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"container '"</span> << name << <span class="Constant">"' cannot determine size of element '"</span> << info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>back<span class="Delimiter">().</span>name << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L168" class="LineNr">168 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L169" class="LineNr">169 </span> <span class="Delimiter">}</span> <span id="L170" class="LineNr">170 </span> <span class="Delimiter">}</span> @@ -237,7 +240,7 @@ if ('onhashchange' in window) { <span id="L173" class="LineNr">173 </span><span class="Comment">//: disable the size mismatch check for 'merge' instructions since containers</span> <span id="L174" class="LineNr">174 </span><span class="Comment">//: can contain arrays, and since we already do plenty of checking for them</span> <span id="L175" class="LineNr">175 </span><span class="Delimiter">:(before "End size_mismatch(x) Special-cases")</span> -<span id="L176" class="LineNr">176 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">().</span>running_step_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> <a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">().</span>running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">)</span> +<span id="L176" class="LineNr">176 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">().</span>running_step_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> <a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">().</span>running_recipe<span class="Delimiter">).</span>steps<span class="Delimiter">)</span> <span id="L177" class="LineNr">177 </span> && <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>operation == MERGE<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L178" class="LineNr">178 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L179" class="LineNr">179 </span><span class="Delimiter">}</span> @@ -304,23 +307,23 @@ if ('onhashchange' in window) { <span id="L240" class="LineNr">240 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L241" class="LineNr">241 </span>INDEX<span class="Delimiter">,</span> <span id="L242" class="LineNr">242 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L243" class="LineNr">243 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"index"</span><span class="Delimiter">,</span> INDEX<span class="Delimiter">);</span> +<span id="L243" class="LineNr">243 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"index"</span><span class="Delimiter">,</span> INDEX<span class="Delimiter">);</span> <span id="L244" class="LineNr">244 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L245" class="LineNr">245 </span><span class="Normal">case</span> INDEX: <span class="Delimiter">{</span> <span id="L246" class="LineNr">246 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L247" class="LineNr">247 </span> <a href='003trace.cc.html#L196'>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">"'index' expects exactly 2 ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L247" class="LineNr">247 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'index' expects exactly 2 ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L248" class="LineNr">248 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L249" class="LineNr">249 </span> <span class="Delimiter">}</span> <span id="L250" class="LineNr">250 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> base = 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 id="L251" class="LineNr">251 </span> <span class="Comment">// Update INDEX base in Check</span> <span id="L252" class="LineNr">252 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_array<span class="Delimiter">(</span>base<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L253" class="LineNr">253 </span> <a href='003trace.cc.html#L196'>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">"'index' on a non-array '"</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L253" class="LineNr">253 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'index' on a non-array '"</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L254" class="LineNr">254 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L255" class="LineNr">255 </span> <span class="Delimiter">}</span> <span id="L256" class="LineNr">256 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> index = 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 id="L257" class="LineNr">257 </span> <span class="Comment">// Update INDEX index in Check</span> <span id="L258" class="LineNr">258 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_number<span class="Delimiter">(</span>index<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L259" class="LineNr">259 </span> <a href='003trace.cc.html#L196'>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 'index' should be a number, but got '"</span> << index<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L259" class="LineNr">259 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second ingredient of 'index' should be a number, but got '"</span> << index<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L260" class="LineNr">260 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L261" class="LineNr">261 </span> <span class="Delimiter">}</span> <span id="L262" class="LineNr">262 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -328,7 +331,7 @@ if ('onhashchange' in window) { <span id="L264" class="LineNr">264 </span> <span class="Comment">// Update INDEX product in Check</span> <span id="L265" class="LineNr">265 </span> reagent<span class="Comment">/*</span><span class="Comment">local</span><span class="Comment">*/</span> element<span class="Delimiter">(</span><a href='032array.cc.html#L299'>copy_array_element</a><span class="Delimiter">(</span>base<span class="Delimiter">.</span>type<span class="Delimiter">));</span> <span id="L266" class="LineNr">266 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>product<span class="Delimiter">,</span> element<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L267" class="LineNr">267 </span> <a href='003trace.cc.html#L196'>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">"'index' on '"</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">"' can't be saved in '"</span> << product<span class="Delimiter">.</span>original_string << <span class="Constant">"'; type should be '"</span> << names_to_string_without_quotes<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L267" class="LineNr">267 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'index' on '"</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">"' can't be saved in '"</span> << product<span class="Delimiter">.</span>original_string << <span class="Constant">"'; type should be '"</span> << names_to_string_without_quotes<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L268" class="LineNr">268 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L269" class="LineNr">269 </span> <span class="Delimiter">}</span> <span id="L270" class="LineNr">270 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -340,14 +343,14 @@ if ('onhashchange' in window) { <span id="L276" class="LineNr">276 </span> <span class="Normal">int</span> base_address = base<span class="Delimiter">.</span>value<span class="Delimiter">;</span> <span id="L277" class="LineNr">277 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"base <a href='043space.cc.html#L101'>address</a> is "</span> << base_address << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L278" class="LineNr">278 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base_address == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L279" class="LineNr">279 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L279" class="LineNr">279 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L280" class="LineNr">280 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L281" class="LineNr">281 </span> <span class="Delimiter">}</span> <span id="L282" class="LineNr">282 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> index = <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L283" class="LineNr">283 </span> <span class="Comment">// Update INDEX index in Run</span> <span id="L284" class="LineNr">284 </span> vector<<span class="Normal">double</span>> index_val<span class="Delimiter">(</span>read_memory<span class="Delimiter">(</span>index<span class="Delimiter">));</span> -<span id="L285" class="LineNr">285 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> < <span class="Constant">0</span> || index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> >= <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L286" class="LineNr">286 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"invalid index "</span> << no_scientific<span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> << <span class="Constant">" in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L285" class="LineNr">285 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> < <span class="Constant">0</span> || index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> >= <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> base_address<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L286" class="LineNr">286 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"invalid index "</span> << no_scientific<span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> << <span class="Constant">" in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L287" class="LineNr">287 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L288" class="LineNr">288 </span> <span class="Delimiter">}</span> <span id="L289" class="LineNr">289 </span> reagent<span class="Comment">/*</span><span class="Comment">local</span><span class="Comment">*/</span> element<span class="Delimiter">(</span><a href='032array.cc.html#L299'>copy_array_element</a><span class="Delimiter">(</span>base<span class="Delimiter">.</span>type<span class="Delimiter">));</span> @@ -389,15 +392,15 @@ if ('onhashchange' in window) { <span id="L325" class="LineNr">325 </span> <span class="Identifier">return</span> to_integer<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">-></span>name<span class="Delimiter">);</span> <span id="L326" class="LineNr">326 </span> <span class="Delimiter">}</span> <span id="L327" class="LineNr">327 </span> <span class="Comment">// this should never happen at transform time</span> -<span id="L328" class="LineNr">328 </span> <span class="Identifier">return</span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> x<span class="Delimiter">.</span>value<span class="Delimiter">);</span> +<span id="L328" class="LineNr">328 </span> <span class="Identifier">return</span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> x<span class="Delimiter">.</span>value<span class="Delimiter">);</span> <span id="L329" class="LineNr">329 </span><span class="Delimiter">}</span> <span id="L330" class="LineNr">330 </span> <span id="L331" class="LineNr">331 </span><span class="Delimiter">:(before "End Unit Tests")</span> <span id="L332" class="LineNr">332 </span><span class="Normal">void</span> <a href='032array.cc.html#L332'>test_array_length_compound</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L333" class="LineNr">333 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">3</span><span class="Delimiter">);</span> -<span id="L334" class="LineNr">334 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">14</span><span class="Delimiter">);</span> -<span id="L335" class="LineNr">335 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Constant">3</span><span class="Delimiter">,</span> <span class="Constant">15</span><span class="Delimiter">);</span> -<span id="L336" class="LineNr">336 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Constant">4</span><span class="Delimiter">,</span> <span class="Constant">16</span><span class="Delimiter">);</span> +<span id="L333" class="LineNr">333 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">3</span><span class="Delimiter">);</span> +<span id="L334" class="LineNr">334 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> <span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">14</span><span class="Delimiter">);</span> +<span id="L335" class="LineNr">335 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> <span class="Constant">3</span><span class="Delimiter">,</span> <span class="Constant">15</span><span class="Delimiter">);</span> +<span id="L336" class="LineNr">336 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> <span class="Constant">4</span><span class="Delimiter">,</span> <span class="Constant">16</span><span class="Delimiter">);</span> <span id="L337" class="LineNr">337 </span> reagent x<span class="Delimiter">(</span><span class="Constant">"1:array:<a href='043space.cc.html#L101'>address</a>:num"</span><span class="Delimiter">);</span> <span class="Comment">// 3 types, but not a static array</span> <span id="L338" class="LineNr">338 </span> <a href='012transform.cc.html#L91'>populate_value</a><span class="Delimiter">(</span>x<span class="Delimiter">);</span> <span id="L339" class="LineNr">339 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='032array.cc.html#L319'>array_length</a><span class="Delimiter">(</span>x<span class="Delimiter">),</span> <span class="Constant">3</span><span class="Delimiter">);</span> @@ -464,35 +467,35 @@ if ('onhashchange' in window) { <span id="L400" class="LineNr">400 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L401" class="LineNr">401 </span>PUT_INDEX<span class="Delimiter">,</span> <span id="L402" class="LineNr">402 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L403" class="LineNr">403 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"put-index"</span><span class="Delimiter">,</span> PUT_INDEX<span class="Delimiter">);</span> +<span id="L403" class="LineNr">403 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"put-index"</span><span class="Delimiter">,</span> PUT_INDEX<span class="Delimiter">);</span> <span id="L404" class="LineNr">404 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L405" class="LineNr">405 </span><span class="Normal">case</span> PUT_INDEX: <span class="Delimiter">{</span> <span id="L406" class="LineNr">406 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">3</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L407" class="LineNr">407 </span> <a href='003trace.cc.html#L196'>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">"'put-index' expects exactly 3 ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L407" class="LineNr">407 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'put-index' expects exactly 3 ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L408" class="LineNr">408 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L409" class="LineNr">409 </span> <span class="Delimiter">}</span> <span id="L410" class="LineNr">410 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> base = 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 id="L411" class="LineNr">411 </span> <span class="Comment">// Update PUT_INDEX base in Check</span> <span id="L412" class="LineNr">412 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_array<span class="Delimiter">(</span>base<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L413" class="LineNr">413 </span> <a href='003trace.cc.html#L196'>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">"'put-index' on a non-array '"</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L413" class="LineNr">413 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'put-index' on a non-array '"</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L414" class="LineNr">414 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L415" class="LineNr">415 </span> <span class="Delimiter">}</span> <span id="L416" class="LineNr">416 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> index = 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 id="L417" class="LineNr">417 </span> <span class="Comment">// Update PUT_INDEX index in Check</span> <span id="L418" class="LineNr">418 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_number<span class="Delimiter">(</span>index<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L419" class="LineNr">419 </span> <a href='003trace.cc.html#L196'>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 'put-index' should have type 'number', 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L419" class="LineNr">419 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second ingredient of 'put-index' should have type 'number', 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L420" class="LineNr">420 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L421" class="LineNr">421 </span> <span class="Delimiter">}</span> <span id="L422" class="LineNr">422 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> value = inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span> <span id="L423" class="LineNr">423 </span> <span class="Comment">// Update PUT_INDEX value in Check</span> <span id="L424" class="LineNr">424 </span> reagent<span class="Comment">/*</span><span class="Comment">local</span><span class="Comment">*/</span> element<span class="Delimiter">(</span><a href='032array.cc.html#L299'>copy_array_element</a><span class="Delimiter">(</span>base<span class="Delimiter">.</span>type<span class="Delimiter">));</span> <span id="L425" class="LineNr">425 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>element<span class="Delimiter">,</span> value<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L426" class="LineNr">426 </span> <a href='003trace.cc.html#L196'>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">"'put-index "</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">", "</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">"' should store "</span> << names_to_string_without_quotes<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">" but '"</span> << value<span class="Delimiter">.</span>name << <span class="Constant">"' has type "</span> << names_to_string_without_quotes<span class="Delimiter">(</span>value<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L426" class="LineNr">426 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'put-index "</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">", "</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">"' should store "</span> << names_to_string_without_quotes<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="Constant">" but '"</span> << value<span class="Delimiter">.</span>name << <span class="Constant">"' has type "</span> << names_to_string_without_quotes<span class="Delimiter">(</span>value<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L427" class="LineNr">427 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L428" class="LineNr">428 </span> <span class="Delimiter">}</span> <span id="L429" class="LineNr">429 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// no more checks necessary</span> <span id="L430" class="LineNr">430 </span> <span class="Normal">if</span> <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>name != inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L431" class="LineNr">431 </span> <a href='003trace.cc.html#L196'>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">"product of 'put-index' must be first ingredient '"</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">"', but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L431" class="LineNr">431 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"product of 'put-index' must be first ingredient '"</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">"', but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L432" class="LineNr">432 </span> <span class="Identifier">break</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="Comment">// End PUT_INDEX Product Checks</span> @@ -504,14 +507,14 @@ if ('onhashchange' in window) { <span id="L440" class="LineNr">440 </span> <span class="Comment">// Update PUT_INDEX base in Run</span> <span id="L441" class="LineNr">441 </span> <span class="Normal">int</span> base_address = base<span class="Delimiter">.</span>value<span class="Delimiter">;</span> <span id="L442" class="LineNr">442 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base_address == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L443" class="LineNr">443 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L443" class="LineNr">443 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L444" class="LineNr">444 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L445" class="LineNr">445 </span> <span class="Delimiter">}</span> <span id="L446" class="LineNr">446 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> index = <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L447" class="LineNr">447 </span> <span class="Comment">// Update PUT_INDEX index in Run</span> <span id="L448" class="LineNr">448 </span> vector<<span class="Normal">double</span>> index_val<span class="Delimiter">(</span>read_memory<span class="Delimiter">(</span>index<span class="Delimiter">));</span> -<span id="L449" class="LineNr">449 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> < <span class="Constant">0</span> || index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> >= <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L450" class="LineNr">450 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"invalid index "</span> << no_scientific<span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> << <span class="Constant">" in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L449" class="LineNr">449 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> < <span class="Constant">0</span> || index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> >= <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> base_address<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L450" class="LineNr">450 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"invalid index "</span> << no_scientific<span class="Delimiter">(</span>index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> << <span class="Constant">" in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L451" class="LineNr">451 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L452" class="LineNr">452 </span> <span class="Delimiter">}</span> <span id="L453" class="LineNr">453 </span> <span class="Normal">int</span> <a href='043space.cc.html#L101'>address</a> = base_address + <span class="Comment">/*</span><span class="Comment">skip length</span><span class="Comment">*/</span><span class="Constant">1</span> + index_val<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span>*size_of<span class="Delimiter">(</span><a href='032array.cc.html#L303'>array_element</a><span class="Delimiter">(</span>base<span class="Delimiter">.</span>type<span class="Delimiter">));</span> @@ -523,7 +526,7 @@ if ('onhashchange' in window) { <span id="L459" class="LineNr">459 </span> <span class="Comment">// Write Memory in PUT_INDEX in Run</span> <span id="L460" class="LineNr">460 </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#L141'>SIZE</a><span class="Delimiter">(</span>value<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L461" class="LineNr">461 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing "</span> << no_scientific<span class="Delimiter">(</span>value<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <span class="Constant">" in location "</span> << address+i << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L462" class="LineNr">462 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> address+i<span class="Delimiter">,</span> value<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> +<span id="L462" class="LineNr">462 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> address+i<span class="Delimiter">,</span> value<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span id="L463" class="LineNr">463 </span> <span class="Delimiter">}</span> <span id="L464" class="LineNr">464 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L465" class="LineNr">465 </span><span class="Delimiter">}</span> @@ -566,17 +569,17 @@ if ('onhashchange' in window) { <span id="L502" class="LineNr">502 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L503" class="LineNr">503 </span>LENGTH<span class="Delimiter">,</span> <span id="L504" class="LineNr">504 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L505" class="LineNr">505 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"length"</span><span class="Delimiter">,</span> LENGTH<span class="Delimiter">);</span> +<span id="L505" class="LineNr">505 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"length"</span><span class="Delimiter">,</span> LENGTH<span class="Delimiter">);</span> <span id="L506" class="LineNr">506 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L507" class="LineNr">507 </span><span class="Normal">case</span> LENGTH: <span class="Delimiter">{</span> <span id="L508" class="LineNr">508 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L509" class="LineNr">509 </span> <a href='003trace.cc.html#L196'>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">"'length' expects exactly 2 ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L509" class="LineNr">509 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'length' expects exactly 2 ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L510" class="LineNr">510 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L511" class="LineNr">511 </span> <span class="Delimiter">}</span> <span id="L512" class="LineNr">512 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> array = 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 id="L513" class="LineNr">513 </span> <span class="Comment">// Update LENGTH array in Check</span> <span id="L514" class="LineNr">514 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_array<span class="Delimiter">(</span>array<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L515" class="LineNr">515 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"tried to calculate length of non-array '"</span> << array<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L515" class="LineNr">515 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"tried to calculate length of non-array '"</span> << array<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L516" class="LineNr">516 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L517" class="LineNr">517 </span> <span class="Delimiter">}</span> <span id="L518" class="LineNr">518 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -586,11 +589,11 @@ if ('onhashchange' in window) { <span id="L522" class="LineNr">522 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> array = <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L523" class="LineNr">523 </span> <span class="Comment">// Update LENGTH array in Run</span> <span id="L524" class="LineNr">524 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>array<span class="Delimiter">.</span>value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L525" class="LineNr">525 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L525" class="LineNr">525 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L526" class="LineNr">526 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L527" class="LineNr">527 </span> <span class="Delimiter">}</span> <span id="L528" class="LineNr">528 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L529" class="LineNr">529 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> array<span class="Delimiter">.</span>value<span class="Delimiter">));</span> +<span id="L529" class="LineNr">529 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> array<span class="Delimiter">.</span>value<span class="Delimiter">));</span> <span id="L530" class="LineNr">530 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L531" class="LineNr">531 </span><span class="Delimiter">}</span> <span id="L532" class="LineNr">532 </span> diff --git a/html/033exclusive_container.cc.html b/html/033exclusive_container.cc.html index 8b618e76..df0d79c3 100644 --- a/html/033exclusive_container.cc.html +++ b/html/033exclusive_container.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } .traceContains { color: #008000; } --> @@ -61,6 +63,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/033exclusive_container.cc'>https://github.com/akkartik/mu/blob/master/033exclusive_container.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Exclusive containers contain exactly one of a fixed number of 'variants'</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: of different types.</span> @@ -71,12 +74,12 @@ if ('onhashchange' in window) { <span id="L7" class="LineNr"> 7 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> <span id="L8" class="LineNr"> 8 </span><span class="Comment">//: We'll use this container as a running example, with two number elements.</span> <span id="L9" class="LineNr"> 9 </span><span class="Delimiter">{</span> -<span id="L10" class="LineNr"> 10 </span><a href='010vm.cc.html#L125'>type_ordinal</a> tmp = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"number-or-point"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L11" class="LineNr"> 11 </span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> tmp<span class="Delimiter">);</span> <span class="Comment">// initialize</span> -<span id="L12" class="LineNr"> 12 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> tmp<span class="Delimiter">).</span>kind = <a href='010vm.cc.html#L181'>EXCLUSIVE_CONTAINER</a><span class="Delimiter">;</span> -<span id="L13" class="LineNr"> 13 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> tmp<span class="Delimiter">).</span>name = <span class="Constant">"number-or-point"</span><span class="Delimiter">;</span> -<span id="L14" class="LineNr"> 14 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> tmp<span class="Delimiter">).</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"i:number"</span><span class="Delimiter">));</span> -<span id="L15" class="LineNr"> 15 </span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> tmp<span class="Delimiter">).</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"p:point"</span><span class="Delimiter">));</span> +<span id="L10" class="LineNr"> 10 </span><a href='010vm.cc.html#L125'>type_ordinal</a> tmp = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"number-or-point"</span><span class="Delimiter">,</span> <span class="Special">Next_type_ordinal</span>++<span class="Delimiter">);</span> +<span id="L11" class="LineNr"> 11 </span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> tmp<span class="Delimiter">);</span> <span class="Comment">// initialize</span> +<span id="L12" class="LineNr"> 12 </span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> tmp<span class="Delimiter">).</span>kind = <a href='010vm.cc.html#L181'>EXCLUSIVE_CONTAINER</a><span class="Delimiter">;</span> +<span id="L13" class="LineNr"> 13 </span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> tmp<span class="Delimiter">).</span>name = <span class="Constant">"number-or-point"</span><span class="Delimiter">;</span> +<span id="L14" class="LineNr"> 14 </span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> tmp<span class="Delimiter">).</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"i:number"</span><span class="Delimiter">));</span> +<span id="L15" class="LineNr"> 15 </span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> tmp<span class="Delimiter">).</span>elements<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"p:point"</span><span class="Delimiter">));</span> <span id="L16" class="LineNr"> 16 </span><span class="Delimiter">}</span> <span id="L17" class="LineNr"> 17 </span> <span id="L18" class="LineNr"> 18 </span><span class="Comment">//: Tests in this layer often explicitly set up memory before reading it as a</span> @@ -117,7 +120,7 @@ if ('onhashchange' in window) { <span id="L53" class="LineNr"> 53 </span><span class="Comment">//: 'maybe-convert' requires a literal in ingredient 1. We'll use a synonym</span> <span id="L54" class="LineNr"> 54 </span><span class="Comment">//: called 'variant'.</span> <span id="L55" class="LineNr"> 55 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> -<span id="L56" class="LineNr"> 56 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"variant"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L56" class="LineNr"> 56 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"variant"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L57" class="LineNr"> 57 </span> <span id="L58" class="LineNr"> 58 </span><span class="Delimiter">:(scenario maybe_convert)</span> <span id="L59" class="LineNr"> 59 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ @@ -146,40 +149,40 @@ if ('onhashchange' in window) { <span id="L82" class="LineNr"> 82 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L83" class="LineNr"> 83 </span>MAYBE_CONVERT<span class="Delimiter">,</span> <span id="L84" class="LineNr"> 84 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L85" class="LineNr"> 85 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"maybe-convert"</span><span class="Delimiter">,</span> MAYBE_CONVERT<span class="Delimiter">);</span> +<span id="L85" class="LineNr"> 85 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"maybe-convert"</span><span class="Delimiter">,</span> MAYBE_CONVERT<span class="Delimiter">);</span> <span id="L86" class="LineNr"> 86 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L87" class="LineNr"> 87 </span><span class="Normal">case</span> MAYBE_CONVERT: <span class="Delimiter">{</span> -<span id="L88" class="LineNr"> 88 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L88" class="LineNr"> 88 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L89" class="LineNr"> 89 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L90" class="LineNr"> 90 </span> <a href='003trace.cc.html#L196'>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">"'maybe-convert' expects exactly 2 ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L90" class="LineNr"> 90 </span> <a href='003trace.cc.html#L196'>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">"'maybe-convert' expects exactly 2 ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L91" class="LineNr"> 91 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L92" class="LineNr"> 92 </span> <span class="Delimiter">}</span> <span id="L93" class="LineNr"> 93 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> base = 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 id="L94" class="LineNr"> 94 </span> <span class="Comment">// Update MAYBE_CONVERT base in Check</span> <span id="L95" class="LineNr"> 95 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!base<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L96" class="LineNr"> 96 </span> <a href='003trace.cc.html#L196'>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">"first ingredient of 'maybe-convert' should be an exclusive-container, but got '"</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L96" class="LineNr"> 96 </span> <a href='003trace.cc.html#L196'>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">"first ingredient of 'maybe-convert' should be an exclusive-container, but got '"</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L97" class="LineNr"> 97 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L98" class="LineNr"> 98 </span> <span class="Delimiter">}</span> <span id="L99" class="LineNr"> 99 </span> <span class="Normal">const</span> type_tree* base_type = base<span class="Delimiter">.</span>type<span class="Delimiter">;</span> <span id="L100" class="LineNr">100 </span> <span class="Comment">// Update MAYBE_CONVERT base_type in Check</span> -<span id="L101" class="LineNr">101 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!base_type<span class="Delimiter">-></span>atom || base_type<span class="Delimiter">-></span>value == <span class="Constant">0</span> || !contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">)</span> || get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>kind != <a href='010vm.cc.html#L181'>EXCLUSIVE_CONTAINER</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L102" class="LineNr">102 </span> <a href='003trace.cc.html#L196'>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">"first ingredient of 'maybe-convert' should be an exclusive-container, but got '"</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L101" class="LineNr">101 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!base_type<span class="Delimiter">-></span>atom || base_type<span class="Delimiter">-></span>value == <span class="Constant">0</span> || !contains_key<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">)</span> || get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>kind != <a href='010vm.cc.html#L181'>EXCLUSIVE_CONTAINER</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L102" class="LineNr">102 </span> <a href='003trace.cc.html#L196'>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">"first ingredient of 'maybe-convert' should be an exclusive-container, but got '"</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L103" class="LineNr">103 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L104" class="LineNr">104 </span> <span class="Delimiter">}</span> <span id="L105" class="LineNr">105 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<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="L106" class="LineNr">106 </span> <a href='003trace.cc.html#L196'>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">"second ingredient of 'maybe-convert' should have type 'variant', 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L106" class="LineNr">106 </span> <a href='003trace.cc.html#L196'>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">"second ingredient of 'maybe-convert' should have type 'variant', 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L107" class="LineNr">107 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L108" class="LineNr">108 </span> <span class="Delimiter">}</span> <span id="L109" class="LineNr">109 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L110" class="LineNr">110 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> != <span class="Constant">2</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L111" class="LineNr">111 </span> <a href='003trace.cc.html#L196'>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">"'maybe-convert' expects exactly 2 products in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L111" class="LineNr">111 </span> <a href='003trace.cc.html#L196'>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">"'maybe-convert' expects exactly 2 products in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L112" class="LineNr">112 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L113" class="LineNr">113 </span> <span class="Delimiter">}</span> <span id="L114" class="LineNr">114 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> product = 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 id="L115" class="LineNr">115 </span> <span class="Comment">// Update MAYBE_CONVERT product in Check</span> <span id="L116" class="LineNr">116 </span> reagent& offset = 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 id="L117" class="LineNr">117 </span> <a href='012transform.cc.html#L91'>populate_value</a><span class="Delimiter">(</span>offset<span class="Delimiter">);</span> -<span id="L118" class="LineNr">118 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset<span class="Delimiter">.</span>value >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L118" class="LineNr">118 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset<span class="Delimiter">.</span>value >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L119" class="LineNr">119 </span> <a href='003trace.cc.html#L196'>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">"invalid tag "</span> << offset<span class="Delimiter">.</span>value << <span class="Constant">" in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span id="L120" class="LineNr">120 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L121" class="LineNr">121 </span> <span class="Delimiter">}</span> @@ -191,7 +194,7 @@ if ('onhashchange' in window) { <span id="L127" class="LineNr">127 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> status = inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L128" class="LineNr">128 </span> <span class="Comment">// Update MAYBE_CONVERT status in Check</span> <span id="L129" class="LineNr">129 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_boolean<span class="Delimiter">(</span>status<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L130" class="LineNr">130 </span> <a href='003trace.cc.html#L196'>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 product yielded by 'maybe-convert' should be a boolean, but tried to write to '"</span> << inst<span class="Delimiter">.</span>products<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#L225'>end</a><span class="Delimiter">();</span> +<span id="L130" class="LineNr">130 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second product yielded by 'maybe-convert' should be a boolean, but tried to write to '"</span> << inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L131" class="LineNr">131 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L132" class="LineNr">132 </span> <span class="Delimiter">}</span> <span id="L133" class="LineNr">133 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -202,7 +205,7 @@ if ('onhashchange' in window) { <span id="L138" class="LineNr">138 </span> <span class="Comment">// Update MAYBE_CONVERT base in Run</span> <span id="L139" class="LineNr">139 </span> <span class="Normal">int</span> base_address = base<span class="Delimiter">.</span>value<span class="Delimiter">;</span> <span id="L140" class="LineNr">140 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base_address == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L141" class="LineNr">141 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L141" class="LineNr">141 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L142" class="LineNr">142 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L143" class="LineNr">143 </span> <span class="Delimiter">}</span> <span id="L144" class="LineNr">144 </span> <span class="Normal">int</span> tag = <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>value<span class="Delimiter">;</span> @@ -212,22 +215,22 @@ if ('onhashchange' in window) { <span id="L148" class="LineNr">148 </span> <span class="Comment">// Update MAYBE_CONVERT status in Run</span> <span id="L149" class="LineNr">149 </span> <span class="Comment">// optimization: directly write results to only update first product when necessary</span> <span id="L150" class="LineNr">150 </span> write_products =<span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L151" class="LineNr">151 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>tag == <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address<span class="Delimiter">)))</span> <span class="Delimiter">{</span> +<span id="L151" class="LineNr">151 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>tag == <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> base_address<span class="Delimiter">)))</span> <span class="Delimiter">{</span> <span id="L152" class="LineNr">152 </span> <span class="Normal">const</span> reagent& variant = variant_type<span class="Delimiter">(</span>base<span class="Delimiter">,</span> tag<span class="Delimiter">);</span> <span id="L153" class="LineNr">153 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing 1 in location "</span> << status<span class="Delimiter">.</span>value << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L154" class="LineNr">154 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> status<span class="Delimiter">.</span>value<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L154" class="LineNr">154 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> status<span class="Delimiter">.</span>value<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> <span id="L155" class="LineNr">155 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_dummy<span class="Delimiter">(</span>product<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L156" class="LineNr">156 </span> <span class="Comment">// Write Memory in Successful MAYBE_CONVERT in Run</span> <span id="L157" class="LineNr">157 </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_of<span class="Delimiter">(</span>variant<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L158" class="LineNr">158 </span> <span class="Normal">double</span> val = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base_address+<span class="Comment">/*</span><span class="Comment">skip tag</span><span class="Comment">*/</span><span class="Constant">1</span>+i<span class="Delimiter">);</span> +<span id="L158" class="LineNr">158 </span> <span class="Normal">double</span> val = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> base_address+<span class="Comment">/*</span><span class="Comment">skip tag</span><span class="Comment">*/</span><span class="Constant">1</span>+i<span class="Delimiter">);</span> <span id="L159" class="LineNr">159 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing "</span> << no_scientific<span class="Delimiter">(</span>val<span class="Delimiter">)</span> << <span class="Constant">" in location "</span> << product<span class="Delimiter">.</span>value+i << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L160" class="LineNr">160 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> product<span class="Delimiter">.</span>value+i<span class="Delimiter">,</span> val<span class="Delimiter">);</span> +<span id="L160" class="LineNr">160 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> product<span class="Delimiter">.</span>value+i<span class="Delimiter">,</span> val<span class="Delimiter">);</span> <span id="L161" class="LineNr">161 </span> <span class="Delimiter">}</span> <span id="L162" class="LineNr">162 </span> <span class="Delimiter">}</span> <span id="L163" class="LineNr">163 </span> <span class="Delimiter">}</span> <span id="L164" class="LineNr">164 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L165" class="LineNr">165 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing 0 in location "</span> << status<span class="Delimiter">.</span>value << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L166" class="LineNr">166 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> status<span class="Delimiter">.</span>value<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L166" class="LineNr">166 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> status<span class="Delimiter">.</span>value<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L167" class="LineNr">167 </span> <span class="Delimiter">}</span> <span id="L168" class="LineNr">168 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L169" class="LineNr">169 </span><span class="Delimiter">}</span> @@ -240,9 +243,9 @@ if ('onhashchange' in window) { <span id="L176" class="LineNr">176 </span><span class="Normal">const</span> reagent variant_type<span class="Delimiter">(</span><span class="Normal">const</span> type_tree* type<span class="Delimiter">,</span> <span class="Normal">int</span> tag<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L177" class="LineNr">177 </span> assert<span class="Delimiter">(</span>tag >= <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L178" class="LineNr">178 </span> <span class="Normal">const</span> type_tree* root_type = type<span class="Delimiter">-></span>atom ? type : type<span class="Delimiter">-></span>left<span class="Delimiter">;</span> -<span id="L179" class="LineNr">179 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> root_type<span class="Delimiter">-></span>value<span class="Delimiter">));</span> -<span id="L180" class="LineNr">180 </span> assert<span class="Delimiter">(</span>!get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> root_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L181" class="LineNr">181 </span> <span class="Normal">const</span> type_info& info = get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> root_type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> +<span id="L179" class="LineNr">179 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> root_type<span class="Delimiter">-></span>value<span class="Delimiter">));</span> +<span id="L180" class="LineNr">180 </span> assert<span class="Delimiter">(</span>!get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> root_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L181" class="LineNr">181 </span> <span class="Normal">const</span> type_info& info = get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> root_type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> <span id="L182" class="LineNr">182 </span> assert<span class="Delimiter">(</span>info<span class="Delimiter">.</span>kind == <a href='010vm.cc.html#L181'>EXCLUSIVE_CONTAINER</a><span class="Delimiter">);</span> <span id="L183" class="LineNr">183 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> element = info<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>at<span class="Delimiter">(</span>tag<span class="Delimiter">);</span> <span id="L184" class="LineNr">184 </span> <span class="Comment">// End variant_type Special-cases</span> @@ -374,13 +377,13 @@ if ('onhashchange' in window) { <span id="L310" class="LineNr">310 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>types_strictly_match<span class="Delimiter">(</span>container<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">)))</span> <span id="L311" class="LineNr">311 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L312" class="LineNr">312 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L313" class="LineNr">313 </span> <a href='003trace.cc.html#L196'>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">"ingredient "</span> << ingredient_index << <span class="Constant">" of 'merge' should be a literal, for the tag of exclusive-container '"</span> << container_info<span class="Delimiter">.</span>name << <span class="Constant">"' in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L313" class="LineNr">313 </span> <a href='003trace.cc.html#L196'>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">"ingredient "</span> << ingredient_index << <span class="Constant">" of 'merge' should be a literal, for the tag of exclusive-container '"</span> << container_info<span class="Delimiter">.</span>name << <span class="Constant">"' in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L314" class="LineNr">314 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L315" class="LineNr">315 </span> <span class="Delimiter">}</span> <span id="L316" class="LineNr">316 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> ingredient = ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">);</span> <span class="Comment">// unnecessary copy just to keep this function from modifying caller</span> <span id="L317" class="LineNr">317 </span> <a href='012transform.cc.html#L91'>populate_value</a><span class="Delimiter">(</span>ingredient<span class="Delimiter">);</span> <span id="L318" class="LineNr">318 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>ingredient<span class="Delimiter">.</span>value >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>container_info<span class="Delimiter">.</span>elements<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L319" class="LineNr">319 </span> <a href='003trace.cc.html#L196'>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">"invalid tag at "</span> << ingredient_index << <span class="Constant">" for '"</span> << container_info<span class="Delimiter">.</span>name << <span class="Constant">"' in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L319" class="LineNr">319 </span> <a href='003trace.cc.html#L196'>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">"invalid tag at "</span> << ingredient_index << <span class="Constant">" for '"</span> << container_info<span class="Delimiter">.</span>name << <span class="Constant">"' in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L320" class="LineNr">320 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L321" class="LineNr">321 </span> <span class="Delimiter">}</span> <span id="L322" class="LineNr">322 </span> <span class="Normal">const</span> reagent& variant = variant_type<span class="Delimiter">(</span>container<span class="Delimiter">,</span> ingredient<span class="Delimiter">.</span>value<span class="Delimiter">);</span> @@ -488,7 +491,7 @@ if ('onhashchange' in window) { <span id="L424" class="LineNr">424 </span><span class="Comment">//: Since the different variants of an exclusive-container might have</span> <span id="L425" class="LineNr">425 </span><span class="Comment">//: different sizes, relax the size mismatch check for 'merge' instructions.</span> <span id="L426" class="LineNr">426 </span><span class="Delimiter">:(before "End size_mismatch(x) Special-cases")</span> -<span id="L427" class="LineNr">427 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L84'>current_step_index</a><span class="Delimiter">()</span> < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>steps<span class="Delimiter">())</span> +<span id="L427" class="LineNr">427 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L84'>current_step_index</a><span class="Delimiter">()</span> < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>steps<span class="Delimiter">())</span> <span id="L428" class="LineNr">428 </span> && <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>operation == MERGE <span id="L429" class="LineNr">429 </span> && !current_instruction<span class="Delimiter">().</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">()</span> <span id="L430" class="LineNr">430 </span> && <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>type<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -496,7 +499,7 @@ if ('onhashchange' in window) { <span id="L432" class="LineNr">432 </span> <span class="Comment">// Update size_mismatch Check for MERGE(x)</span> <span id="L433" class="LineNr">433 </span> <span class="Normal">const</span> type_tree* root_type = x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom ? x<span class="Delimiter">.</span>type : x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">;</span> <span id="L434" class="LineNr">434 </span> assert<span class="Delimiter">(</span>root_type<span class="Delimiter">-></span>atom<span class="Delimiter">);</span> -<span id="L435" class="LineNr">435 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> root_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>kind == <a href='010vm.cc.html#L181'>EXCLUSIVE_CONTAINER</a><span class="Delimiter">)</span> +<span id="L435" class="LineNr">435 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> root_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>kind == <a href='010vm.cc.html#L181'>EXCLUSIVE_CONTAINER</a><span class="Delimiter">)</span> <span id="L436" class="LineNr">436 </span> <span class="Identifier">return</span> size_of<span class="Delimiter">(</span>x<span class="Delimiter">)</span> < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>data<span class="Delimiter">);</span> <span id="L437" class="LineNr">437 </span><span class="Delimiter">}</span> <span id="L438" class="LineNr">438 </span> diff --git a/html/034address.cc.html b/html/034address.cc.html index 7080f375..a7b5ad1d 100644 --- a/html/034address.cc.html +++ b/html/034address.cc.html @@ -11,21 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.cSpecial { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.CommentedCode { color: #6c6c6c; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.CommentedCode { color: #6c6c6c; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -60,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/034address.cc'>https://github.com/akkartik/mu/blob/master/034address.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Addresses help us spend less time copying data around.</span> <span id="L2" class="LineNr"> 2 </span> @@ -103,9 +105,9 @@ if ('onhashchange' in window) { <span id="L40" class="LineNr"> 40 </span><span class="Comment">//: first call to 'new' has an alloc id of 1, the second gets 2, and so on.</span> <span id="L41" class="LineNr"> 41 </span><span class="Comment">//: The alloc id is never reused.</span> <span id="L42" class="LineNr"> 42 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L43" class="LineNr"> 43 </span><span class="Normal">long</span> <span class="Normal">long</span> Next_alloc_id = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L43" class="LineNr"> 43 </span><span class="Normal">long</span> <span class="Normal">long</span> <span class="Special">Next_alloc_id</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L44" class="LineNr"> 44 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L45" class="LineNr"> 45 </span>Next_alloc_id = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L45" class="LineNr"> 45 </span><span class="Special">Next_alloc_id</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L46" class="LineNr"> 46 </span> <span id="L47" class="LineNr"> 47 </span><span class="Comment">//: The 'new' instruction records alloc ids both in the memory being allocated</span> <span id="L48" class="LineNr"> 48 </span><span class="Comment">//: and *also* in the address. The 'abandon' instruction clears alloc ids in</span> @@ -149,7 +151,7 @@ if ('onhashchange' in window) { <span id="L86" class="LineNr"> 86 </span> <span id="L87" class="LineNr"> 87 </span><span class="Comment">//: 'new' takes a weird 'type' as its first ingredient; don't error on it</span> <span id="L88" class="LineNr"> 88 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> -<span id="L89" class="LineNr"> 89 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"type"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L89" class="LineNr"> 89 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"type"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L90" class="LineNr"> 90 </span><span class="Delimiter">:(code)</span> <span id="L91" class="LineNr"> 91 </span><span class="Normal">bool</span> is_mu_type_literal<span class="Delimiter">(</span><span class="Normal">const</span> reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L92" class="LineNr"> 92 </span> <span class="Identifier">return</span> is_literal<span class="Delimiter">(</span>r<span class="Delimiter">)</span> && r<span class="Delimiter">.</span>type && r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>name == <span class="Constant">"type"</span><span class="Delimiter">;</span> @@ -158,30 +160,30 @@ if ('onhashchange' in window) { <span id="L95" class="LineNr"> 95 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L96" class="LineNr"> 96 </span>NEW<span class="Delimiter">,</span> <span id="L97" class="LineNr"> 97 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L98" class="LineNr"> 98 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"new"</span><span class="Delimiter">,</span> NEW<span class="Delimiter">);</span> +<span id="L98" class="LineNr"> 98 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"new"</span><span class="Delimiter">,</span> NEW<span class="Delimiter">);</span> <span id="L99" class="LineNr"> 99 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L100" class="LineNr">100 </span><span class="Normal">case</span> NEW: <span class="Delimiter">{</span> -<span id="L101" class="LineNr">101 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L101" class="LineNr">101 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L102" class="LineNr">102 </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> || <a href='001help.cc.html#L141'>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="L103" class="LineNr">103 </span> <a href='003trace.cc.html#L196'>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">"'new' requires one or two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L103" class="LineNr">103 </span> <a href='003trace.cc.html#L196'>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">"'new' requires one or two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L104" class="LineNr">104 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L105" class="LineNr">105 </span> <span class="Delimiter">}</span> <span id="L106" class="LineNr">106 </span> <span class="Comment">// End NEW Check Special-cases</span> <span id="L107" class="LineNr">107 </span> <span class="Normal">const</span> reagent& type = 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 id="L108" class="LineNr">108 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_type_literal<span class="Delimiter">(</span>type<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L109" class="LineNr">109 </span> <a href='003trace.cc.html#L196'>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">"first ingredient of 'new' should be a type, but got '"</span> << type<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L109" class="LineNr">109 </span> <a href='003trace.cc.html#L196'>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">"first ingredient of 'new' should be a type, but got '"</span> << type<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L110" class="LineNr">110 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L111" class="LineNr">111 </span> <span class="Delimiter">}</span> <span id="L112" class="LineNr">112 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> > <span class="Constant">1</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="L113" class="LineNr">113 </span> <a href='003trace.cc.html#L196'>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">"second ingredient of 'new' should be a number (array length), but got '"</span> << type<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L113" class="LineNr">113 </span> <a href='003trace.cc.html#L196'>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">"second ingredient of 'new' should be a number (array length), but got '"</span> << type<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L114" class="LineNr">114 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L115" class="LineNr">115 </span> <span class="Delimiter">}</span> <span id="L116" class="LineNr">116 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L117" class="LineNr">117 </span> <a href='003trace.cc.html#L196'>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">"result of 'new' should never be ignored</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L117" class="LineNr">117 </span> <a href='003trace.cc.html#L196'>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">"result of 'new' should never be ignored\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L118" class="LineNr">118 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L119" class="LineNr">119 </span> <span class="Delimiter">}</span> <span id="L120" class="LineNr">120 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!product_of_new_is_valid<span class="Delimiter">(</span>inst<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L121" class="LineNr">121 </span> <a href='003trace.cc.html#L196'>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">"product of 'new' has incorrect type: '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L121" class="LineNr">121 </span> <a href='003trace.cc.html#L196'>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">"product of 'new' has incorrect type: '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L122" class="LineNr">122 </span> <span class="Identifier">break</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="Identifier">break</span><span class="Delimiter">;</span> @@ -190,12 +192,12 @@ if ('onhashchange' in window) { <span id="L127" class="LineNr">127 </span><span class="Normal">bool</span> product_of_new_is_valid<span class="Delimiter">(</span><span class="Normal">const</span> instruction& inst<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L128" class="LineNr">128 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> product = 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 id="L129" class="LineNr">129 </span> <span class="Comment">// Update NEW product in Check</span> -<span id="L130" class="LineNr">130 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!product<span class="Delimiter">.</span>type || product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom || product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value != Address_type_ordinal<span class="Delimiter">)</span> +<span id="L130" class="LineNr">130 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!product<span class="Delimiter">.</span>type || product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom || product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value != <span class="Special">Address_type_ordinal</span><span class="Delimiter">)</span> <span id="L131" class="LineNr">131 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L132" class="LineNr">132 </span> drop_from_type<span class="Delimiter">(</span>product<span class="Delimiter">,</span> <span class="Constant">"address"</span><span class="Delimiter">);</span> <span id="L133" class="LineNr">133 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L134" class="LineNr">134 </span> <span class="Comment">// array allocation</span> -<span id="L135" class="LineNr">135 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!product<span class="Delimiter">.</span>type || product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom || product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value != Array_type_ordinal<span class="Delimiter">)</span> +<span id="L135" class="LineNr">135 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!product<span class="Delimiter">.</span>type || product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom || product<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value != <span class="Special">Array_type_ordinal</span><span class="Delimiter">)</span> <span id="L136" class="LineNr">136 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L137" class="LineNr">137 </span> drop_from_type<span class="Delimiter">(</span>product<span class="Delimiter">,</span> <span class="Constant">"array"</span><span class="Delimiter">);</span> <span id="L138" class="LineNr">138 </span> <span class="Delimiter">}</span> @@ -206,7 +208,7 @@ if ('onhashchange' in window) { <span id="L143" class="LineNr">143 </span><span class="Normal">void</span> drop_from_type<span class="Delimiter">(</span>reagent& r<span class="Delimiter">,</span> string expected_type<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L144" class="LineNr">144 </span> assert<span class="Delimiter">(</span>!r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom<span class="Delimiter">);</span> <span id="L145" class="LineNr">145 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>name != expected_type<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L146" class="LineNr">146 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"can't drop2 "</span> << expected_type << <span class="Constant">" from '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L146" class="LineNr">146 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"can't drop2 "</span> << expected_type << <span class="Constant">" from '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L147" class="LineNr">147 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L148" class="LineNr">148 </span> <span class="Delimiter">}</span> <span id="L149" class="LineNr">149 </span> <span class="Comment">// r.type = r.type->right</span> @@ -264,23 +266,23 @@ if ('onhashchange' in window) { <span id="L201" class="LineNr">201 </span><span class="Comment">//: instructions left after the transforms have run.</span> <span id="L202" class="LineNr">202 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L203" class="LineNr">203 </span><span class="Normal">case</span> ALLOCATE: <span class="Delimiter">{</span> -<span id="L204" class="LineNr">204 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"never call 'allocate' directly'; always use 'new'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L204" class="LineNr">204 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"never call 'allocate' directly'; always use 'new'\n"</span> << end<span class="Delimiter">();</span> <span id="L205" class="LineNr">205 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L206" class="LineNr">206 </span><span class="Delimiter">}</span> <span id="L207" class="LineNr">207 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L208" class="LineNr">208 </span><span class="Normal">case</span> NEW: <span class="Delimiter">{</span> -<span id="L209" class="LineNr">209 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"no implementation for 'new'; why wasn't it translated to 'allocate'? Please save a copy of your program and send it to Kartik.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L209" class="LineNr">209 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"no implementation for 'new'; why wasn't it translated to 'allocate'? Please save a copy of your program and send it to Kartik.\n"</span> << end<span class="Delimiter">();</span> <span id="L210" class="LineNr">210 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L211" class="LineNr">211 </span><span class="Delimiter">}</span> <span id="L212" class="LineNr">212 </span> <span id="L213" class="LineNr">213 </span><span class="Delimiter">:(after "Transform.push_back(check_instruction)")</span> <span class="Comment">// check_instruction will guard against direct 'allocate' instructions below</span> -<span id="L214" class="LineNr">214 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>transform_new_to_allocate<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L214" class="LineNr">214 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>transform_new_to_allocate<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L215" class="LineNr">215 </span> <span id="L216" class="LineNr">216 </span><span class="Delimiter">:(code)</span> <span id="L217" class="LineNr">217 </span><span class="Normal">void</span> transform_new_to_allocate<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="L218" class="LineNr">218 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- convert 'new' to 'allocate' for <a href='010vm.cc.html#L19'>recipe</a> "</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L219" class="LineNr">219 </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#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L220" class="LineNr">220 </span> instruction& inst = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L218" class="LineNr">218 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- convert 'new' to 'allocate' for <a href='010vm.cc.html#L19'>recipe</a> "</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L219" class="LineNr">219 </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#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L220" class="LineNr">220 </span> instruction& inst = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L221" class="LineNr">221 </span> <span class="Comment">// Convert 'new' To 'allocate'</span> <span id="L222" class="LineNr">222 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name == <span class="Constant">"new"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L223" class="LineNr">223 </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="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> @@ -296,30 +298,30 @@ if ('onhashchange' in window) { <span id="L233" class="LineNr">233 </span><span class="Comment">//: implement 'allocate' based on size</span> <span id="L234" class="LineNr">234 </span> <span id="L235" class="LineNr">235 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L236" class="LineNr">236 </span><span class="Normal">extern</span> <span class="Normal">const</span> <span class="Normal">int</span> Reserved_for_tests = <span class="Constant">1000</span><span class="Delimiter">;</span> -<span id="L237" class="LineNr">237 </span><span class="Normal">int</span> Memory_allocated_until = Reserved_for_tests<span class="Delimiter">;</span> -<span id="L238" class="LineNr">238 </span><span class="Normal">int</span> Initial_memory_per_routine = <span class="Constant">100000</span><span class="Delimiter">;</span> +<span id="L236" class="LineNr">236 </span><span class="Normal">extern</span> <span class="Normal">const</span> <span class="Normal">int</span> <span class="Special">Reserved_for_tests</span> = <span class="Constant">1000</span><span class="Delimiter">;</span> +<span id="L237" class="LineNr">237 </span><span class="Normal">int</span> <span class="Special">Memory_allocated_until</span> = <span class="Special">Reserved_for_tests</span><span class="Delimiter">;</span> +<span id="L238" class="LineNr">238 </span><span class="Normal">int</span> <span class="Special">Initial_memory_per_routine</span> = <span class="Constant">100000</span><span class="Delimiter">;</span> <span id="L239" class="LineNr">239 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L240" class="LineNr">240 </span>Memory_allocated_until = Reserved_for_tests<span class="Delimiter">;</span> -<span id="L241" class="LineNr">241 </span>Initial_memory_per_routine = <span class="Constant">100000</span><span class="Delimiter">;</span> +<span id="L240" class="LineNr">240 </span><span class="Special">Memory_allocated_until</span> = <span class="Special">Reserved_for_tests</span><span class="Delimiter">;</span> +<span id="L241" class="LineNr">241 </span><span class="Special">Initial_memory_per_routine</span> = <span class="Constant">100000</span><span class="Delimiter">;</span> <span id="L242" class="LineNr">242 </span><span class="Delimiter">:(before "End routine Fields")</span> <span id="L243" class="LineNr">243 </span><span class="Normal">int</span> alloc<span class="Delimiter">,</span> alloc_max<span class="Delimiter">;</span> <span id="L244" class="LineNr">244 </span><span class="Delimiter">:(before "End routine Constructor")</span> -<span id="L245" class="LineNr">245 </span>alloc = Memory_allocated_until<span class="Delimiter">;</span> -<span id="L246" class="LineNr">246 </span>Memory_allocated_until += Initial_memory_per_routine<span class="Delimiter">;</span> -<span id="L247" class="LineNr">247 </span>alloc_max = Memory_allocated_until<span class="Delimiter">;</span> +<span id="L245" class="LineNr">245 </span>alloc = <span class="Special">Memory_allocated_until</span><span class="Delimiter">;</span> +<span id="L246" class="LineNr">246 </span><span class="Special">Memory_allocated_until</span> += <span class="Special">Initial_memory_per_routine</span><span class="Delimiter">;</span> +<span id="L247" class="LineNr">247 </span>alloc_max = <span class="Special">Memory_allocated_until</span><span class="Delimiter">;</span> <span id="L248" class="LineNr">248 </span><a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"new"</span><span class="Delimiter">)</span> << <span class="Constant">"routine allocated memory from "</span> << alloc << <span class="Constant">" to "</span> << alloc_max << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L249" class="LineNr">249 </span> <span id="L250" class="LineNr">250 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L251" class="LineNr">251 </span>ALLOCATE<span class="Delimiter">,</span> <span id="L252" class="LineNr">252 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L253" class="LineNr">253 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"allocate"</span><span class="Delimiter">,</span> ALLOCATE<span class="Delimiter">);</span> +<span id="L253" class="LineNr">253 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"allocate"</span><span class="Delimiter">,</span> ALLOCATE<span class="Delimiter">);</span> <span id="L254" class="LineNr">254 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L255" class="LineNr">255 </span><span class="Normal">case</span> ALLOCATE: <span class="Delimiter">{</span> <span id="L256" class="LineNr">256 </span> <span class="Comment">// compute the space we need</span> <span id="L257" class="LineNr">257 </span> <span class="Normal">int</span> size = 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="L258" class="LineNr">258 </span> <span class="Normal">int</span> alloc_id = Next_alloc_id<span class="Delimiter">;</span> -<span id="L259" class="LineNr">259 </span> Next_alloc_id++<span class="Delimiter">;</span> +<span id="L258" class="LineNr">258 </span> <span class="Normal">int</span> alloc_id = <span class="Special">Next_alloc_id</span><span class="Delimiter">;</span> +<span id="L259" class="LineNr">259 </span> <span class="Special">Next_alloc_id</span>++<span class="Delimiter">;</span> <span id="L260" class="LineNr">260 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>ingredients<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L261" class="LineNr">261 </span> <span class="Comment">// array allocation</span> <span id="L262" class="LineNr">262 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"array length is "</span> << 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> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> @@ -328,11 +330,11 @@ if ('onhashchange' in window) { <span id="L265" class="LineNr">265 </span> <span class="Normal">int</span> result = allocate<span class="Delimiter">(</span>size<span class="Delimiter">);</span> <span id="L266" class="LineNr">266 </span> <span class="Comment">// initialize alloc-id in payload</span> <span id="L267" class="LineNr">267 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing alloc-id "</span> << alloc_id << <span class="Constant">" in location "</span> << result << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L268" class="LineNr">268 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> result<span class="Delimiter">,</span> alloc_id<span class="Delimiter">);</span> +<span id="L268" class="LineNr">268 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> result<span class="Delimiter">,</span> alloc_id<span class="Delimiter">);</span> <span id="L269" class="LineNr">269 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L270" class="LineNr">270 </span> <span class="Comment">// initialize array length</span> <span id="L271" class="LineNr">271 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing array length "</span> << 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 class="Constant">" in location "</span> << result+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L272" class="LineNr">272 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> result+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> 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="L272" class="LineNr">272 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> result+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> 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="L273" class="LineNr">273 </span> <span class="Delimiter">}</span> <span id="L274" class="LineNr">274 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L275" class="LineNr">275 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>alloc_id<span class="Delimiter">);</span> @@ -350,16 +352,16 @@ if ('onhashchange' in window) { <span id="L287" class="LineNr">287 </span> <span class="Comment">// compute the region of memory to return</span> <span id="L288" class="LineNr">288 </span> <span class="Comment">// really crappy at the moment</span> <span id="L289" class="LineNr">289 </span> ensure_space<span class="Delimiter">(</span>size<span class="Delimiter">);</span> -<span id="L290" class="LineNr">290 </span> <span class="Normal">const</span> <span class="Normal">int</span> result = Current_routine<span class="Delimiter">-></span>alloc<span class="Delimiter">;</span> +<span id="L290" class="LineNr">290 </span> <span class="Normal">const</span> <span class="Normal">int</span> result = <span class="Special">Current_routine</span><span class="Delimiter">-></span>alloc<span class="Delimiter">;</span> <span id="L291" class="LineNr">291 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"new alloc: "</span> << result << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L292" class="LineNr">292 </span> <span class="Comment">// initialize allocated space</span> <span id="L293" class="LineNr">293 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> <a href='043space.cc.html#L101'>address</a> = result<span class="Delimiter">;</span> <a href='043space.cc.html#L101'>address</a> < result+size<span class="Delimiter">;</span> ++address<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L294" class="LineNr">294 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing 0 in location "</span> << <a href='043space.cc.html#L101'>address</a> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L295" class="LineNr">295 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L295" class="LineNr">295 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L296" class="LineNr">296 </span> <span class="Delimiter">}</span> -<span id="L297" class="LineNr">297 </span> Current_routine<span class="Delimiter">-></span>alloc += size<span class="Delimiter">;</span> +<span id="L297" class="LineNr">297 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>alloc += size<span class="Delimiter">;</span> <span id="L298" class="LineNr">298 </span> <span class="Comment">// no support yet for reclaiming memory between routines</span> -<span id="L299" class="LineNr">299 </span> assert<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>alloc <= Current_routine<span class="Delimiter">-></span>alloc_max<span class="Delimiter">);</span> +<span id="L299" class="LineNr">299 </span> assert<span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>alloc <= <span class="Special">Current_routine</span><span class="Delimiter">-></span>alloc_max<span class="Delimiter">);</span> <span id="L300" class="LineNr">300 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L301" class="LineNr">301 </span><span class="Delimiter">}</span> <span id="L302" class="LineNr">302 </span> @@ -379,16 +381,16 @@ if ('onhashchange' in window) { <span id="L316" class="LineNr">316 </span> <span id="L317" class="LineNr">317 </span><span class="Delimiter">:(code)</span> <span id="L318" class="LineNr">318 </span><span class="Normal">void</span> ensure_space<span class="Delimiter">(</span><span class="Normal">int</span> size<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L319" class="LineNr">319 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>size > Initial_memory_per_routine<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L320" class="LineNr">320 </span> cerr << <span class="Constant">"can't allocate "</span> << size << <span class="Constant">" locations, that's too much compared to "</span> << Initial_memory_per_routine << <span class="Constant">".</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L319" class="LineNr">319 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>size > <span class="Special">Initial_memory_per_routine</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L320" class="LineNr">320 </span> cerr << <span class="Constant">"can't allocate "</span> << size << <span class="Constant">" locations, that's too much compared to "</span> << <span class="Special">Initial_memory_per_routine</span> << <span class="Constant">".\n"</span><span class="Delimiter">;</span> <span id="L321" class="LineNr">321 </span> exit<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L322" class="LineNr">322 </span> <span class="Delimiter">}</span> -<span id="L323" class="LineNr">323 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>alloc + size > Current_routine<span class="Delimiter">-></span>alloc_max<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L323" class="LineNr">323 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>alloc + size > <span class="Special">Current_routine</span><span class="Delimiter">-></span>alloc_max<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L324" class="LineNr">324 </span> <span class="Comment">// waste the remaining space and create a new chunk</span> -<span id="L325" class="LineNr">325 </span> Current_routine<span class="Delimiter">-></span>alloc = Memory_allocated_until<span class="Delimiter">;</span> -<span id="L326" class="LineNr">326 </span> Memory_allocated_until += Initial_memory_per_routine<span class="Delimiter">;</span> -<span id="L327" class="LineNr">327 </span> Current_routine<span class="Delimiter">-></span>alloc_max = Memory_allocated_until<span class="Delimiter">;</span> -<span id="L328" class="LineNr">328 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"new"</span><span class="Delimiter">)</span> << <span class="Constant">"routine allocated memory from "</span> << Current_routine<span class="Delimiter">-></span>alloc << <span class="Constant">" to "</span> << Current_routine<span class="Delimiter">-></span>alloc_max << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L325" class="LineNr">325 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>alloc = <span class="Special">Memory_allocated_until</span><span class="Delimiter">;</span> +<span id="L326" class="LineNr">326 </span> <span class="Special">Memory_allocated_until</span> += <span class="Special">Initial_memory_per_routine</span><span class="Delimiter">;</span> +<span id="L327" class="LineNr">327 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>alloc_max = <span class="Special">Memory_allocated_until</span><span class="Delimiter">;</span> +<span id="L328" class="LineNr">328 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"new"</span><span class="Delimiter">)</span> << <span class="Constant">"routine allocated memory from "</span> << <span class="Special">Current_routine</span><span class="Delimiter">-></span>alloc << <span class="Constant">" to "</span> << <span class="Special">Current_routine</span><span class="Delimiter">-></span>alloc_max << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L329" class="LineNr">329 </span> <span class="Delimiter">}</span> <span id="L330" class="LineNr">330 </span><span class="Delimiter">}</span> <span id="L331" class="LineNr">331 </span> @@ -471,23 +473,23 @@ if ('onhashchange' in window) { <span id="L408" class="LineNr">408 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L409" class="LineNr">409 </span>DEADDRESS<span class="Delimiter">,</span> <span id="L410" class="LineNr">410 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L411" class="LineNr">411 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"deaddress"</span><span class="Delimiter">,</span> DEADDRESS<span class="Delimiter">);</span> +<span id="L411" class="LineNr">411 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"deaddress"</span><span class="Delimiter">,</span> DEADDRESS<span class="Delimiter">);</span> <span id="L412" class="LineNr">412 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L413" class="LineNr">413 </span><span class="Normal">case</span> DEADDRESS: <span class="Delimiter">{</span> <span id="L414" class="LineNr">414 </span> <span class="Comment">// primary goal of these checks is to forbid address arithmetic</span> <span id="L415" class="LineNr">415 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L416" class="LineNr">416 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_address<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="L417" class="LineNr">417 </span> <a href='003trace.cc.html#L196'>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">"'deaddress' requires <a href='043space.cc.html#L101'>address</a> ingredients, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L417" class="LineNr">417 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'deaddress' requires <a href='043space.cc.html#L101'>address</a> ingredients, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L418" class="LineNr">418 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L419" class="LineNr">419 </span> <span class="Delimiter">}</span> <span id="L420" class="LineNr">420 </span> <span class="Delimiter">}</span> <span id="L421" class="LineNr">421 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> > <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L422" class="LineNr">422 </span> <a href='003trace.cc.html#L196'>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">"too many products in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L422" class="LineNr">422 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"too many products in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L423" class="LineNr">423 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L424" class="LineNr">424 </span> <span class="Delimiter">}</span> <span id="L425" class="LineNr">425 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L426" class="LineNr">426 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_real_mu_number<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="L427" class="LineNr">427 </span> <a href='003trace.cc.html#L196'>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">"'deaddress' requires number products, but got '"</span> << inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L427" class="LineNr">427 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'deaddress' requires number products, but got '"</span> << inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L428" class="LineNr">428 </span> <span class="Identifier">goto</span> finish_checking_instruction<span class="Delimiter">;</span> <span id="L429" class="LineNr">429 </span> <span class="Delimiter">}</span> <span id="L430" class="LineNr">430 </span> <span class="Delimiter">}</span> diff --git a/html/035lookup.cc.html b/html/035lookup.cc.html index 97957855..cd8f9007 100644 --- a/html/035lookup.cc.html +++ b/html/035lookup.cc.html @@ -11,23 +11,25 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .traceAbsent { color: #c00000; } .SalientComment { color: #00ffff; } -.CommentedCode { color: #6c6c6c; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.cSpecial { color: #008000; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.cSpecial { color: #008000; } +.Comment { color: #8080ff; } +.CommentedCode { color: #6c6c6c; } .traceContains { color: #008000; } --> </style> @@ -62,6 +64,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/035lookup.cc'>https://github.com/akkartik/mu/blob/master/035lookup.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Go from an address to the payload it points at using /lookup.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//:</span> @@ -136,14 +139,14 @@ if ('onhashchange' in window) { <span id="L71" class="LineNr"> 71 </span><span class="Delimiter">}</span> <span id="L72" class="LineNr"> 72 </span> <span id="L73" class="LineNr"> 73 </span><span class="Normal">void</span> <a href='035lookup.cc.html#L73'>lookup_memory</a><span class="Delimiter">(</span>reagent& x<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L74" class="LineNr"> 74 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type || x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom || x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value != Address_type_ordinal<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L75" class="LineNr"> 75 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to lookup '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"' but it isn't an address</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L74" class="LineNr"> 74 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type || x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom || x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value != <span class="Special">Address_type_ordinal</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L75" class="LineNr"> 75 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to lookup '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"' but it isn't an address\n"</span> << end<span class="Delimiter">();</span> <span id="L76" class="LineNr"> 76 </span> dump_callstack<span class="Delimiter">();</span> <span id="L77" class="LineNr"> 77 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L78" class="LineNr"> 78 </span> <span class="Delimiter">}</span> <span id="L79" class="LineNr"> 79 </span> <span class="Comment">// compute value</span> <span id="L80" class="LineNr"> 80 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L81" class="LineNr"> 81 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to lookup 0</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L81" class="LineNr"> 81 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to lookup 0\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L82" class="LineNr"> 82 </span> dump_callstack<span class="Delimiter">();</span> <span id="L83" class="LineNr"> 83 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L84" class="LineNr"> 84 </span> <span class="Delimiter">}</span> @@ -152,24 +155,24 @@ if ('onhashchange' in window) { <span id="L87" class="LineNr"> 87 </span> <span id="L88" class="LineNr"> 88 </span><span class="Normal">void</span> <a href='035lookup.cc.html#L88'>lookup_memory_core</a><span class="Delimiter">(</span>reagent& x<span class="Delimiter">,</span> <span class="Normal">bool</span> check_for_null<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L89" class="LineNr"> 89 </span> <span class="Normal">double</span> <a href='043space.cc.html#L101'>address</a> = x<span class="Delimiter">.</span>value + <span class="Comment">/*</span><span class="Comment">skip alloc id in <a href='043space.cc.html#L101'>address</a></span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L90" class="LineNr"> 90 </span> <span class="Normal">double</span> new_value = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">);</span> +<span id="L90" class="LineNr"> 90 </span> <span class="Normal">double</span> new_value = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">);</span> <span id="L91" class="LineNr"> 91 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"location "</span> << <a href='043space.cc.html#L101'>address</a> << <span class="Constant">" contains "</span> << no_scientific<span class="Delimiter">(</span>new_value<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L92" class="LineNr"> 92 </span> <span class="Comment">// check for null</span> <span id="L93" class="LineNr"> 93 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>check_for_null && new_value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L94" class="LineNr"> 94 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L95" class="LineNr"> 95 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to lookup 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L94" class="LineNr"> 94 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L95" class="LineNr"> 95 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to lookup 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L96" class="LineNr"> 96 </span> dump_callstack<span class="Delimiter">();</span> <span id="L97" class="LineNr"> 97 </span> <span class="Delimiter">}</span> <span id="L98" class="LineNr"> 98 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> -<span id="L99" class="LineNr"> 99 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"tried to lookup 0</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L99" class="LineNr"> 99 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"tried to lookup 0\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <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 class="Comment">// validate alloc-id</span> -<span id="L103" class="LineNr">103 </span> <span class="Normal">double</span> alloc_id_in_address = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> x<span class="Delimiter">.</span>value<span class="Delimiter">);</span> -<span id="L104" class="LineNr">104 </span> <span class="Normal">double</span> alloc_id_in_payload = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> new_value<span class="Delimiter">);</span> +<span id="L103" class="LineNr">103 </span> <span class="Normal">double</span> alloc_id_in_address = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> x<span class="Delimiter">.</span>value<span class="Delimiter">);</span> +<span id="L104" class="LineNr">104 </span> <span class="Normal">double</span> alloc_id_in_payload = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> new_value<span class="Delimiter">);</span> <span id="L105" class="LineNr">105 </span><span class="CommentedCode">//? cerr << x.value << ": " << alloc_id_in_address << " vs " << new_value << ": " << alloc_id_in_payload << '\n';</span> <span id="L106" class="LineNr">106 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>alloc_id_in_address != alloc_id_in_payload<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L107" class="LineNr">107 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"address is already abandoned in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L107" class="LineNr">107 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"address is already abandoned in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L108" class="LineNr">108 </span> dump_callstack<span class="Delimiter">();</span> <span id="L109" class="LineNr">109 </span> <span class="Delimiter">}</span> <span id="L110" class="LineNr">110 </span> <span class="Comment">// all well; complete the lookup</span> @@ -215,7 +218,7 @@ if ('onhashchange' in window) { <span id="L150" class="LineNr">150 </span><span class="Delimiter">:(code)</span> <span id="L151" class="LineNr">151 </span><span class="Normal">bool</span> canonize_type<span class="Delimiter">(</span>reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L152" class="LineNr">152 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>has_property<span class="Delimiter">(</span>r<span class="Delimiter">,</span> <span class="Constant">"lookup"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L153" class="LineNr">153 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!r<span class="Delimiter">.</span>type || r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom || !r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left || !r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom || r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value != Address_type_ordinal<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L153" class="LineNr">153 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!r<span class="Delimiter">.</span>type || r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom || !r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left || !r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom || r<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value != <span class="Special">Address_type_ordinal</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L154" class="LineNr">154 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"cannot perform lookup on '"</span> << r<span class="Delimiter">.</span>name << <span class="Constant">"' because it has non-address type "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L155" class="LineNr">155 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L156" class="LineNr">156 </span> <span class="Delimiter">}</span> @@ -317,7 +320,7 @@ if ('onhashchange' in window) { <span id="L252" class="LineNr">252 </span>reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> i = 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 id="L253" class="LineNr">253 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!canonize_type<span class="Delimiter">(</span>i<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> <span id="L254" class="LineNr">254 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!types_strictly_match<span class="Delimiter">(</span>p<span class="Delimiter">,</span> i<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L255" class="LineNr">255 </span> <a href='003trace.cc.html#L196'>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">"product of 'put' must be first ingredient '"</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">"', but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L255" class="LineNr">255 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"product of 'put' must be first ingredient '"</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">"', but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L256" class="LineNr">256 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L257" class="LineNr">257 </span><span class="Delimiter">}</span> <span id="L258" class="LineNr">258 </span> @@ -432,7 +435,7 @@ if ('onhashchange' in window) { <span id="L367" class="LineNr">367 </span>reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> i = 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 id="L368" class="LineNr">368 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!canonize_type<span class="Delimiter">(</span>i<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> <span id="L369" class="LineNr">369 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!types_strictly_match<span class="Delimiter">(</span>p<span class="Delimiter">,</span> i<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L370" class="LineNr">370 </span> <a href='003trace.cc.html#L196'>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">"product of 'put-index' must be first ingredient '"</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">"', but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L370" class="LineNr">370 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"product of 'put-index' must be first ingredient '"</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">"', but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L371" class="LineNr">371 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L372" class="LineNr">372 </span><span class="Delimiter">}</span> <span id="L373" class="LineNr">373 </span> @@ -561,7 +564,7 @@ if ('onhashchange' in window) { <span id="L496" class="LineNr">496 </span> properties<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>pair<string<span class="Delimiter">,</span> string_tree*><span class="Delimiter">(</span><span class="Constant">"lookup"</span><span class="Delimiter">,</span> <span class="Constant">NULL</span><span class="Delimiter">));</span> <span id="L497" class="LineNr">497 </span> <span class="Delimiter">}</span> <span id="L498" class="LineNr">498 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> -<span id="L499" class="LineNr">499 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"illegal name '"</span> << original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L499" class="LineNr">499 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"illegal name '"</span> << original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L500" class="LineNr">500 </span><span class="Delimiter">}</span> <span id="L501" class="LineNr">501 </span> <span id="L502" class="LineNr">502 </span><span class="SalientComment">//:: helpers for debugging</span> @@ -569,33 +572,33 @@ if ('onhashchange' in window) { <span id="L504" class="LineNr">504 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L505" class="LineNr">505 </span>_DUMP<span class="Delimiter">,</span> <span id="L506" class="LineNr">506 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L507" class="LineNr">507 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$dump"</span><span class="Delimiter">,</span> _DUMP<span class="Delimiter">);</span> +<span id="L507" class="LineNr">507 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$dump"</span><span class="Delimiter">,</span> _DUMP<span class="Delimiter">);</span> <span id="L508" class="LineNr">508 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L509" class="LineNr">509 </span><span class="Normal">case</span> _DUMP: <span class="Delimiter">{</span> <span id="L510" class="LineNr">510 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> after_canonize = <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L511" class="LineNr">511 </span> <a href='035lookup.cc.html#L66'>canonize</a><span class="Delimiter">(</span>after_canonize<span class="Delimiter">);</span> -<span id="L512" class="LineNr">512 </span> cerr << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name << <span class="Constant">' '</span> << no_scientific<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>value<span class="Delimiter">)</span> << <span class="Constant">" => "</span> << no_scientific<span class="Delimiter">(</span>after_canonize<span class="Delimiter">.</span>value<span class="Delimiter">)</span> << <span class="Constant">" => "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> after_canonize<span class="Delimiter">.</span>value<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L512" class="LineNr">512 </span> cerr << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name << <span class="Constant">' '</span> << no_scientific<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>value<span class="Delimiter">)</span> << <span class="Constant">" => "</span> << no_scientific<span class="Delimiter">(</span>after_canonize<span class="Delimiter">.</span>value<span class="Delimiter">)</span> << <span class="Constant">" => "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> after_canonize<span class="Delimiter">.</span>value<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L513" class="LineNr">513 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L514" class="LineNr">514 </span><span class="Delimiter">}</span> <span id="L515" class="LineNr">515 </span> <span id="L516" class="LineNr">516 </span><span class="Comment">//: grab an address, and then dump its value at intervals</span> <span id="L517" class="LineNr">517 </span><span class="Comment">//: useful for tracking down memory corruption (writing to an out-of-bounds address)</span> <span id="L518" class="LineNr">518 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L519" class="LineNr">519 </span><span class="Normal">int</span> Bar = -<span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L519" class="LineNr">519 </span><span class="Normal">int</span> <span class="Special">Bar</span> = -<span class="Constant">1</span><span class="Delimiter">;</span> <span id="L520" class="LineNr">520 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L521" class="LineNr">521 </span>_BAR<span class="Delimiter">,</span> <span id="L522" class="LineNr">522 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L523" class="LineNr">523 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$bar"</span><span class="Delimiter">,</span> _BAR<span class="Delimiter">);</span> +<span id="L523" class="LineNr">523 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$bar"</span><span class="Delimiter">,</span> _BAR<span class="Delimiter">);</span> <span id="L524" class="LineNr">524 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L525" class="LineNr">525 </span><span class="Normal">case</span> _BAR: <span class="Delimiter">{</span> <span id="L526" class="LineNr">526 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L527" class="LineNr">527 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Bar != -<span class="Constant">1</span><span class="Delimiter">)</span> cerr << Bar << <span class="Constant">": "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> Bar<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L527" class="LineNr">527 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Bar</span> != -<span class="Constant">1</span><span class="Delimiter">)</span> cerr << <span class="Special">Bar</span> << <span class="Constant">": "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> <span class="Special">Bar</span><span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L528" class="LineNr">528 </span> <span class="Normal">else</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L529" class="LineNr">529 </span> <span class="Delimiter">}</span> <span id="L530" class="LineNr">530 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L531" class="LineNr">531 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> tmp = <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L532" class="LineNr">532 </span> <a href='035lookup.cc.html#L66'>canonize</a><span class="Delimiter">(</span>tmp<span class="Delimiter">);</span> -<span id="L533" class="LineNr">533 </span> Bar = tmp<span class="Delimiter">.</span>value<span class="Delimiter">;</span> +<span id="L533" class="LineNr">533 </span> <span class="Special">Bar</span> = tmp<span class="Delimiter">.</span>value<span class="Delimiter">;</span> <span id="L534" class="LineNr">534 </span> <span class="Delimiter">}</span> <span id="L535" class="LineNr">535 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L536" class="LineNr">536 </span><span class="Delimiter">}</span> diff --git a/html/036abandon.cc.html b/html/036abandon.cc.html index 90068580..76f3c89a 100644 --- a/html/036abandon.cc.html +++ b/html/036abandon.cc.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .CommentedCode { color: #6c6c6c; } .traceContains { color: #008000; } --> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/036abandon.cc'>https://github.com/akkartik/mu/blob/master/036abandon.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Reclaiming memory when it's no longer used.</span> <span id="L2" class="LineNr"> 2 </span> @@ -95,16 +98,16 @@ if ('onhashchange' in window) { <span id="L32" class="LineNr"> 32 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L33" class="LineNr"> 33 </span>ABANDON<span class="Delimiter">,</span> <span id="L34" class="LineNr"> 34 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L35" class="LineNr"> 35 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"abandon"</span><span class="Delimiter">,</span> ABANDON<span class="Delimiter">);</span> +<span id="L35" class="LineNr"> 35 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"abandon"</span><span class="Delimiter">,</span> ABANDON<span class="Delimiter">);</span> <span id="L36" class="LineNr"> 36 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L37" class="LineNr"> 37 </span><span class="Normal">case</span> ABANDON: <span class="Delimiter">{</span> <span id="L38" class="LineNr"> 38 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L39" class="LineNr"> 39 </span> <a href='003trace.cc.html#L196'>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">"'abandon' shouldn't write to any products in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L39" class="LineNr"> 39 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'abandon' shouldn't write to any products in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L40" class="LineNr"> 40 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L41" class="LineNr"> 41 </span> <span class="Delimiter">}</span> <span id="L42" class="LineNr"> 42 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L43" class="LineNr"> 43 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_address<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 id="L44" class="LineNr"> 44 </span> <a href='003trace.cc.html#L196'>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">"ingredients of 'abandon' should be addresses, but ingredient "</span> << i << <span class="Constant">" is '"</span> << to_string<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="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> +<span id="L44" class="LineNr"> 44 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"ingredients of 'abandon' should be addresses, but ingredient "</span> << i << <span class="Constant">" is '"</span> << to_string<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="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span id="L45" class="LineNr"> 45 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L46" class="LineNr"> 46 </span> <span class="Delimiter">}</span> <span id="L47" class="LineNr"> 47 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -114,25 +117,25 @@ if ('onhashchange' in window) { <span id="L51" class="LineNr"> 51 </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#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L52" class="LineNr"> 52 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> ingredient = <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L53" class="LineNr"> 53 </span> <a href='035lookup.cc.html#L66'>canonize</a><span class="Delimiter">(</span>ingredient<span class="Delimiter">);</span> -<span id="L54" class="LineNr"> 54 </span> <a href='036abandon.cc.html#L63'>abandon</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> ingredient<span class="Delimiter">.</span>value+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">),</span> <a href='036abandon.cc.html#L75'>payload_size</a><span class="Delimiter">(</span>ingredient<span class="Delimiter">));</span> +<span id="L54" class="LineNr"> 54 </span> <a href='036abandon.cc.html#L63'>abandon</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> ingredient<span class="Delimiter">.</span>value+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">),</span> <a href='036abandon.cc.html#L75'>payload_size</a><span class="Delimiter">(</span>ingredient<span class="Delimiter">));</span> <span id="L55" class="LineNr"> 55 </span><span class="CommentedCode">//? cerr << "clear after abandon: " << ingredient.value << '\n';</span> -<span id="L56" class="LineNr"> 56 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">alloc id</span><span class="Comment">*/</span>ingredient<span class="Delimiter">.</span>value<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">invalid</span><span class="Comment">*/</span>-<span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L57" class="LineNr"> 57 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment"><a href='043space.cc.html#L101'>address</a></span><span class="Comment">*/</span>ingredient<span class="Delimiter">.</span>value+<span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L56" class="LineNr"> 56 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">alloc id</span><span class="Comment">*/</span>ingredient<span class="Delimiter">.</span>value<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">invalid</span><span class="Comment">*/</span>-<span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L57" class="LineNr"> 57 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment"><a href='043space.cc.html#L101'>address</a></span><span class="Comment">*/</span>ingredient<span class="Delimiter">.</span>value+<span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L58" class="LineNr"> 58 </span> <span class="Delimiter">}</span> <span id="L59" class="LineNr"> 59 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L60" class="LineNr"> 60 </span><span class="Delimiter">}</span> <span id="L61" class="LineNr"> 61 </span> <span id="L62" class="LineNr"> 62 </span><span class="Delimiter">:(code)</span> <span id="L63" class="LineNr"> 63 </span><span class="Normal">void</span> <a href='036abandon.cc.html#L63'>abandon</a><span class="Delimiter">(</span><span class="Normal">int</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">,</span> <span class="Normal">int</span> <a href='036abandon.cc.html#L75'>payload_size</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L64" class="LineNr"> 64 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">invalid alloc-id</span><span class="Comment">*/</span>-<span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L64" class="LineNr"> 64 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">invalid alloc-id</span><span class="Comment">*/</span>-<span class="Constant">1</span><span class="Delimiter">);</span> <span id="L65" class="LineNr"> 65 </span><span class="CommentedCode">//? cerr << "abandon: " << address << '\n';</span> <span id="L66" class="LineNr"> 66 </span> <span class="Comment">// clear rest of payload</span> <span id="L67" class="LineNr"> 67 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> curr = address+<span class="Constant">1</span><span class="Delimiter">;</span> curr < address+payload_size<span class="Delimiter">;</span> ++curr<span class="Delimiter">)</span> -<span id="L68" class="LineNr"> 68 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L68" class="LineNr"> 68 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L69" class="LineNr"> 69 </span> <span class="Comment">// append existing free list to address</span> <span id="L70" class="LineNr"> 70 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"abandon"</span><span class="Delimiter">)</span> << <span class="Constant">"saving "</span> << <a href='043space.cc.html#L101'>address</a> << <span class="Constant">" in free-list of size "</span> << <a href='036abandon.cc.html#L75'>payload_size</a> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L71" class="LineNr"> 71 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> address+<span class="Comment">/*</span><span class="Comment">skip invalid alloc-id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> <a href='036abandon.cc.html#L75'>payload_size</a><span class="Delimiter">));</span> -<span id="L72" class="LineNr"> 72 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> <a href='036abandon.cc.html#L75'>payload_size</a><span class="Delimiter">,</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">);</span> +<span id="L71" class="LineNr"> 71 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> address+<span class="Comment">/*</span><span class="Comment">skip invalid alloc-id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> <a href='036abandon.cc.html#L75'>payload_size</a><span class="Delimiter">));</span> +<span id="L72" class="LineNr"> 72 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> <a href='036abandon.cc.html#L75'>payload_size</a><span class="Delimiter">,</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">);</span> <span id="L73" class="LineNr"> 73 </span><span class="Delimiter">}</span> <span id="L74" class="LineNr"> 74 </span> <span id="L75" class="LineNr"> 75 </span><span class="Normal">int</span> <a href='036abandon.cc.html#L75'>payload_size</a><span class="Delimiter">(</span>reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> x<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -142,18 +145,18 @@ if ('onhashchange' in window) { <span id="L79" class="LineNr"> 79 </span><span class="Delimiter">}</span> <span id="L80" class="LineNr"> 80 </span> <span id="L81" class="LineNr"> 81 </span><span class="Delimiter">:(after "Allocate Special-cases")</span> -<span id="L82" class="LineNr"> 82 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> size<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L82" class="LineNr"> 82 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> size<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L83" class="LineNr"> 83 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"abandon"</span><span class="Delimiter">)</span> << <span class="Constant">"picking up space from free-list of size "</span> << size << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L84" class="LineNr"> 84 </span> <span class="Normal">int</span> result = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> size<span class="Delimiter">);</span> +<span id="L84" class="LineNr"> 84 </span> <span class="Normal">int</span> result = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> size<span class="Delimiter">);</span> <span id="L85" class="LineNr"> 85 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"new alloc from free list: "</span> << result << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L86" class="LineNr"> 86 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> size<span class="Delimiter">,</span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> result+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">));</span> +<span id="L86" class="LineNr"> 86 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>free_list<span class="Delimiter">,</span> size<span class="Delimiter">,</span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> result+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">));</span> <span id="L87" class="LineNr"> 87 </span> <span class="Comment">// clear 'deleted' tag</span> -<span id="L88" class="LineNr"> 88 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> result<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L88" class="LineNr"> 88 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> result<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L89" class="LineNr"> 89 </span> <span class="Comment">// clear next pointer</span> -<span id="L90" class="LineNr"> 90 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> result+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L90" class="LineNr"> 90 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> result+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L91" class="LineNr"> 91 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> curr = result<span class="Delimiter">;</span> curr < result+size<span class="Delimiter">;</span> ++curr<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L92" class="LineNr"> 92 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)</span> != <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L93" class="LineNr"> 93 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"memory in free list was not zeroed out: "</span> << curr << <span class="Constant">'/'</span> << result << <span class="Constant">"; somebody wrote to us after free!!!</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L92" class="LineNr"> 92 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr<span class="Delimiter">)</span> != <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L93" class="LineNr"> 93 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"memory in free list was not zeroed out: "</span> << curr << <span class="Constant">'/'</span> << result << <span class="Constant">"; somebody wrote to us after free!!!\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L94" class="LineNr"> 94 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// always fatal</span> <span id="L95" class="LineNr"> 95 </span> <span class="Delimiter">}</span> <span id="L96" class="LineNr"> 96 </span> <span class="Delimiter">}</span> diff --git a/html/038new_text.cc.html b/html/038new_text.cc.html index 6a575b04..c862a8a7 100644 --- a/html/038new_text.cc.html +++ b/html/038new_text.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } .traceContains { color: #008000; } --> @@ -61,12 +63,13 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/038new_text.cc'>https://github.com/akkartik/mu/blob/master/038new_text.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Extend 'new' to handle a unicode string literal argument or 'text'.</span> <span id="L2" class="LineNr"> 2 </span> <span id="L3" class="LineNr"> 3 </span><span class="Comment">//: A Mu text is an address to an array of characters.</span> <span id="L4" class="LineNr"> 4 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> -<span id="L5" class="LineNr"> 5 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> <span class="Constant">"text"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"&:@:character"</span><span class="Delimiter">));</span> +<span id="L5" class="LineNr"> 5 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> <span class="Constant">"text"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"&:@:character"</span><span class="Delimiter">));</span> <span id="L6" class="LineNr"> 6 </span> <span id="L7" class="LineNr"> 7 </span><span class="Delimiter">:(scenario new_string)</span> <span id="L8" class="LineNr"> 8 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ @@ -109,7 +112,7 @@ if ('onhashchange' in window) { <span id="L45" class="LineNr"> 45 </span> <span class="Normal">int</span> curr_address = result<span class="Delimiter">;</span> <span id="L46" class="LineNr"> 46 </span> ++curr_address<span class="Delimiter">;</span> <span class="Comment">// skip alloc id</span> <span id="L47" class="LineNr"> 47 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing string length "</span> << string_length << <span class="Constant">" in location "</span> << curr_address << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L48" class="LineNr"> 48 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address<span class="Delimiter">,</span> string_length<span class="Delimiter">);</span> +<span id="L48" class="LineNr"> 48 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr_address<span class="Delimiter">,</span> string_length<span class="Delimiter">);</span> <span id="L49" class="LineNr"> 49 </span> ++curr_address<span class="Delimiter">;</span> <span class="Comment">// skip length</span> <span id="L50" class="LineNr"> 50 </span> <span class="Normal">int</span> curr = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L51" class="LineNr"> 51 </span> <span class="Normal">const</span> <span class="Normal">char</span>* raw_contents = contents<span class="Delimiter">.</span>c_str<span class="Delimiter">();</span> @@ -118,7 +121,7 @@ if ('onhashchange' in window) { <span id="L54" class="LineNr"> 54 </span> assert<span class="Delimiter">(</span>curr < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>contents<span class="Delimiter">));</span> <span id="L55" class="LineNr"> 55 </span> tb_utf8_char_to_unicode<span class="Delimiter">(</span>&curr_character<span class="Delimiter">,</span> &raw_contents[curr]<span class="Delimiter">);</span> <span id="L56" class="LineNr"> 56 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing string character "</span> << curr_character << <span class="Constant">" in location "</span> << curr_address << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L57" class="LineNr"> 57 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address<span class="Delimiter">,</span> curr_character<span class="Delimiter">);</span> +<span id="L57" class="LineNr"> 57 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr_address<span class="Delimiter">,</span> curr_character<span class="Delimiter">);</span> <span id="L58" class="LineNr"> 58 </span> curr += tb_utf8_char_length<span class="Delimiter">(</span>raw_contents[curr]<span class="Delimiter">);</span> <span id="L59" class="LineNr"> 59 </span> ++curr_address<span class="Delimiter">;</span> <span id="L60" class="LineNr"> 60 </span> <span class="Delimiter">}</span> @@ -205,7 +208,7 @@ if ('onhashchange' in window) { <span id="L141" class="LineNr">141 </span> <span id="L142" class="LineNr">142 </span>string <a href='038new_text.cc.html#L142'>read_mu_text</a><span class="Delimiter">(</span><span class="Normal">int</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L143" class="LineNr">143 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='043space.cc.html#L101'>address</a> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">""</span><span class="Delimiter">;</span> -<span id="L144" class="LineNr">144 </span> <span class="Normal">int</span> length = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> address+<span class="Comment">/*</span><span class="Comment">alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L144" class="LineNr">144 </span> <span class="Normal">int</span> length = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> address+<span class="Comment">/*</span><span class="Comment">alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L145" class="LineNr">145 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>length == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">""</span><span class="Delimiter">;</span> <span id="L146" class="LineNr">146 </span> <span class="Identifier">return</span> <a href='038new_text.cc.html#L149'>read_mu_characters</a><span class="Delimiter">(</span>address+<span class="Comment">/*</span><span class="Comment">alloc id</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">length</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> length<span class="Delimiter">);</span> <span id="L147" class="LineNr">147 </span><span class="Delimiter">}</span> @@ -213,7 +216,7 @@ if ('onhashchange' in window) { <span id="L149" class="LineNr">149 </span>string <a href='038new_text.cc.html#L149'>read_mu_characters</a><span class="Delimiter">(</span><span class="Normal">int</span> start<span class="Delimiter">,</span> <span class="Normal">int</span> length<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L150" class="LineNr">150 </span> ostringstream tmp<span class="Delimiter">;</span> <span id="L151" class="LineNr">151 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> curr = start<span class="Delimiter">;</span> curr < start+length<span class="Delimiter">;</span> ++curr<span class="Delimiter">)</span> -<span id="L152" class="LineNr">152 </span> tmp << to_unicode<span class="Delimiter">(</span><span class="Normal">static_cast</span><<span class="Normal">uint32_t</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)));</span> +<span id="L152" class="LineNr">152 </span> tmp << to_unicode<span class="Delimiter">(</span><span class="Normal">static_cast</span><<span class="Normal">uint32_t</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr<span class="Delimiter">)));</span> <span id="L153" class="LineNr">153 </span> <span class="Identifier">return</span> tmp<span class="Delimiter">.</span>str<span class="Delimiter">();</span> <span id="L154" class="LineNr">154 </span><span class="Delimiter">}</span> <span id="L155" class="LineNr">155 </span> @@ -224,14 +227,14 @@ if ('onhashchange' in window) { <span id="L160" class="LineNr">160 </span><span class="Delimiter">:(scenario assert_literal)</span> <span id="L161" class="LineNr">161 </span><span class="Special">% Hide_errors = true; // '%' lines insert arbitrary C code into tests before calling 'run' with the lines below. Must be immediately after :(scenario) line.</span> <span id="L162" class="LineNr">162 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L163" class="LineNr">163 </span> assert <span class="Constant">0</span><span class="Delimiter">,</span> [<span class="Normal">this</span> is an assert in Mu] +<span id="L163" class="LineNr">163 </span> assert <span class="Constant">0</span><span class="Delimiter">,</span> [<span class="Normal">this</span> is an assert in <span class="Special">Mu</span>] <span id="L164" class="LineNr">164 </span>] <span id="L165" class="LineNr">165 </span><span class="traceContains">+error: this is an assert in Mu</span> <span id="L166" class="LineNr">166 </span> <span id="L167" class="LineNr">167 </span><span class="Delimiter">:(scenario assert)</span> <span id="L168" class="LineNr">168 </span><span class="Special">% Hide_errors = true; // '%' lines insert arbitrary C code into tests before calling 'run' with the lines below. Must be immediately after :(scenario) line.</span> <span id="L169" class="LineNr">169 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ -<span id="L170" class="LineNr">170 </span> <span class="Constant">1</span>:text<span class="Special"> <- </span><span class="Normal">new</span> [<span class="Normal">this</span> is an assert in Mu] +<span id="L170" class="LineNr">170 </span> <span class="Constant">1</span>:text<span class="Special"> <- </span><span class="Normal">new</span> [<span class="Normal">this</span> is an assert in <span class="Special">Mu</span>] <span id="L171" class="LineNr">171 </span> assert <span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">1</span>:text <span id="L172" class="LineNr">172 </span>] <span id="L173" class="LineNr">173 </span><span class="traceContains">+error: this is an assert in Mu</span> @@ -239,19 +242,19 @@ if ('onhashchange' in window) { <span id="L175" class="LineNr">175 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L176" class="LineNr">176 </span>ASSERT<span class="Delimiter">,</span> <span id="L177" class="LineNr">177 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L178" class="LineNr">178 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"assert"</span><span class="Delimiter">,</span> ASSERT<span class="Delimiter">);</span> +<span id="L178" class="LineNr">178 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"assert"</span><span class="Delimiter">,</span> ASSERT<span class="Delimiter">);</span> <span id="L179" class="LineNr">179 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L180" class="LineNr">180 </span><span class="Normal">case</span> ASSERT: <span class="Delimiter">{</span> <span id="L181" class="LineNr">181 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L182" class="LineNr">182 </span> <a href='003trace.cc.html#L196'>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">"'assert' takes exactly two ingredients rather than '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L182" class="LineNr">182 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'assert' takes exactly two ingredients rather than '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L183" class="LineNr">183 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L184" class="LineNr">184 </span> <span class="Delimiter">}</span> <span id="L185" class="LineNr">185 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_address<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> && !is_mu_scalar<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="L186" class="LineNr">186 </span> <a href='003trace.cc.html#L196'>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">"'assert' requires a scalar or <a href='043space.cc.html#L101'>address</a> for its first ingredient, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L186" class="LineNr">186 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'assert' requires a scalar or <a href='043space.cc.html#L101'>address</a> for its first ingredient, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L187" class="LineNr">187 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L188" class="LineNr">188 </span> <span class="Delimiter">}</span> <span id="L189" class="LineNr">189 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal_text<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> && !is_mu_text<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="L190" class="LineNr">190 </span> <a href='003trace.cc.html#L196'>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">"'assert' requires a text as its second ingredient, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L190" class="LineNr">190 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'assert' requires a text as its second ingredient, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L191" class="LineNr">191 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L192" class="LineNr">192 </span> <span class="Delimiter">}</span> <span id="L193" class="LineNr">193 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -263,7 +266,7 @@ if ('onhashchange' in window) { <span id="L199" class="LineNr">199 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L200" class="LineNr">200 </span> <span class="Normal">else</span> <span id="L201" class="LineNr">201 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='038new_text.cc.html#L142'>read_mu_text</a><span class="Delimiter">(</span>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="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L202" class="LineNr">202 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> exit<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L202" class="LineNr">202 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> exit<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L203" class="LineNr">203 </span> <span class="Delimiter">}</span> <span id="L204" class="LineNr">204 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L205" class="LineNr">205 </span><span class="Delimiter">}</span> @@ -273,7 +276,7 @@ if ('onhashchange' in window) { <span id="L209" class="LineNr">209 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L210" class="LineNr">210 </span>_READ<span class="Delimiter">,</span> <span id="L211" class="LineNr">211 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L212" class="LineNr">212 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$read"</span><span class="Delimiter">,</span> _READ<span class="Delimiter">);</span> +<span id="L212" class="LineNr">212 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$read"</span><span class="Delimiter">,</span> _READ<span class="Delimiter">);</span> <span id="L213" class="LineNr">213 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L214" class="LineNr">214 </span><span class="Normal">case</span> _READ: <span class="Delimiter">{</span> <span id="L215" class="LineNr">215 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> diff --git a/html/040brace.cc.html b/html/040brace.cc.html index 79eb6f63..2b5062ae 100644 --- a/html/040brace.cc.html +++ b/html/040brace.cc.html @@ -11,20 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.cSpecial { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -59,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/040brace.cc'>https://github.com/akkartik/mu/blob/master/040brace.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Structured programming</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//:</span> @@ -94,18 +96,18 @@ if ('onhashchange' in window) { <span id="L32" class="LineNr"> 32 </span><span class="traceContains">+transform: copy ...</span> <span id="L33" class="LineNr"> 33 </span> <span id="L34" class="LineNr"> 34 </span><span class="Delimiter">:(before "End Instruction Modifying Transforms")</span> -<span id="L35" class="LineNr"> 35 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='040brace.cc.html#L38'>transform_braces</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L35" class="LineNr"> 35 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='040brace.cc.html#L38'>transform_braces</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L36" class="LineNr"> 36 </span> <span id="L37" class="LineNr"> 37 </span><span class="Delimiter">:(code)</span> <span id="L38" class="LineNr"> 38 </span><span class="Normal">void</span> <a href='040brace.cc.html#L38'>transform_braces</a><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="L39" class="LineNr"> 39 </span> <span class="Normal">const</span> <span class="Normal">bool</span> OPEN =<span class="Constant"> false</span><span class="Delimiter">,</span> CLOSE =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L40" class="LineNr"> 40 </span> <span class="Comment">// use signed integer for step index because we'll be doing arithmetic on it</span> <span id="L41" class="LineNr"> 41 </span> list<pair<<span class="Normal">bool</span><span class="Comment">/*</span><span class="Comment">OPEN/CLOSE</span><span class="Comment">*/</span><span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">step</span><span class="Comment">*/</span><span class="Normal">int</span>> > braces<span class="Delimiter">;</span> -<span id="L42" class="LineNr"> 42 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- <a href='012transform.cc.html#L99'>transform</a> braces for <a href='010vm.cc.html#L19'>recipe</a> "</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L43" class="LineNr"> 43 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L44" class="LineNr"> 44 </span> <span class="Normal">const</span> instruction& inst = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> +<span id="L42" class="LineNr"> 42 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- <a href='012transform.cc.html#L99'>transform</a> braces for <a href='010vm.cc.html#L19'>recipe</a> "</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L43" class="LineNr"> 43 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L44" class="LineNr"> 44 </span> <span class="Normal">const</span> instruction& inst = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> <span id="L45" class="LineNr"> 45 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>label == <span class="Constant">"{"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L46" class="LineNr"> 46 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <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">"push (open, "</span> << index << <span class="Constant">")"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L46" class="LineNr"> 46 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"push (open, "</span> << index << <span class="Constant">")"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L47" class="LineNr"> 47 </span> braces<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>pair<<span class="Normal">bool</span><span class="Delimiter">,</span><span class="Normal">int</span>><span class="Delimiter">(</span>OPEN<span class="Delimiter">,</span> index<span class="Delimiter">));</span> <span id="L48" class="LineNr"> 48 </span> <span class="Delimiter">}</span> <span id="L49" class="LineNr"> 49 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>label == <span class="Constant">"}"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -114,15 +116,15 @@ if ('onhashchange' in window) { <span id="L52" class="LineNr"> 52 </span> <span class="Delimiter">}</span> <span id="L53" class="LineNr"> 53 </span> <span class="Delimiter">}</span> <span id="L54" class="LineNr"> 54 </span> stack<<span class="Comment">/*</span><span class="Comment">step</span><span class="Comment">*/</span><span class="Normal">int</span>> open_braces<span class="Delimiter">;</span> -<span id="L55" class="LineNr"> 55 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L56" class="LineNr"> 56 </span> instruction& inst = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> +<span id="L55" class="LineNr"> 55 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L56" class="LineNr"> 56 </span> instruction& inst = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> <span id="L57" class="LineNr"> 57 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>label == <span class="Constant">"{"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L58" class="LineNr"> 58 </span> open_braces<span class="Delimiter">.</span>push<span class="Delimiter">(</span>index<span class="Delimiter">);</span> <span id="L59" class="LineNr"> 59 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L60" class="LineNr"> 60 </span> <span class="Delimiter">}</span> <span id="L61" class="LineNr"> 61 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>label == <span class="Constant">"}"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L62" class="LineNr"> 62 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>open_braces<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L63" class="LineNr"> 63 </span> <a href='003trace.cc.html#L196'>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">"unbalanced '}'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L63" class="LineNr"> 63 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"unbalanced '}'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L64" class="LineNr"> 64 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L65" class="LineNr"> 65 </span> <span class="Delimiter">}</span> <span id="L66" class="LineNr"> 66 </span> open_braces<span class="Delimiter">.</span>pop<span class="Delimiter">();</span> @@ -141,7 +143,7 @@ if ('onhashchange' in window) { <span id="L79" class="LineNr"> 79 </span> <span class="Comment">// check for errors</span> <span id="L80" class="LineNr"> 80 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">"-if"</span><span class="Delimiter">)</span> != string::npos || inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">"-unless"</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L81" class="LineNr"> 81 </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="L82" class="LineNr"> 82 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">"' expects 1 or 2 ingredients, but got none</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L82" class="LineNr"> 82 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">"' expects 1 or 2 ingredients, but got none\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L83" class="LineNr"> 83 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L84" class="LineNr"> 84 </span> <span class="Delimiter">}</span> <span id="L85" class="LineNr"> 85 </span> <span class="Delimiter">}</span> @@ -163,14 +165,14 @@ if ('onhashchange' in window) { <span id="L101" class="LineNr">101 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">"-if"</span><span class="Delimiter">)</span> != string::npos || inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">"-unless"</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L102" class="LineNr">102 </span> <span class="Comment">// conditional branches check arg 1</span> <span id="L103" class="LineNr">103 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> > <span class="Constant">1</span> && is_literal<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="L104" class="LineNr">104 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">' '</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>name << <span class="Constant">":offset</span><span class="Constant">" << end();</span> +<span id="L104" class="LineNr">104 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">' '</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>name << <span class="Constant">":offset"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L105" class="LineNr">105 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L106" class="LineNr">106 </span> <span class="Delimiter">}</span> <span id="L107" class="LineNr">107 </span> <span class="Delimiter">}</span> <span id="L108" class="LineNr">108 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L109" class="LineNr">109 </span> <span class="Comment">// unconditional branches check arg 0</span> <span id="L110" class="LineNr">110 </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> && is_literal<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="L111" class="LineNr">111 </span> <a href='003trace.cc.html#L189'>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">"jump "</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>name << <span class="Constant">":offset</span><span class="Constant">" << end();</span> +<span id="L111" class="LineNr">111 </span> <a href='003trace.cc.html#L189'>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">"jump "</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>name << <span class="Constant">":offset"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L112" class="LineNr">112 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L113" class="LineNr">113 </span> <span class="Delimiter">}</span> <span id="L114" class="LineNr">114 </span> <span class="Delimiter">}</span> @@ -178,7 +180,7 @@ if ('onhashchange' in window) { <span id="L116" class="LineNr">116 </span> reagent target<span class="Delimiter">(</span><span class="Normal">new</span> type_tree<span class="Delimiter">(</span><span class="Constant">"offset"</span><span class="Delimiter">));</span> <span id="L117" class="LineNr">117 </span> target<span class="Delimiter">.</span><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L118" class="LineNr">118 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>open_braces<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> -<span id="L119" class="LineNr">119 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << old_name << <span class="Constant">"' needs a '{' before</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L119" class="LineNr">119 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << old_name << <span class="Constant">"' needs a '{' before\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L120" class="LineNr">120 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>old_name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">"loop"</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span id="L121" class="LineNr">121 </span> target<span class="Delimiter">.</span><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span>open_braces<span class="Delimiter">.</span>top<span class="Delimiter">()</span>-index<span class="Delimiter">);</span> <span id="L122" class="LineNr">122 </span> <span class="Normal">else</span> <span class="Comment">// break instruction</span> @@ -186,9 +188,9 @@ if ('onhashchange' in window) { <span id="L124" class="LineNr">124 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>target<span class="Delimiter">);</span> <span id="L125" class="LineNr">125 </span> <span class="Comment">// log computed target</span> <span id="L126" class="LineNr">126 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name == <span class="Constant">"jump"</span><span class="Delimiter">)</span> -<span id="L127" class="LineNr">127 </span> <a href='003trace.cc.html#L189'>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">"jump "</span> << no_scientific<span class="Delimiter">(</span>target<span class="Delimiter">.</span>value<span class="Delimiter">)</span> << <span class="Constant">":offset</span><span class="Constant">" << end();</span> +<span id="L127" class="LineNr">127 </span> <a href='003trace.cc.html#L189'>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">"jump "</span> << no_scientific<span class="Delimiter">(</span>target<span class="Delimiter">.</span>value<span class="Delimiter">)</span> << <span class="Constant">":offset"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L128" class="LineNr">128 </span> <span class="Normal">else</span> -<span id="L129" class="LineNr">129 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">' '</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>name << <span class="Constant">", "</span> << no_scientific<span class="Delimiter">(</span>target<span class="Delimiter">.</span>value<span class="Delimiter">)</span> << <span class="Constant">":offset</span><span class="Constant">" << end();</span> +<span id="L129" class="LineNr">129 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">' '</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>name << <span class="Constant">", "</span> << no_scientific<span class="Delimiter">(</span>target<span class="Delimiter">.</span>value<span class="Delimiter">)</span> << <span class="Constant">":offset"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L130" class="LineNr">130 </span> <span class="Delimiter">}</span> <span id="L131" class="LineNr">131 </span><span class="Delimiter">}</span> <span id="L132" class="LineNr">132 </span> @@ -201,8 +203,8 @@ if ('onhashchange' in window) { <span id="L139" class="LineNr">139 </span> stacksize += <span class="Delimiter">(</span>p<span class="Delimiter">-></span>first ? <span class="Constant">1</span> : -<span class="Constant">1</span><span class="Delimiter">);</span> <span id="L140" class="LineNr">140 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>stacksize == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span> p<span class="Delimiter">-></span>second<span class="Delimiter">;</span> <span id="L141" class="LineNr">141 </span> <span class="Delimiter">}</span> -<span id="L142" class="LineNr">142 </span> <a href='003trace.cc.html#L196'>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">"unbalanced '{'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L143" class="LineNr">143 </span> <span class="Identifier">return</span> <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> <span class="Comment">// exit current routine</span> +<span id="L142" class="LineNr">142 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"unbalanced '{'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L143" class="LineNr">143 </span> <span class="Identifier">return</span> <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> <span class="Comment">// exit current routine</span> <span id="L144" class="LineNr">144 </span><span class="Delimiter">}</span> <span id="L145" class="LineNr">145 </span> <span id="L146" class="LineNr">146 </span><span class="Delimiter">:(scenario loop)</span> @@ -458,7 +460,7 @@ if ('onhashchange' in window) { <span id="L396" class="LineNr">396 </span> curr<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L397" class="LineNr">397 </span> <span class="Delimiter">}</span> <span id="L398" class="LineNr">398 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> -<span id="L399" class="LineNr">399 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'"</span> << curr<span class="Delimiter">.</span>name << <span class="Constant">"' never yields any products</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L399" class="LineNr">399 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'"</span> << curr<span class="Delimiter">.</span>name << <span class="Constant">"' never yields any products\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L400" class="LineNr">400 </span> <span class="Delimiter">}</span> <span id="L401" class="LineNr">401 </span><span class="Delimiter">}</span> <span id="L402" class="LineNr">402 </span><span class="Comment">// rewrite 'return-unless a, b, c, ...' to</span> @@ -474,7 +476,7 @@ if ('onhashchange' in window) { <span id="L412" class="LineNr">412 </span> curr<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L413" class="LineNr">413 </span> <span class="Delimiter">}</span> <span id="L414" class="LineNr">414 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> -<span id="L415" class="LineNr">415 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'"</span> << curr<span class="Delimiter">.</span>name << <span class="Constant">"' never yields any products</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L415" class="LineNr">415 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'"</span> << curr<span class="Delimiter">.</span>name << <span class="Constant">"' never yields any products\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L416" class="LineNr">416 </span> <span class="Delimiter">}</span> <span id="L417" class="LineNr">417 </span><span class="Delimiter">}</span> <span id="L418" class="LineNr">418 </span> @@ -491,14 +493,14 @@ if ('onhashchange' in window) { <span id="L429" class="LineNr">429 </span> <span id="L430" class="LineNr">430 </span> <span class="Comment">// <break command> <condition></span> <span id="L431" class="LineNr">431 </span> <a href='010vm.cc.html#L33'>instruction</a> break_inst<span class="Delimiter">;</span> -<span id="L432" class="LineNr">432 </span> break_inst<span class="Delimiter">.</span>operation = get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> break_command<span class="Delimiter">);</span> +<span id="L432" class="LineNr">432 </span> break_inst<span class="Delimiter">.</span>operation = get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> break_command<span class="Delimiter">);</span> <span id="L433" class="LineNr">433 </span> break_inst<span class="Delimiter">.</span>name = break_command<span class="Delimiter">;</span> <span id="L434" class="LineNr">434 </span> break_inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>condition<span class="Delimiter">);</span> <span id="L435" class="LineNr">435 </span> out<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>break_inst<span class="Delimiter">);</span> <span id="L436" class="LineNr">436 </span> <span id="L437" class="LineNr">437 </span> <span class="Comment">// return <return ingredients></span> <span id="L438" class="LineNr">438 </span> <a href='010vm.cc.html#L33'>instruction</a> return_inst<span class="Delimiter">;</span> -<span id="L439" class="LineNr">439 </span> return_inst<span class="Delimiter">.</span>operation = get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"return"</span><span class="Delimiter">);</span> +<span id="L439" class="LineNr">439 </span> return_inst<span class="Delimiter">.</span>operation = get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"return"</span><span class="Delimiter">);</span> <span id="L440" class="LineNr">440 </span> return_inst<span class="Delimiter">.</span>name = <span class="Constant">"return"</span><span class="Delimiter">;</span> <span id="L441" class="LineNr">441 </span> return_inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>swap<span class="Delimiter">(</span>return_ingredients<span class="Delimiter">);</span> <span id="L442" class="LineNr">442 </span> return_inst<span class="Delimiter">.</span>original_string = inst<span class="Delimiter">.</span>original_string<span class="Delimiter">;</span> @@ -521,12 +523,12 @@ if ('onhashchange' in window) { <span id="L459" class="LineNr">459 </span>LOOP_IF<span class="Delimiter">,</span> <span id="L460" class="LineNr">460 </span>LOOP_UNLESS<span class="Delimiter">,</span> <span id="L461" class="LineNr">461 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L462" class="LineNr">462 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"break"</span><span class="Delimiter">,</span> BREAK<span class="Delimiter">);</span> -<span id="L463" class="LineNr">463 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"break-if"</span><span class="Delimiter">,</span> BREAK_IF<span class="Delimiter">);</span> -<span id="L464" class="LineNr">464 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"break-unless"</span><span class="Delimiter">,</span> BREAK_UNLESS<span class="Delimiter">);</span> -<span id="L465" class="LineNr">465 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"loop"</span><span class="Delimiter">,</span> LOOP<span class="Delimiter">);</span> -<span id="L466" class="LineNr">466 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"loop-if"</span><span class="Delimiter">,</span> LOOP_IF<span class="Delimiter">);</span> -<span id="L467" class="LineNr">467 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"loop-unless"</span><span class="Delimiter">,</span> LOOP_UNLESS<span class="Delimiter">);</span> +<span id="L462" class="LineNr">462 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"break"</span><span class="Delimiter">,</span> BREAK<span class="Delimiter">);</span> +<span id="L463" class="LineNr">463 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"break-if"</span><span class="Delimiter">,</span> BREAK_IF<span class="Delimiter">);</span> +<span id="L464" class="LineNr">464 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"break-unless"</span><span class="Delimiter">,</span> BREAK_UNLESS<span class="Delimiter">);</span> +<span id="L465" class="LineNr">465 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"loop"</span><span class="Delimiter">,</span> LOOP<span class="Delimiter">);</span> +<span id="L466" class="LineNr">466 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"loop-if"</span><span class="Delimiter">,</span> LOOP_IF<span class="Delimiter">);</span> +<span id="L467" class="LineNr">467 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"loop-unless"</span><span class="Delimiter">,</span> LOOP_UNLESS<span class="Delimiter">);</span> <span id="L468" class="LineNr">468 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L469" class="LineNr">469 </span><span class="Normal">case</span> BREAK: <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L470" class="LineNr">470 </span><span class="Normal">case</span> BREAK_IF: <span class="Identifier">break</span><span class="Delimiter">;</span> diff --git a/html/041jump_target.cc.html b/html/041jump_target.cc.html index 1984b251..fc0e7f03 100644 --- a/html/041jump_target.cc.html +++ b/html/041jump_target.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .traceAbsent { color: #c00000; } .traceContains { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/041jump_target.cc'>https://github.com/akkartik/mu/blob/master/041jump_target.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Support jumps to a specific label (the 'jump target') in the same recipe.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: Jump targets must be unique and unambiguous within any recipe.</span> @@ -86,40 +89,40 @@ if ('onhashchange' in window) { <span id="L23" class="LineNr"> 23 </span><span class="traceAbsent">-mem: storing 0 in location 1</span> <span id="L24" class="LineNr"> 24 </span> <span id="L25" class="LineNr"> 25 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> -<span id="L26" class="LineNr"> 26 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"label"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L26" class="LineNr"> 26 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"label"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L27" class="LineNr"> 27 </span> <span id="L28" class="LineNr"> 28 </span><span class="Delimiter">:(before "End Instruction Modifying Transforms")</span> -<span id="L29" class="LineNr"> 29 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='041jump_target.cc.html#L32'>transform_labels</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L29" class="LineNr"> 29 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='041jump_target.cc.html#L32'>transform_labels</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L30" class="LineNr"> 30 </span> <span id="L31" class="LineNr"> 31 </span><span class="Delimiter">:(code)</span> <span id="L32" class="LineNr"> 32 </span><span class="Normal">void</span> <a href='041jump_target.cc.html#L32'>transform_labels</a><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="L33" class="LineNr"> 33 </span> map<string<span class="Delimiter">,</span> <span class="Normal">int</span>> offset<span class="Delimiter">;</span> -<span id="L34" class="LineNr"> 34 </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#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L35" class="LineNr"> 35 </span> <span class="Normal">const</span> instruction& inst = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L34" class="LineNr"> 34 </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#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L35" class="LineNr"> 35 </span> <span class="Normal">const</span> instruction& inst = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L36" class="LineNr"> 36 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>is_label<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L37" class="LineNr"> 37 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='041jump_target.cc.html#L11'>is_jump_target</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>label<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L38" class="LineNr"> 38 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>offset<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>label<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L39" class="LineNr"> 39 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>offset<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>label<span class="Delimiter">,</span> i<span class="Delimiter">);</span> <span id="L40" class="LineNr"> 40 </span> <span class="Delimiter">}</span> <span id="L41" class="LineNr"> 41 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> -<span id="L42" class="LineNr"> 42 </span> <a href='003trace.cc.html#L196'>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">"duplicate label '"</span> << inst<span class="Delimiter">.</span>label << <span class="Constant">"'"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L42" class="LineNr"> 42 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"duplicate label '"</span> << inst<span class="Delimiter">.</span>label << <span class="Constant">"'"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L43" class="LineNr"> 43 </span> <span class="Comment">// have all jumps skip some random but noticeable and deterministic amount of code</span> <span id="L44" class="LineNr"> 44 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>offset<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>label<span class="Delimiter">,</span> <span class="Constant">9999</span><span class="Delimiter">);</span> <span id="L45" class="LineNr"> 45 </span> <span class="Delimiter">}</span> <span id="L46" class="LineNr"> 46 </span> <span class="Delimiter">}</span> <span id="L47" class="LineNr"> 47 </span> <span class="Delimiter">}</span> -<span id="L48" class="LineNr"> 48 </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#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L49" class="LineNr"> 49 </span> instruction& inst = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L48" class="LineNr"> 48 </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#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L49" class="LineNr"> 49 </span> instruction& inst = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L50" class="LineNr"> 50 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name == <span class="Constant">"jump"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L51" class="LineNr"> 51 </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="L52" class="LineNr"> 52 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' expects an ingredient but got 0</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L52" class="LineNr"> 52 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' expects an ingredient but got 0\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L53" class="LineNr"> 53 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L54" class="LineNr"> 54 </span> <span class="Delimiter">}</span> <span id="L55" class="LineNr"> 55 </span> <a href='041jump_target.cc.html#L76'>replace_offset</a><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> offset<span class="Delimiter">,</span> i<span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L56" class="LineNr"> 56 </span> <span class="Delimiter">}</span> <span id="L57" class="LineNr"> 57 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name == <span class="Constant">"jump-if"</span> || inst<span class="Delimiter">.</span>name == <span class="Constant">"jump-unless"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L58" class="LineNr"> 58 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L59" class="LineNr"> 59 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' expects 2 ingredients but got "</span> << <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L59" class="LineNr"> 59 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' expects 2 ingredients but got "</span> << <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L60" class="LineNr"> 60 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L61" class="LineNr"> 61 </span> <span class="Delimiter">}</span> <span id="L62" class="LineNr"> 62 </span> <a href='041jump_target.cc.html#L76'>replace_offset</a><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> offset<span class="Delimiter">,</span> i<span class="Delimiter">,</span> r<span class="Delimiter">);</span> @@ -138,19 +141,19 @@ if ('onhashchange' in window) { <span id="L75" class="LineNr"> 75 </span> <span id="L76" class="LineNr"> 76 </span><span class="Normal">void</span> <a href='041jump_target.cc.html#L76'>replace_offset</a><span class="Delimiter">(</span>reagent& x<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">const</span><span class="Comment">*/</span> map<string<span class="Delimiter">,</span> <span class="Normal">int</span>>& offset<span class="Delimiter">,</span> <span class="Normal">const</span> <span class="Normal">int</span> current_offset<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="L77" class="LineNr"> 77 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L78" class="LineNr"> 78 </span> <a href='003trace.cc.html#L196'>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">"jump target must be offset or label but is '"</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#L225'>end</a><span class="Delimiter">();</span> +<span id="L78" class="LineNr"> 78 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"jump target must be offset or label but is '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L79" class="LineNr"> 79 </span> x<span class="Delimiter">.</span><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span class="Comment">// no jump by default</span> <span id="L80" class="LineNr"> 80 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L81" class="LineNr"> 81 </span> <span class="Delimiter">}</span> <span id="L82" class="LineNr"> 82 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>initialized<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L83" class="LineNr"> 83 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_integer<span class="Delimiter">(</span>x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">// non-labels will be handled like other number operands</span> <span id="L84" class="LineNr"> 84 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_jump_target<span class="Delimiter">(</span>x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L85" class="LineNr"> 85 </span> <a href='003trace.cc.html#L196'>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">"can't jump to label '"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L85" class="LineNr"> 85 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"can't jump to label '"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L86" class="LineNr"> 86 </span> x<span class="Delimiter">.</span><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span class="Comment">// no jump by default</span> <span id="L87" class="LineNr"> 87 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L88" class="LineNr"> 88 </span> <span class="Delimiter">}</span> <span id="L89" class="LineNr"> 89 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>offset<span class="Delimiter">,</span> x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L90" class="LineNr"> 90 </span> <a href='003trace.cc.html#L196'>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">"can't find label '"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L90" class="LineNr"> 90 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"can't find label '"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L91" class="LineNr"> 91 </span> x<span class="Delimiter">.</span><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span class="Comment">// no jump by default</span> <span id="L92" class="LineNr"> 92 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L93" class="LineNr"> 93 </span> <span class="Delimiter">}</span> diff --git a/html/042name.cc.html b/html/042name.cc.html index 7e39fa20..66a88b77 100644 --- a/html/042name.cc.html +++ b/html/042name.cc.html @@ -11,22 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.SalientComment { color: #00ffff; } -.LineNr { color: #444444; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } .traceAbsent { color: #c00000; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.cSpecial { color: #008000; } +.Comment { color: #8080ff; } +.SalientComment { color: #00ffff; } .traceContains { color: #008000; } --> </style> @@ -61,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/042name.cc'>https://github.com/akkartik/mu/blob/master/042name.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: A big convenience high-level languages provide is the ability to name memory</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: locations. In Mu, a transform called 'transform_names' provides this</span> @@ -83,27 +85,27 @@ if ('onhashchange' in window) { <span id="L19" class="LineNr"> 19 </span><span class="Comment"># todo: detect conditional defines</span> <span id="L20" class="LineNr"> 20 </span> <span id="L21" class="LineNr"> 21 </span><span class="Delimiter">:(after "End Type Modifying Transforms")</span> -<span id="L22" class="LineNr"> 22 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='042name.cc.html#L37'>transform_names</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L22" class="LineNr"> 22 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='042name.cc.html#L37'>transform_names</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L23" class="LineNr"> 23 </span> <span id="L24" class="LineNr"> 24 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L25" class="LineNr"> 25 </span>map<recipe_ordinal<span class="Delimiter">,</span> map<string<span class="Delimiter">,</span> <span class="Normal">int</span>> > Name<span class="Delimiter">;</span> +<span id="L25" class="LineNr"> 25 </span>map<recipe_ordinal<span class="Delimiter">,</span> map<string<span class="Delimiter">,</span> <span class="Normal">int</span>> > <span class="Special">Name</span><span class="Delimiter">;</span> <span id="L26" class="LineNr"> 26 </span> <span id="L27" class="LineNr"> 27 </span><span class="Comment">//: the Name map is a global, so save it before tests and reset it for every</span> <span id="L28" class="LineNr"> 28 </span><span class="Comment">//: test, just to be safe.</span> <span id="L29" class="LineNr"> 29 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L30" class="LineNr"> 30 </span>map<recipe_ordinal<span class="Delimiter">,</span> map<string<span class="Delimiter">,</span> <span class="Normal">int</span>> > Name_snapshot<span class="Delimiter">;</span> +<span id="L30" class="LineNr"> 30 </span>map<recipe_ordinal<span class="Delimiter">,</span> map<string<span class="Delimiter">,</span> <span class="Normal">int</span>> > <span class="Special">Name_snapshot</span><span class="Delimiter">;</span> <span id="L31" class="LineNr"> 31 </span><span class="Delimiter">:(before "End save_snapshots")</span> -<span id="L32" class="LineNr"> 32 </span>Name_snapshot = Name<span class="Delimiter">;</span> +<span id="L32" class="LineNr"> 32 </span><span class="Special">Name_snapshot</span> = <span class="Special">Name</span><span class="Delimiter">;</span> <span id="L33" class="LineNr"> 33 </span><span class="Delimiter">:(before "End restore_snapshots")</span> -<span id="L34" class="LineNr"> 34 </span>Name = Name_snapshot<span class="Delimiter">;</span> +<span id="L34" class="LineNr"> 34 </span><span class="Special">Name</span> = <span class="Special">Name_snapshot</span><span class="Delimiter">;</span> <span id="L35" class="LineNr"> 35 </span> <span id="L36" class="LineNr"> 36 </span><span class="Delimiter">:(code)</span> <span id="L37" class="LineNr"> 37 </span><span class="Normal">void</span> <a href='042name.cc.html#L37'>transform_names</a><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="L38" class="LineNr"> 38 </span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L38" class="LineNr"> 38 </span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L39" class="LineNr"> 39 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- <a href='012transform.cc.html#L99'>transform</a> names for <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L40" class="LineNr"> 40 </span> <span class="Normal">bool</span> names_used =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L41" class="LineNr"> 41 </span> <span class="Normal">bool</span> numeric_locations_used =<span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L42" class="LineNr"> 42 </span> map<string<span class="Delimiter">,</span> <span class="Normal">int</span>>& names = Name[r]<span class="Delimiter">;</span> +<span id="L42" class="LineNr"> 42 </span> map<string<span class="Delimiter">,</span> <span class="Normal">int</span>>& names = <span class="Special">Name</span>[r]<span class="Delimiter">;</span> <span id="L43" class="LineNr"> 43 </span> <span class="Comment">// record the indices 'used' so far in the map</span> <span id="L44" class="LineNr"> 44 </span> <span class="Normal">int</span>& curr_idx = names[<span class="Constant">""</span>]<span class="Delimiter">;</span> <span id="L45" class="LineNr"> 45 </span> <span class="Comment">// reserve indices 0 and 1 for the chaining slot in a later layer.</span> @@ -121,7 +123,7 @@ if ('onhashchange' in window) { <span id="L57" class="LineNr"> 57 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='042name.cc.html#L164'>is_named_location</a><span class="Delimiter">(</span>ingredient<span class="Delimiter">))</span> names_used =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L58" class="LineNr"> 58 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_integer<span class="Delimiter">(</span>ingredient<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L59" class="LineNr"> 59 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!already_transformed<span class="Delimiter">(</span>ingredient<span class="Delimiter">,</span> names<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L60" class="LineNr"> 60 </span> <a href='003trace.cc.html#L196'>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">"tried to read ingredient '"</span> << ingredient<span class="Delimiter">.</span>name << <span class="Constant">"' in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' but it hasn't been written to yet</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L60" class="LineNr"> 60 </span> <a href='003trace.cc.html#L196'>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">"tried to read ingredient '"</span> << ingredient<span class="Delimiter">.</span>name << <span class="Constant">"' in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' but it hasn't been written to yet\n"</span> << end<span class="Delimiter">();</span> <span id="L61" class="LineNr"> 61 </span> <span class="Comment">// use-before-set Error</span> <span id="L62" class="LineNr"> 62 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L63" class="LineNr"> 63 </span> <span class="Delimiter">}</span> @@ -131,7 +133,7 @@ if ('onhashchange' in window) { <span id="L67" class="LineNr"> 67 </span> <span class="Comment">// Done Placing Ingredient(ingredient, inst, caller)</span> <span id="L68" class="LineNr"> 68 </span> <span class="Delimiter">}</span> <span id="L69" class="LineNr"> 69 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> -<span id="L70" class="LineNr"> 70 </span> <a href='003trace.cc.html#L196'>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">"can't find a place to store '"</span> << ingredient<span class="Delimiter">.</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L70" class="LineNr"> 70 </span> <a href='003trace.cc.html#L196'>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">"can't find a place to store '"</span> << ingredient<span class="Delimiter">.</span>name << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L71" class="LineNr"> 71 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L72" class="LineNr"> 72 </span> <span class="Delimiter">}</span> <span id="L73" class="LineNr"> 73 </span> <span class="Delimiter">}</span> @@ -152,18 +154,18 @@ if ('onhashchange' in window) { <span id="L88" class="LineNr"> 88 </span> <span class="Comment">// Done Placing Product(product, inst, caller)</span> <span id="L89" class="LineNr"> 89 </span> <span class="Delimiter">}</span> <span id="L90" class="LineNr"> 90 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> -<span id="L91" class="LineNr"> 91 </span> <a href='003trace.cc.html#L196'>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">"can't find a place to store '"</span> << product<span class="Delimiter">.</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L91" class="LineNr"> 91 </span> <a href='003trace.cc.html#L196'>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">"can't find a place to store '"</span> << product<span class="Delimiter">.</span>name << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L92" class="LineNr"> 92 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L93" class="LineNr"> 93 </span> <span class="Delimiter">}</span> <span id="L94" class="LineNr"> 94 </span> <span class="Delimiter">}</span> <span id="L95" class="LineNr"> 95 </span> <span class="Delimiter">}</span> <span id="L96" class="LineNr"> 96 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>names_used && numeric_locations_used<span class="Delimiter">)</span> -<span id="L97" class="LineNr"> 97 </span> <a href='003trace.cc.html#L196'>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">"mixing variable names and numeric addresses</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L97" class="LineNr"> 97 </span> <a href='003trace.cc.html#L196'>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">"mixing variable names and numeric addresses\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L98" class="LineNr"> 98 </span><span class="Delimiter">}</span> <span id="L99" class="LineNr"> 99 </span> <span id="L100" class="LineNr">100 </span><span class="Normal">bool</span> <a href='042name.cc.html#L100'>is_disqualified</a><span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">mutable</span><span class="Comment">*/</span> reagent& x<span class="Delimiter">,</span> <span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> <span class="Normal">const</span> string& recipe_name<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L101" class="LineNr">101 </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="L102" class="LineNr">102 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>recipe_name<span class="Delimiter">)</span> << <span class="Constant">"missing type for '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"' in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L102" class="LineNr">102 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>recipe_name<span class="Delimiter">)</span> << <span class="Constant">"missing type for '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"' in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L103" class="LineNr">103 </span> <span class="Comment">// missing-type Error 1</span> <span id="L104" class="LineNr">104 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L105" class="LineNr">105 </span> <span class="Delimiter">}</span> @@ -179,7 +181,7 @@ 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="Normal">int</span> lookup_name<span class="Delimiter">(</span><span class="Normal">const</span> reagent& r<span class="Delimiter">,</span> <span class="Normal">const</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> default_recipe<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L118" class="LineNr">118 </span> <span class="Identifier">return</span> Name[default_recipe][r<span class="Delimiter">.</span>name]<span class="Delimiter">;</span> +<span id="L118" class="LineNr">118 </span> <span class="Identifier">return</span> <span class="Special">Name</span>[default_recipe][r<span class="Delimiter">.</span>name]<span class="Delimiter">;</span> <span id="L119" class="LineNr">119 </span><span class="Delimiter">}</span> <span id="L120" class="LineNr">120 </span> <span id="L121" class="LineNr">121 </span><a href='010vm.cc.html#L125'>type_ordinal</a> <a href='042name.cc.html#L121'>skip_addresses</a><span class="Delimiter">(</span>type_tree* type<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -199,14 +201,14 @@ if ('onhashchange' in window) { <span id="L135" class="LineNr">135 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L136" class="LineNr">136 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type<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="L137" class="LineNr">137 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>left<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="L138" class="LineNr">138 </span> <span class="Identifier">return</span> type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> expected_name<span class="Delimiter">);</span> +<span id="L138" class="LineNr">138 </span> <span class="Identifier">return</span> type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> expected_name<span class="Delimiter">);</span> <span id="L139" class="LineNr">139 </span><span class="Delimiter">}</span> <span id="L140" class="LineNr">140 </span> <span id="L141" class="LineNr">141 </span><span class="Normal">int</span> <a href='042name.cc.html#L141'>find_element_offset</a><span class="Delimiter">(</span><span class="Normal">const</span> <a href='010vm.cc.html#L125'>type_ordinal</a> t<span class="Delimiter">,</span> <span class="Normal">const</span> string& name<span class="Delimiter">,</span> <span class="Normal">const</span> string& recipe_name<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L142" class="LineNr">142 </span> <span class="Normal">const</span> type_info& container = get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> t<span class="Delimiter">);</span> +<span id="L142" class="LineNr">142 </span> <span class="Normal">const</span> type_info& container = get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> t<span class="Delimiter">);</span> <span id="L143" class="LineNr">143 </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#L141'>SIZE</a><span class="Delimiter">(</span>container<span class="Delimiter">.</span>elements<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L144" class="LineNr">144 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>container<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name == name<span class="Delimiter">)</span> <span class="Identifier">return</span> i<span class="Delimiter">;</span> -<span id="L145" class="LineNr">145 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>recipe_name<span class="Delimiter">)</span> << <span class="Constant">"unknown element '"</span> << name << <span class="Constant">"' in container '"</span> << get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> t<span class="Delimiter">).</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L145" class="LineNr">145 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>recipe_name<span class="Delimiter">)</span> << <span class="Constant">"unknown element '"</span> << name << <span class="Constant">"' in container '"</span> << get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> t<span class="Delimiter">).</span>name << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L146" class="LineNr">146 </span> <span class="Identifier">return</span> -<span class="Constant">1</span><span class="Delimiter">;</span> <span id="L147" class="LineNr">147 </span><span class="Delimiter">}</span> <span id="L148" class="LineNr">148 </span><span class="Normal">int</span> <a href='042name.cc.html#L148'>find_element_location</a><span class="Delimiter">(</span><span class="Normal">int</span> base_address<span class="Delimiter">,</span> <span class="Normal">const</span> string& name<span class="Delimiter">,</span> <span class="Normal">const</span> type_tree* type<span class="Delimiter">,</span> <span class="Normal">const</span> string& recipe_name<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -316,7 +318,7 @@ if ('onhashchange' in window) { <span id="L252" class="LineNr">252 </span><span class="Delimiter">:(before "End update GET offset_value in Check")</span> <span id="L253" class="LineNr">253 </span><span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L254" class="LineNr">254 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!offset<span class="Delimiter">.</span>initialized<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L255" class="LineNr">255 </span> <a href='003trace.cc.html#L196'>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">"uninitialized offset '"</span> << offset<span class="Delimiter">.</span>name << <span class="Constant">"' in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L255" class="LineNr">255 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"uninitialized offset '"</span> << offset<span class="Delimiter">.</span>name << <span class="Constant">"' in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L256" class="LineNr">256 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L257" class="LineNr">257 </span> <span class="Delimiter">}</span> <span id="L258" class="LineNr">258 </span> offset_value = offset<span class="Delimiter">.</span>value<span class="Delimiter">;</span> @@ -344,9 +346,9 @@ if ('onhashchange' in window) { <span id="L280" class="LineNr">280 </span> <span class="Normal">if</span> <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>name<span class="Delimiter">.</span>find_first_not_of<span class="Delimiter">(</span><span class="Constant">"0123456789"</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L281" class="LineNr">281 </span> <span class="Comment">// since first non-address in base type must be a container, we don't have to canonize</span> <span id="L282" class="LineNr">282 </span> <a href='010vm.cc.html#L125'>type_ordinal</a> base_type = <a href='042name.cc.html#L121'>skip_addresses</a><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>type<span class="Delimiter">);</span> -<span id="L283" class="LineNr">283 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// otherwise we'll raise an error elsewhere</span> -<span id="L284" class="LineNr">284 </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><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span><a href='042name.cc.html#L141'>find_element_offset</a><span class="Delimiter">(</span>base_type<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>name<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 id="L285" class="LineNr">285 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"name"</span><span class="Delimiter">)</span> << <span class="Constant">"element "</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>name << <span class="Constant">" of type "</span> << get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">).</span>name << <span class="Constant">" is at offset "</span> << no_scientific<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>value<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L283" class="LineNr">283 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// otherwise we'll raise an error elsewhere</span> +<span id="L284" class="LineNr">284 </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><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span><a href='042name.cc.html#L141'>find_element_offset</a><span class="Delimiter">(</span>base_type<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>name<span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">));</span> +<span id="L285" class="LineNr">285 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"name"</span><span class="Delimiter">)</span> << <span class="Constant">"element "</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>name << <span class="Constant">" of type "</span> << get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">).</span>name << <span class="Constant">" is at offset "</span> << no_scientific<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>value<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L286" class="LineNr">286 </span> <span class="Delimiter">}</span> <span id="L287" class="LineNr">287 </span> <span class="Delimiter">}</span> <span id="L288" class="LineNr">288 </span><span class="Delimiter">}</span> @@ -385,16 +387,16 @@ if ('onhashchange' in window) { <span id="L321" class="LineNr">321 </span><span class="Comment">// convert variant names of exclusive containers</span> <span id="L322" class="LineNr">322 </span><span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name == <span class="Constant">"maybe-convert"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L323" class="LineNr">323 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L324" class="LineNr">324 </span> <a href='003trace.cc.html#L196'>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">"exactly 2 ingredients expected in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L324" class="LineNr">324 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"exactly 2 ingredients expected in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L325" class="LineNr">325 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L326" class="LineNr">326 </span> <span class="Delimiter">}</span> <span id="L327" class="LineNr">327 </span> assert<span class="Delimiter">(</span>is_literal<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 id="L328" class="LineNr">328 </span> <span class="Normal">if</span> <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>name<span class="Delimiter">.</span>find_first_not_of<span class="Delimiter">(</span><span class="Constant">"0123456789"</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L329" class="LineNr">329 </span> <span class="Comment">// since first non-address in base type must be an exclusive container, we don't have to canonize</span> <span id="L330" class="LineNr">330 </span> <a href='010vm.cc.html#L125'>type_ordinal</a> base_type = <a href='042name.cc.html#L121'>skip_addresses</a><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>type<span class="Delimiter">);</span> -<span id="L331" class="LineNr">331 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// otherwise we'll raise an error elsewhere</span> -<span id="L332" class="LineNr">332 </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><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span><a href='042name.cc.html#L141'>find_element_offset</a><span class="Delimiter">(</span>base_type<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>name<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 id="L333" class="LineNr">333 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"name"</span><span class="Delimiter">)</span> << <span class="Constant">"variant "</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>name << <span class="Constant">" of type "</span> << get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">).</span>name << <span class="Constant">" has tag "</span> << no_scientific<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>value<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L331" class="LineNr">331 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Comment">// otherwise we'll raise an error elsewhere</span> +<span id="L332" class="LineNr">332 </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><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span><a href='042name.cc.html#L141'>find_element_offset</a><span class="Delimiter">(</span>base_type<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>name<span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">));</span> +<span id="L333" class="LineNr">333 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"name"</span><span class="Delimiter">)</span> << <span class="Constant">"variant "</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>name << <span class="Constant">" of type "</span> << get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">).</span>name << <span class="Constant">" has tag "</span> << no_scientific<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>value<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L334" class="LineNr">334 </span> <span class="Delimiter">}</span> <span id="L335" class="LineNr">335 </span> <span class="Delimiter">}</span> <span id="L336" class="LineNr">336 </span><span class="Delimiter">}</span> diff --git a/html/043space.cc.html b/html/043space.cc.html index 357016f5..6cb70219 100644 --- a/html/043space.cc.html +++ b/html/043space.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .SalientComment { color: #00ffff; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .traceAbsent { color: #c00000; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } .traceContains { color: #008000; } --> @@ -61,6 +63,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/043space.cc'>https://github.com/akkartik/mu/blob/master/043space.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Spaces help isolate recipes from each other. You can create them at will,</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: and all addresses in arguments are implicitly based on the 'default-space'</span> @@ -78,7 +81,7 @@ if ('onhashchange' in window) { <span id="L14" class="LineNr"> 14 </span> <span id="L15" class="LineNr"> 15 </span><span class="Comment">//: Under the hood, a space is an array of locations in memory.</span> <span id="L16" class="LineNr"> 16 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> -<span id="L17" class="LineNr"> 17 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> <span class="Constant">"space"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"address:array:location"</span><span class="Delimiter">));</span> +<span id="L17" class="LineNr"> 17 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> <span class="Constant">"space"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"address:array:location"</span><span class="Delimiter">));</span> <span id="L18" class="LineNr"> 18 </span> <span id="L19" class="LineNr"> 19 </span><span class="Delimiter">:(scenario set_default_space)</span> <span id="L20" class="LineNr"> 20 </span><span class="muRecipe">def</span> <a href='000organization.cc.html#L113'>main</a> [ @@ -151,7 +154,7 @@ if ('onhashchange' in window) { <span id="L87" class="LineNr"> 87 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='042name.cc.html#L179'>is_raw</a><span class="Delimiter">(</span>x<span class="Delimiter">)</span> || is_dummy<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L88" class="LineNr"> 88 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>name == <span class="Constant">"default-space"</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L89" class="LineNr"> 89 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>initialized<span class="Delimiter">)</span> -<span id="L90" class="LineNr"> 90 </span> <a href='003trace.cc.html#L196'>raise</a> << to_original_string<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">": reagent not initialized: '"</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#L225'>end</a><span class="Delimiter">();</span> +<span id="L90" class="LineNr"> 90 </span> <a href='003trace.cc.html#L196'>raise</a> << to_original_string<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">": reagent not initialized: '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L91" class="LineNr"> 91 </span> x<span class="Delimiter">.</span><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span><a href='043space.cc.html#L101'>address</a><span class="Delimiter">(</span>x<span class="Delimiter">.</span>value<span class="Delimiter">,</span> space_base<span class="Delimiter">(</span>x<span class="Delimiter">)));</span> <span id="L92" class="LineNr"> 92 </span> x<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>pair<string<span class="Delimiter">,</span> string_tree*><span class="Delimiter">(</span><span class="Constant">"raw"</span><span class="Delimiter">,</span> <span class="Constant">NULL</span><span class="Delimiter">));</span> <span id="L93" class="LineNr"> 93 </span> assert<span class="Delimiter">(</span><a href='042name.cc.html#L179'>is_raw</a><span class="Delimiter">(</span>x<span class="Delimiter">));</span> @@ -165,7 +168,7 @@ if ('onhashchange' in window) { <span id="L101" class="LineNr">101 </span><span class="Normal">int</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">(</span><span class="Normal">int</span> offset<span class="Delimiter">,</span> <span class="Normal">int</span> base<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L102" class="LineNr">102 </span> assert<span class="Delimiter">(</span>offset >= <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L103" class="LineNr">103 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span> offset<span class="Delimiter">;</span> <span class="Comment">// raw</span> -<span id="L104" class="LineNr">104 </span> <span class="Normal">int</span> size = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> base<span class="Delimiter">);</span> +<span id="L104" class="LineNr">104 </span> <span class="Normal">int</span> size = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> base<span class="Delimiter">);</span> <span id="L105" class="LineNr">105 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset >= size<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L106" class="LineNr">106 </span> <span class="Comment">// todo: test</span> <span id="L107" class="LineNr">107 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">()</span> << <span class="Constant">": location "</span> << offset << <span class="Constant">" is out of bounds "</span> << size << <span class="Constant">" at "</span> << base << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> @@ -183,7 +186,7 @@ if ('onhashchange' in window) { <span id="L119" class="LineNr">119 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_space<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span id="L120" class="LineNr">120 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"'default-space' should be of type <a href='043space.cc.html#L101'>address</a>:array:location, but is "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L121" class="LineNr">121 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>data<span class="Delimiter">)</span> != <span class="Constant">2</span><span class="Delimiter">)</span> -<span id="L122" class="LineNr">122 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"'default-space' getting data from non-address</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L122" class="LineNr">122 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"'default-space' getting data from non-address\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L123" class="LineNr">123 </span> <a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">().</span>default_space = data<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L124" class="LineNr">124 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L125" class="LineNr">125 </span><span class="Delimiter">}</span> @@ -293,45 +296,45 @@ if ('onhashchange' in window) { <span id="L229" class="LineNr">229 </span><span class="Delimiter">:(code)</span> <span id="L230" class="LineNr">230 </span><span class="Normal">void</span> <a href='043space.cc.html#L230'>rewrite_default_space_instruction</a><span class="Delimiter">(</span>instruction& curr<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L231" class="LineNr">231 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!curr<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> -<span id="L232" class="LineNr">232 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>curr<span class="Delimiter">)</span> << <span class="Constant">"' can't take any ingredients</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L232" class="LineNr">232 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>curr<span class="Delimiter">)</span> << <span class="Constant">"' can't take any ingredients\n"</span> << end<span class="Delimiter">();</span> <span id="L233" class="LineNr">233 </span> curr<span class="Delimiter">.</span>name = <span class="Constant">"new"</span><span class="Delimiter">;</span> <span id="L234" class="LineNr">234 </span> <span class="Constant">curr.ingredients.push_back(reagent("location:type</span><span class="Constant">"));</span> <span id="L235" class="LineNr">235 </span> <span class="Constant">curr.ingredients.push_back(reagent("number-of-locals:literal</span><span class="Constant">"));</span> <span id="L236" class="LineNr">236 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!curr<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> -<span id="L237" class="LineNr">237 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"local-scope can't take any results</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L237" class="LineNr">237 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"local-scope can't take any results\n"</span> << end<span class="Delimiter">();</span> <span id="L238" class="LineNr">238 </span> curr<span class="Delimiter">.</span>products<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"default-space:space"</span><span class="Delimiter">));</span> <span id="L239" class="LineNr">239 </span><span class="Delimiter">}</span> <span id="L240" class="LineNr">240 </span><span class="Delimiter">:(after "Begin Preprocess read_memory(x)")</span> <span id="L241" class="LineNr">241 </span><span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>name == <span class="Constant">"number-of-locals"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L242" class="LineNr">242 </span> vector<<span class="Normal">double</span>> result<span class="Delimiter">;</span> -<span id="L243" class="LineNr">243 </span> result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>Name[get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span>][<span class="Constant">""</span>]<span class="Delimiter">);</span> +<span id="L243" class="LineNr">243 </span> result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><span class="Special">Name</span>[get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span>][<span class="Constant">""</span>]<span class="Delimiter">);</span> <span id="L244" class="LineNr">244 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>result<span class="Delimiter">.</span>back<span class="Delimiter">()</span> == <span class="Constant">0</span><span class="Delimiter">)</span> -<span id="L245" class="LineNr">245 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"no space allocated for default-space in <a href='010vm.cc.html#L19'>recipe</a> "</span> << <a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">()</span> << <span class="Constant">"; are you using names?</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L245" class="LineNr">245 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"no space allocated for default-space in <a href='010vm.cc.html#L19'>recipe</a> "</span> << <a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">()</span> << <span class="Constant">"; are you using names?\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L246" class="LineNr">246 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L247" class="LineNr">247 </span><span class="Delimiter">}</span> <span id="L248" class="LineNr">248 </span><span class="Delimiter">:(after "Begin Preprocess write_memory(x, data)")</span> <span id="L249" class="LineNr">249 </span><span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>name == <span class="Constant">"number-of-locals"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L250" class="LineNr">250 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"can't write to special name 'number-of-locals'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L250" class="LineNr">250 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"can't write to special name 'number-of-locals'\n"</span> << end<span class="Delimiter">();</span> <span id="L251" class="LineNr">251 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L252" class="LineNr">252 </span><span class="Delimiter">}</span> <span id="L253" class="LineNr">253 </span> <span id="L254" class="LineNr">254 </span><span class="SalientComment">//:: all recipes must set default-space one way or another</span> <span id="L255" class="LineNr">255 </span> <span id="L256" class="LineNr">256 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L257" class="LineNr">257 </span><span class="Normal">bool</span> Hide_missing_default_space_errors =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L257" class="LineNr">257 </span><span class="Normal">bool</span> <span class="Special">Hide_missing_default_space_errors</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L258" class="LineNr">258 </span><span class="Delimiter">:(before "End Checks")</span> -<span id="L259" class="LineNr">259 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='043space.cc.html#L261'>check_default_space</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L259" class="LineNr">259 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='043space.cc.html#L261'>check_default_space</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L260" class="LineNr">260 </span><span class="Delimiter">:(code)</span> <span id="L261" class="LineNr">261 </span><span class="Normal">void</span> <a href='043space.cc.html#L261'>check_default_space</a><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="L262" class="LineNr">262 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Hide_missing_default_space_errors<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">// skip previous core tests; this is only for Mu code</span> -<span id="L263" class="LineNr">263 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L262" class="LineNr">262 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Hide_missing_default_space_errors</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">// skip previous core tests; this is only for Mu code</span> +<span id="L263" class="LineNr">263 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L264" class="LineNr">264 </span> <span class="Comment">// End check_default_space Special-cases</span> <span id="L265" class="LineNr">265 </span> <span class="Comment">// assume recipes with only numeric addresses know what they're doing (usually tests)</span> <span id="L266" class="LineNr">266 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_non_special_name<span class="Delimiter">(</span>r<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L267" class="LineNr">267 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- check that <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" sets default-space"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L268" class="LineNr">268 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L269" class="LineNr">269 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!starts_by_setting_default_space<span class="Delimiter">(</span>caller<span class="Delimiter">))</span> -<span id="L270" class="LineNr">270 </span> <a href='003trace.cc.html#L196'>raise</a> << caller<span class="Delimiter">.</span>name << <span class="Constant">" does not seem to start with 'local-scope' or 'default-space'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L270" class="LineNr">270 </span> <a href='003trace.cc.html#L196'>raise</a> << caller<span class="Delimiter">.</span>name << <span class="Constant">" does not seem to start with 'local-scope' or 'default-space'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L271" class="LineNr">271 </span><span class="Delimiter">}</span> <span id="L272" class="LineNr">272 </span><span class="Normal">bool</span> <a href='043space.cc.html#L272'>starts_by_setting_default_space</a><span class="Delimiter">(</span><span class="Normal">const</span> recipe& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L273" class="LineNr">273 </span> <span class="Identifier">return</span> !r<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>empty<span class="Delimiter">()</span> @@ -340,15 +343,15 @@ if ('onhashchange' in window) { <span id="L276" class="LineNr">276 </span><span class="Delimiter">}</span> <span id="L277" class="LineNr">277 </span> <span id="L278" class="LineNr">278 </span><span class="Delimiter">:(after "Load Mu Prelude")</span> -<span id="L279" class="LineNr">279 </span>Hide_missing_default_space_errors =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L279" class="LineNr">279 </span><span class="Special">Hide_missing_default_space_errors</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L280" class="LineNr">280 </span><span class="Delimiter">:(after "Test Runs")</span> -<span id="L281" class="LineNr">281 </span>Hide_missing_default_space_errors =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L281" class="LineNr">281 </span><span class="Special">Hide_missing_default_space_errors</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L282" class="LineNr">282 </span><span class="Delimiter">:(after "Running Main")</span> -<span id="L283" class="LineNr">283 </span>Hide_missing_default_space_errors =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L283" class="LineNr">283 </span><span class="Special">Hide_missing_default_space_errors</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L284" class="LineNr">284 </span> <span id="L285" class="LineNr">285 </span><span class="Delimiter">:(code)</span> <span id="L286" class="LineNr">286 </span><span class="Normal">bool</span> <a href='043space.cc.html#L286'>contains_non_special_name</a><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="L287" class="LineNr">287 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<string<span class="Delimiter">,</span> <span class="Normal">int</span>>::iterator p = Name[r]<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Name[r]<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L287" class="LineNr">287 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<string<span class="Delimiter">,</span> <span class="Normal">int</span>>::iterator p = <span class="Special">Name</span>[r]<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Name</span>[r]<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L288" class="LineNr">288 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>p<span class="Delimiter">-></span>first<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L289" class="LineNr">289 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>p<span class="Delimiter">-></span>first<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">"stash_"</span><span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// generated by rewrite_stashes_to_text (cross-layer)</span> <span id="L290" class="LineNr">290 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_special_name<span class="Delimiter">(</span>p<span class="Delimiter">-></span>first<span class="Delimiter">))</span> diff --git a/html/044space_surround.cc.html b/html/044space_surround.cc.html index b07bb0f0..af203016 100644 --- a/html/044space_surround.cc.html +++ b/html/044space_surround.cc.html @@ -11,20 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.cSpecial { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -59,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/044space_surround.cc'>https://github.com/akkartik/mu/blob/master/044space_surround.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: So far you can have global variables by not setting default-space, and</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: local variables by setting default-space. You can isolate variables</span> @@ -111,7 +113,7 @@ if ('onhashchange' in window) { <span id="L49" class="LineNr">49 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='044space_surround.cc.html#L56'>space_index</a> == <span class="Constant">0</span><span class="Delimiter">)</span> <span id="L50" class="LineNr">50 </span> <span class="Identifier">return</span> base<span class="Delimiter">;</span> <span id="L51" class="LineNr">51 </span> <span class="Normal">double</span> chained_space_address = base+<span class="Comment">/*</span><span class="Comment">skip length</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">skip alloc id of chaining slot</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L52" class="LineNr">52 </span> <span class="Normal">double</span> chained_space_base = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> chained_space_address<span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip alloc id of chained space</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L52" class="LineNr">52 </span> <span class="Normal">double</span> chained_space_base = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> chained_space_address<span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip alloc id of chained space</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span id="L53" class="LineNr">53 </span> <span class="Identifier">return</span> space_base<span class="Delimiter">(</span>x<span class="Delimiter">,</span> space_index-<span class="Constant">1</span><span class="Delimiter">,</span> chained_space_base<span class="Delimiter">);</span> <span id="L54" class="LineNr">54 </span><span class="Delimiter">}</span> <span id="L55" class="LineNr">55 </span> @@ -119,7 +121,7 @@ if ('onhashchange' in window) { <span id="L57" class="LineNr">57 </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#L141'>SIZE</a><span class="Delimiter">(</span>x<span class="Delimiter">.</span>properties<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L58" class="LineNr">58 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>first == <span class="Constant">"space"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L59" class="LineNr">59 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>second || x<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>second<span class="Delimiter">-></span>right<span class="Delimiter">)</span> -<span id="L60" class="LineNr">60 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"/space metadata should take exactly one value in '"</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#L225'>end</a><span class="Delimiter">();</span> +<span id="L60" class="LineNr">60 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"/space metadata should take exactly one value in '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L61" class="LineNr">61 </span> <span class="Identifier">return</span> to_integer<span class="Delimiter">(</span>x<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>second<span class="Delimiter">-></span>value<span class="Delimiter">);</span> <span id="L62" class="LineNr">62 </span> <span class="Delimiter">}</span> <span id="L63" class="LineNr">63 </span> <span class="Delimiter">}</span> diff --git a/html/045closure_name.cc.html b/html/045closure_name.cc.html index 6dbc73c8..01ba2125 100644 --- a/html/045closure_name.cc.html +++ b/html/045closure_name.cc.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } .traceContains { color: #008000; } --> @@ -59,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/045closure_name.cc'>https://github.com/akkartik/mu/blob/master/045closure_name.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Writing to a literal (not computed) address of 0 in a recipe chains two</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: spaces together. When a variable has a property of /space:1, it looks up</span> @@ -95,48 +98,48 @@ if ('onhashchange' in window) { <span id="L33" class="LineNr"> 33 </span><span class="Comment">//: surrounding space of each recipe.</span> <span id="L34" class="LineNr"> 34 </span> <span id="L35" class="LineNr"> 35 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L36" class="LineNr"> 36 </span>map<recipe_ordinal<span class="Delimiter">,</span> recipe_ordinal> Surrounding_space<span class="Delimiter">;</span> <span class="Comment">// internal to transform; no need to snapshot</span> +<span id="L36" class="LineNr"> 36 </span>map<recipe_ordinal<span class="Delimiter">,</span> recipe_ordinal> <span class="Special">Surrounding_space</span><span class="Delimiter">;</span> <span class="Comment">// internal to transform; no need to snapshot</span> <span id="L37" class="LineNr"> 37 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L38" class="LineNr"> 38 </span>Surrounding_space<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L38" class="LineNr"> 38 </span><span class="Special">Surrounding_space</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L39" class="LineNr"> 39 </span> <span id="L40" class="LineNr"> 40 </span><span class="Delimiter">:(before "Begin Type Modifying Transforms")</span> -<span id="L41" class="LineNr"> 41 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='045closure_name.cc.html#L44'>collect_surrounding_spaces</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L41" class="LineNr"> 41 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='045closure_name.cc.html#L44'>collect_surrounding_spaces</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L42" class="LineNr"> 42 </span> <span id="L43" class="LineNr"> 43 </span><span class="Delimiter">:(code)</span> <span id="L44" class="LineNr"> 44 </span><span class="Normal">void</span> <a href='045closure_name.cc.html#L44'>collect_surrounding_spaces</a><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="L45" class="LineNr"> 45 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- collect surrounding spaces for <a href='010vm.cc.html#L19'>recipe</a> "</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L46" class="LineNr"> 46 </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#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L47" class="LineNr"> 47 </span> <span class="Normal">const</span> instruction& inst = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L45" class="LineNr"> 45 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- collect surrounding spaces for <a href='010vm.cc.html#L19'>recipe</a> "</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L46" class="LineNr"> 46 </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#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L47" class="LineNr"> 47 </span> <span class="Normal">const</span> instruction& inst = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L48" class="LineNr"> 48 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>is_label<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L49" class="LineNr"> 49 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++j<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L50" class="LineNr"> 50 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_literal<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">)))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L51" class="LineNr"> 51 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">).</span>name != <span class="Constant">"0"</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L52" class="LineNr"> 52 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_space<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L53" class="LineNr"> 53 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"slot 0 should always have type <a href='043space.cc.html#L101'>address</a>:array:location, but is '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">))</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L53" class="LineNr"> 53 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"slot 0 should always have type <a href='043space.cc.html#L101'>address</a>:array:location, but is '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">))</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L54" class="LineNr"> 54 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L55" class="LineNr"> 55 </span> <span class="Delimiter">}</span> <span id="L56" class="LineNr"> 56 </span> string_tree* s = property<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">),</span> <span class="Constant">"names"</span><span class="Delimiter">);</span> <span id="L57" class="LineNr"> 57 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!s<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L58" class="LineNr"> 58 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"slot 0 requires a /names property in <a href='010vm.cc.html#L19'>recipe</a> '"</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L58" class="LineNr"> 58 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"slot 0 requires a /names property in <a href='010vm.cc.html#L19'>recipe</a> '"</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L59" class="LineNr"> 59 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L60" class="LineNr"> 60 </span> <span class="Delimiter">}</span> -<span id="L61" class="LineNr"> 61 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!s<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"slot 0 should have a single value in /names, but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">))</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L61" class="LineNr"> 61 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!s<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"slot 0 should have a single value in /names, but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">))</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L62" class="LineNr"> 62 </span> <span class="Normal">const</span> string& surrounding_recipe_name = s<span class="Delimiter">-></span>value<span class="Delimiter">;</span> <span id="L63" class="LineNr"> 63 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>surrounding_recipe_name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L64" class="LineNr"> 64 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"slot 0 doesn't initialize its /names property in recipe '"</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L64" class="LineNr"> 64 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"slot 0 doesn't initialize its /names property in recipe '"</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L65" class="LineNr"> 65 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L66" class="LineNr"> 66 </span> <span class="Delimiter">}</span> -<span id="L67" class="LineNr"> 67 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Surrounding_space<span class="Delimiter">,</span> r<span class="Delimiter">)</span> -<span id="L68" class="LineNr"> 68 </span> && get<span class="Delimiter">(</span>Surrounding_space<span class="Delimiter">,</span> r<span class="Delimiter">)</span> != get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> surrounding_recipe_name<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L69" class="LineNr"> 69 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"recipe '"</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <span class="Constant">"' can have only one 'surrounding' <a href='010vm.cc.html#L19'>recipe</a> but has '"</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Surrounding_space<span class="Delimiter">,</span> r<span class="Delimiter">)).</span>name << <span class="Constant">"' and '"</span> << surrounding_recipe_name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L67" class="LineNr"> 67 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Surrounding_space</span><span class="Delimiter">,</span> r<span class="Delimiter">)</span> +<span id="L68" class="LineNr"> 68 </span> && get<span class="Delimiter">(</span><span class="Special">Surrounding_space</span><span class="Delimiter">,</span> r<span class="Delimiter">)</span> != get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> surrounding_recipe_name<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L69" class="LineNr"> 69 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"recipe '"</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <span class="Constant">"' can have only one 'surrounding' <a href='010vm.cc.html#L19'>recipe</a> but has '"</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Surrounding_space</span><span class="Delimiter">,</span> r<span class="Delimiter">)).</span>name << <span class="Constant">"' and '"</span> << surrounding_recipe_name << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L70" class="LineNr"> 70 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L71" class="LineNr"> 71 </span> <span class="Delimiter">}</span> -<span id="L72" class="LineNr"> 72 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"name"</span><span class="Delimiter">)</span> << <span class="Constant">"lexically surrounding space for <a href='010vm.cc.html#L19'>recipe</a> "</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <span class="Constant">" comes from "</span> << surrounding_recipe_name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L73" class="LineNr"> 73 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> surrounding_recipe_name<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L74" class="LineNr"> 74 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"can't find recipe providing surrounding space for '"</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <span class="Constant">"'; looking for '"</span> << surrounding_recipe_name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L72" class="LineNr"> 72 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"name"</span><span class="Delimiter">)</span> << <span class="Constant">"lexically surrounding space for <a href='010vm.cc.html#L19'>recipe</a> "</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <span class="Constant">" comes from "</span> << surrounding_recipe_name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L73" class="LineNr"> 73 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> surrounding_recipe_name<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L74" class="LineNr"> 74 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"can't find recipe providing surrounding space for '"</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <span class="Constant">"'; looking for '"</span> << surrounding_recipe_name << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L75" class="LineNr"> 75 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L76" class="LineNr"> 76 </span> <span class="Delimiter">}</span> -<span id="L77" class="LineNr"> 77 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Surrounding_space<span class="Delimiter">,</span> r<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> surrounding_recipe_name<span class="Delimiter">));</span> +<span id="L77" class="LineNr"> 77 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Surrounding_space</span><span class="Delimiter">,</span> r<span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> surrounding_recipe_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="Delimiter">}</span> <span id="L80" class="LineNr"> 80 </span><span class="Delimiter">}</span> @@ -147,11 +150,11 @@ if ('onhashchange' in window) { <span id="L85" class="LineNr"> 85 </span><span class="Delimiter">:(replace{} "int lookup_name(const reagent& r, const <a href='010vm.cc.html#L14'>recipe_ordinal</a> default_recipe)")</span> <span id="L86" class="LineNr"> 86 </span><span class="Normal">int</span> lookup_name<span class="Delimiter">(</span><span class="Normal">const</span> reagent& x<span class="Delimiter">,</span> <span class="Normal">const</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> default_recipe<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L87" class="LineNr"> 87 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_property<span class="Delimiter">(</span>x<span class="Delimiter">,</span> <span class="Constant">"space"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L88" class="LineNr"> 88 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Name[default_recipe]<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"name not found: "</span> << x<span class="Delimiter">.</span>name << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L89" class="LineNr"> 89 </span> <span class="Identifier">return</span> Name[default_recipe][x<span class="Delimiter">.</span>name]<span class="Delimiter">;</span> +<span id="L88" class="LineNr"> 88 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Name</span>[default_recipe]<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"name not found: "</span> << x<span class="Delimiter">.</span>name << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L89" class="LineNr"> 89 </span> <span class="Identifier">return</span> <span class="Special">Name</span>[default_recipe][x<span class="Delimiter">.</span>name]<span class="Delimiter">;</span> <span id="L90" class="LineNr"> 90 </span> <span class="Delimiter">}</span> <span id="L91" class="LineNr"> 91 </span> string_tree* p = property<span class="Delimiter">(</span>x<span class="Delimiter">,</span> <span class="Constant">"space"</span><span class="Delimiter">);</span> -<span id="L92" class="LineNr"> 92 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!p || !p<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"/space property should have exactly one (non-negative integer) value</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L92" class="LineNr"> 92 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!p || !p<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"/space property should have exactly one (non-negative integer) value\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L93" class="LineNr"> 93 </span> <span class="Normal">int</span> n = to_integer<span class="Delimiter">(</span>p<span class="Delimiter">-></span>value<span class="Delimiter">);</span> <span id="L94" class="LineNr"> 94 </span> assert<span class="Delimiter">(</span>n >= <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L95" class="LineNr"> 95 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> surrounding_recipe = <a href='045closure_name.cc.html#L121'>lookup_surrounding_recipe</a><span class="Delimiter">(</span>default_recipe<span class="Delimiter">,</span> n<span class="Delimiter">);</span> @@ -164,30 +167,30 @@ if ('onhashchange' in window) { <span id="L102" class="LineNr">102 </span><span class="Comment">// If the recipe we need to lookup this name in doesn't have names done yet,</span> <span id="L103" class="LineNr">103 </span><span class="Comment">// recursively call transform_names on it.</span> <span id="L104" class="LineNr">104 </span><span class="Normal">int</span> lookup_name<span class="Delimiter">(</span><span class="Normal">const</span> reagent& x<span class="Delimiter">,</span> <span class="Normal">const</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">,</span> set<recipe_ordinal>& done<span class="Delimiter">,</span> vector<recipe_ordinal>& path<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L105" class="LineNr">105 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Name[r]<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span> Name[r][x<span class="Delimiter">.</span>name]<span class="Delimiter">;</span> +<span id="L105" class="LineNr">105 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Name</span>[r]<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span> <span class="Special">Name</span>[r][x<span class="Delimiter">.</span>name]<span class="Delimiter">;</span> <span id="L106" class="LineNr">106 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>done<span class="Delimiter">,</span> r<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L107" class="LineNr">107 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"can't compute address of '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">)</span> << <span class="Constant">"' because</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L107" class="LineNr">107 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"can't compute address of '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">)</span> << <span class="Constant">"' because\n"</span> << end<span class="Delimiter">();</span> <span id="L108" class="LineNr">108 </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#L141'>SIZE</a><span class="Delimiter">(</span>path<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L109" class="LineNr">109 </span> <a href='003trace.cc.html#L196'>raise</a> << path<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i-<span class="Constant">1</span><span class="Delimiter">)</span> << <span class="Constant">" requires computing names of "</span> << path<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L110" class="LineNr">110 </span> <span class="Delimiter">}</span> -<span id="L111" class="LineNr">111 </span> <a href='003trace.cc.html#L196'>raise</a> << path<span class="Delimiter">.</span>at<span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>path<span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">)</span> << <span class="Constant">" requires computing names of "</span> << r << <span class="Constant">"..ad infinitum</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L111" class="LineNr">111 </span> <a href='003trace.cc.html#L196'>raise</a> << path<span class="Delimiter">.</span>at<span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>path<span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">)</span> << <span class="Constant">" requires computing names of "</span> << r << <span class="Constant">"..ad infinitum\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L112" class="LineNr">112 </span> <span class="Identifier">return</span> -<span class="Constant">1</span><span class="Delimiter">;</span> <span id="L113" class="LineNr">113 </span> <span class="Delimiter">}</span> <span id="L114" class="LineNr">114 </span> done<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>r<span class="Delimiter">);</span> <span id="L115" class="LineNr">115 </span> path<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>r<span class="Delimiter">);</span> <span id="L116" class="LineNr">116 </span> <a href='042name.cc.html#L37'>transform_names</a><span class="Delimiter">(</span>r<span class="Delimiter">);</span> <span class="Comment">// Not passing 'done' through. Might this somehow cause an infinite loop?</span> -<span id="L117" class="LineNr">117 </span> assert<span class="Delimiter">(</span>!Name[r]<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L118" class="LineNr">118 </span> <span class="Identifier">return</span> Name[r][x<span class="Delimiter">.</span>name]<span class="Delimiter">;</span> +<span id="L117" class="LineNr">117 </span> assert<span class="Delimiter">(</span>!<span class="Special">Name</span>[r]<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L118" class="LineNr">118 </span> <span class="Identifier">return</span> <span class="Special">Name</span>[r][x<span class="Delimiter">.</span>name]<span class="Delimiter">;</span> <span id="L119" class="LineNr">119 </span><span class="Delimiter">}</span> <span id="L120" class="LineNr">120 </span> <span id="L121" class="LineNr">121 </span><a href='010vm.cc.html#L14'>recipe_ordinal</a> <a href='045closure_name.cc.html#L121'>lookup_surrounding_recipe</a><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="Normal">int</span> n<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L122" class="LineNr">122 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>n == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span> r<span class="Delimiter">;</span> -<span id="L123" class="LineNr">123 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Surrounding_space<span class="Delimiter">,</span> r<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L124" class="LineNr">124 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"don't know surrounding recipe of '"</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L123" class="LineNr">123 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Surrounding_space</span><span class="Delimiter">,</span> r<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L124" class="LineNr">124 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"don't know surrounding recipe of '"</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L125" class="LineNr">125 </span> <span class="Identifier">return</span> -<span class="Constant">1</span><span class="Delimiter">;</span> <span id="L126" class="LineNr">126 </span> <span class="Delimiter">}</span> -<span id="L127" class="LineNr">127 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Surrounding_space<span class="Delimiter">,</span> r<span class="Delimiter">));</span> -<span id="L128" class="LineNr">128 </span> <span class="Identifier">return</span> <a href='045closure_name.cc.html#L121'>lookup_surrounding_recipe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Surrounding_space<span class="Delimiter">,</span> r<span class="Delimiter">),</span> n-<span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L127" class="LineNr">127 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Surrounding_space</span><span class="Delimiter">,</span> r<span class="Delimiter">));</span> +<span id="L128" class="LineNr">128 </span> <span class="Identifier">return</span> <a href='045closure_name.cc.html#L121'>lookup_surrounding_recipe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Surrounding_space</span><span class="Delimiter">,</span> r<span class="Delimiter">),</span> n-<span class="Constant">1</span><span class="Delimiter">);</span> <span id="L129" class="LineNr">129 </span><span class="Delimiter">}</span> <span id="L130" class="LineNr">130 </span> <span id="L131" class="LineNr">131 </span><span class="Comment">//: weaken use-before-set detection just a tad</span> @@ -196,7 +199,7 @@ if ('onhashchange' in window) { <span id="L134" class="LineNr">134 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>has_property<span class="Delimiter">(</span>r<span class="Delimiter">,</span> <span class="Constant">"space"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L135" class="LineNr">135 </span> string_tree* p = property<span class="Delimiter">(</span>r<span class="Delimiter">,</span> <span class="Constant">"space"</span><span class="Delimiter">);</span> <span id="L136" class="LineNr">136 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!p || !p<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L137" class="LineNr">137 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"/space property should have exactly one (non-negative integer) value in '"</span> << r<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L137" class="LineNr">137 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"/space property should have exactly one (non-negative integer) value in '"</span> << r<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L138" class="LineNr">138 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L139" class="LineNr">139 </span> <span class="Delimiter">}</span> <span id="L140" class="LineNr">140 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>p<span class="Delimiter">-></span>value != <span class="Constant">"0"</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> diff --git a/html/046check_type_by_name.cc.html b/html/046check_type_by_name.cc.html index 9c357115..c3f5e5f2 100644 --- a/html/046check_type_by_name.cc.html +++ b/html/046check_type_by_name.cc.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } .traceAbsent { color: #c00000; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } .traceContains { color: #008000; } --> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/046check_type_by_name.cc'>https://github.com/akkartik/mu/blob/master/046check_type_by_name.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Some simple sanity checks for types, and also attempts to guess them where</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: they aren't provided.</span> @@ -79,16 +82,16 @@ if ('onhashchange' in window) { <span id="L16" class="LineNr"> 16 </span> <span id="L17" class="LineNr"> 17 </span><span class="Comment">//: we need surrounding-space info for type-checking variables in other spaces</span> <span id="L18" class="LineNr"> 18 </span><span class="Delimiter">:(after "Transform.push_back(collect_surrounding_spaces)")</span> -<span id="L19" class="LineNr"> 19 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='046check_type_by_name.cc.html#L35'>check_or_set_types_by_name</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L19" class="LineNr"> 19 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='046check_type_by_name.cc.html#L35'>check_or_set_types_by_name</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L20" class="LineNr"> 20 </span> <span id="L21" class="LineNr"> 21 </span><span class="Comment">// Keep the name->type mapping for all recipes around for the entire</span> <span id="L22" class="LineNr"> 22 </span><span class="Comment">// transformation phase.</span> <span id="L23" class="LineNr"> 23 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L24" class="LineNr"> 24 </span>map<recipe_ordinal<span class="Delimiter">,</span> set<reagent<span class="Delimiter">,</span> name_lt> > Types_by_space<span class="Delimiter">;</span> <span class="Comment">// internal to transform; no need to snapshot</span> +<span id="L24" class="LineNr"> 24 </span>map<recipe_ordinal<span class="Delimiter">,</span> set<reagent<span class="Delimiter">,</span> name_lt> > <span class="Special">Types_by_space</span><span class="Delimiter">;</span> <span class="Comment">// internal to transform; no need to snapshot</span> <span id="L25" class="LineNr"> 25 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L26" class="LineNr"> 26 </span>Types_by_space<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L26" class="LineNr"> 26 </span><span class="Special">Types_by_space</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L27" class="LineNr"> 27 </span><span class="Delimiter">:(before "End transform_all")</span> -<span id="L28" class="LineNr"> 28 </span>Types_by_space<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L28" class="LineNr"> 28 </span><span class="Special">Types_by_space</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L29" class="LineNr"> 29 </span><span class="Delimiter">:(before "End Types")</span> <span id="L30" class="LineNr"> 30 </span><span class="Normal">struct</span> <a href='046check_type_by_name.cc.html#L30'>name_lt</a> <span class="Delimiter">{</span> <span id="L31" class="LineNr"> 31 </span> <span class="Normal">bool</span> <span class="Normal">operator</span><span class="Delimiter">()(</span><span class="Normal">const</span> reagent& a<span class="Delimiter">,</span> <span class="Normal">const</span> reagent& b<span class="Delimiter">)</span> <span class="Normal">const</span> <span class="Delimiter">{</span> <span class="Identifier">return</span> a<span class="Delimiter">.</span>name < b<span class="Delimiter">.</span>name<span class="Delimiter">;</span> <span class="Delimiter">}</span> @@ -96,7 +99,7 @@ if ('onhashchange' in window) { <span id="L33" class="LineNr"> 33 </span> <span id="L34" class="LineNr"> 34 </span><span class="Delimiter">:(code)</span> <span id="L35" class="LineNr"> 35 </span><span class="Normal">void</span> <a href='046check_type_by_name.cc.html#L35'>check_or_set_types_by_name</a><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="L36" class="LineNr"> 36 </span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L36" class="LineNr"> 36 </span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L37" class="LineNr"> 37 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- deduce types for <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L38" class="LineNr"> 38 </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#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L39" class="LineNr"> 39 </span> instruction& inst = caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> @@ -110,7 +113,7 @@ if ('onhashchange' in window) { <span id="L47" class="LineNr"> 47 </span><span class="Normal">void</span> <a href='046check_type_by_name.cc.html#L47'>check_or_set_type</a><span class="Delimiter">(</span>reagent& curr<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& caller<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L48" class="LineNr"> 48 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_literal<span class="Delimiter">(</span>curr<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L49" class="LineNr"> 49 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_integer<span class="Delimiter">(</span>curr<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">// no type-checking for raw locations</span> -<span id="L50" class="LineNr"> 50 </span> set<reagent<span class="Delimiter">,</span> name_lt>& known_types = Types_by_space[owning_recipe<span class="Delimiter">(</span>curr<span class="Delimiter">,</span> caller<span class="Delimiter">.</span>ordinal<span class="Delimiter">)</span>]<span class="Delimiter">;</span> +<span id="L50" class="LineNr"> 50 </span> set<reagent<span class="Delimiter">,</span> name_lt>& known_types = <span class="Special">Types_by_space</span>[owning_recipe<span class="Delimiter">(</span>curr<span class="Delimiter">,</span> caller<span class="Delimiter">.</span>ordinal<span class="Delimiter">)</span>]<span class="Delimiter">;</span> <span id="L51" class="LineNr"> 51 </span> <a href='046check_type_by_name.cc.html#L55'>deduce_missing_type</a><span class="Delimiter">(</span>known_types<span class="Delimiter">,</span> curr<span class="Delimiter">,</span> caller<span class="Delimiter">);</span> <span id="L52" class="LineNr"> 52 </span> <a href='046check_type_by_name.cc.html#L76'>check_type</a><span class="Delimiter">(</span>known_types<span class="Delimiter">,</span> curr<span class="Delimiter">,</span> caller<span class="Delimiter">);</span> <span id="L53" class="LineNr"> 53 </span><span class="Delimiter">}</span> @@ -129,7 +132,7 @@ if ('onhashchange' in window) { <span id="L66" class="LineNr"> 66 </span> <span class="Comment">// spaces are special; their type includes their /names property</span> <span id="L67" class="LineNr"> 67 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='043space.cc.html#L127'>is_mu_space</a><span class="Delimiter">(</span>x<span class="Delimiter">)</span> && !has_property<span class="Delimiter">(</span>x<span class="Delimiter">,</span> <span class="Constant">"names"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L68" class="LineNr"> 68 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_property<span class="Delimiter">(</span>exemplar<span class="Delimiter">,</span> <span class="Constant">"names"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L69" class="LineNr"> 69 </span> <a href='003trace.cc.html#L196'>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">"missing /names property for space variable '"</span> << exemplar<span class="Delimiter">.</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L69" class="LineNr"> 69 </span> <a href='003trace.cc.html#L196'>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">"missing /names property for space variable '"</span> << exemplar<span class="Delimiter">.</span>name << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L70" class="LineNr"> 70 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L71" class="LineNr"> 71 </span> <span class="Delimiter">}</span> <span id="L72" class="LineNr"> 72 </span> x<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>pair<string<span class="Delimiter">,</span> string_tree*><span class="Delimiter">(</span><span class="Constant">"names"</span><span class="Delimiter">,</span> <span class="Normal">new</span> string_tree<span class="Delimiter">(</span>*property<span class="Delimiter">(</span>exemplar<span class="Delimiter">,</span> <span class="Constant">"names"</span><span class="Delimiter">))));</span> @@ -141,7 +144,7 @@ if ('onhashchange' in window) { <span id="L78" class="LineNr"> 78 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">// might get filled in by other logic later</span> <span id="L79" class="LineNr"> 79 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='041jump_target.cc.html#L11'>is_jump_target</a><span class="Delimiter">(</span>x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L80" class="LineNr"> 80 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom || x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>name != <span class="Constant">"label"</span><span class="Delimiter">)</span> -<span id="L81" class="LineNr"> 81 </span> <a href='003trace.cc.html#L196'>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">"non-label '"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"' must begin with a letter</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L81" class="LineNr"> 81 </span> <a href='003trace.cc.html#L196'>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">"non-label '"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"' must begin with a letter\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L82" class="LineNr"> 82 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L83" class="LineNr"> 83 </span> <span class="Delimiter">}</span> <span id="L84" class="LineNr"> 84 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>known_types<span class="Delimiter">.</span>find<span class="Delimiter">(</span>x<span class="Delimiter">)</span> == known_types<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> @@ -149,17 +152,17 @@ if ('onhashchange' in window) { <span id="L86" class="LineNr"> 86 </span> known_types<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>x<span class="Delimiter">);</span> <span id="L87" class="LineNr"> 87 </span> <span class="Delimiter">}</span> <span id="L88" class="LineNr"> 88 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_strictly_match<span class="Delimiter">(</span>known_types<span class="Delimiter">.</span>find<span class="Delimiter">(</span>x<span class="Delimiter">)-></span>type<span class="Delimiter">,</span> x<span class="Delimiter">.</span>type<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L89" class="LineNr"> 89 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"' used with multiple types</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L89" class="LineNr"> 89 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"' used with multiple types\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L90" class="LineNr"> 90 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>known_types<span class="Delimiter">.</span>find<span class="Delimiter">(</span>x<span class="Delimiter">)-></span>type<span class="Delimiter">)</span> << <span class="Constant">" vs "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L91" class="LineNr"> 91 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L92" class="LineNr"> 92 </span> <span class="Delimiter">}</span> <span id="L93" class="LineNr"> 93 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_mu_array<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L94" class="LineNr"> 94 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L95" class="LineNr"> 95 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">": can't be just an array. What is it an array of?</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L95" class="LineNr"> 95 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">": can't be just an array. What is it an array of?\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L96" class="LineNr"> 96 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L97" class="LineNr"> 97 </span> <span class="Delimiter">}</span> <span id="L98" class="LineNr"> 98 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L99" class="LineNr"> 99 </span> <a href='003trace.cc.html#L196'>raise</a> << caller<span class="Delimiter">.</span>name << <span class="Constant">" can't determine the size of array variable '"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"'. Either allocate it separately and make the type of '"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"' an address, or specify the length of the array in the type of '"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"'.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L99" class="LineNr"> 99 </span> <a href='003trace.cc.html#L196'>raise</a> << caller<span class="Delimiter">.</span>name << <span class="Constant">" can't determine the size of array variable '"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"'. Either allocate it separately and make the type of '"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"' an address, or specify the length of the array in the type of '"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"'.\n"</span> << end<span class="Delimiter">();</span> <span id="L100" class="LineNr">100 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L101" class="LineNr">101 </span> <span class="Delimiter">}</span> <span id="L102" class="LineNr">102 </span> <span class="Delimiter">}</span> @@ -167,8 +170,8 @@ if ('onhashchange' in window) { <span id="L104" class="LineNr">104 </span> <span id="L105" class="LineNr">105 </span><a href='010vm.cc.html#L14'>recipe_ordinal</a> <a href='046check_type_by_name.cc.html#L105'>owning_recipe</a><span class="Delimiter">(</span><span class="Normal">const</span> reagent& x<span class="Delimiter">,</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L106" class="LineNr">106 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> s = <a href='044space_surround.cc.html#L56'>space_index</a><span class="Delimiter">(</span>x<span class="Delimiter">);</span> s > <span class="Constant">0</span><span class="Delimiter">;</span> --s<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L107" class="LineNr">107 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Surrounding_space<span class="Delimiter">,</span> r<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> -<span id="L108" class="LineNr">108 </span> r = Surrounding_space[r]<span class="Delimiter">;</span> +<span id="L107" class="LineNr">107 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Surrounding_space</span><span class="Delimiter">,</span> r<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> +<span id="L108" class="LineNr">108 </span> r = <span class="Special">Surrounding_space</span>[r]<span class="Delimiter">;</span> <span id="L109" class="LineNr">109 </span> <span class="Delimiter">}</span> <span id="L110" class="LineNr">110 </span> <span class="Identifier">return</span> r<span class="Delimiter">;</span> <span id="L111" class="LineNr">111 </span><span class="Delimiter">}</span> diff --git a/html/050scenario.cc.html b/html/050scenario.cc.html index be2ab48c..c52cc378 100644 --- a/html/050scenario.cc.html +++ b/html/050scenario.cc.html @@ -11,25 +11,27 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } .SalientComment { color: #00ffff; } .CommentedCode { color: #6c6c6c; } .traceAbsent { color: #c00000; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } .muScenario { color: #00af00; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } -.cSpecial { color: #008000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .traceContains { color: #008000; } +.Comment { color: #8080ff; } +.cSpecial { color: #008000; } --> </style> @@ -63,6 +65,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/050scenario.cc'>https://github.com/akkartik/mu/blob/master/050scenario.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Mu scenarios. This will get long, but these are the tests we want to</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: support in this layer.</span> @@ -130,14 +133,14 @@ if ('onhashchange' in window) { <span id="L64" class="LineNr"> 64 </span><span class="Delimiter">};</span> <span id="L65" class="LineNr"> 65 </span> <span id="L66" class="LineNr"> 66 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L67" class="LineNr"> 67 </span>vector<scenario> Scenarios<span class="Delimiter">,</span> Scenarios_snapshot<span class="Delimiter">;</span> -<span id="L68" class="LineNr"> 68 </span>set<string> Scenario_names<span class="Delimiter">,</span> Scenario_names_snapshot<span class="Delimiter">;</span> +<span id="L67" class="LineNr"> 67 </span>vector<scenario> <span class="Special">Scenarios</span><span class="Delimiter">,</span> <span class="Special">Scenarios_snapshot</span><span class="Delimiter">;</span> +<span id="L68" class="LineNr"> 68 </span>set<string> <span class="Special">Scenario_names</span><span class="Delimiter">,</span> <span class="Special">Scenario_names_snapshot</span><span class="Delimiter">;</span> <span id="L69" class="LineNr"> 69 </span><span class="Delimiter">:(before "End save_snapshots")</span> -<span id="L70" class="LineNr"> 70 </span>Scenarios_snapshot = Scenarios<span class="Delimiter">;</span> -<span id="L71" class="LineNr"> 71 </span>Scenario_names_snapshot = Scenario_names<span class="Delimiter">;</span> +<span id="L70" class="LineNr"> 70 </span><span class="Special">Scenarios_snapshot</span> = <span class="Special">Scenarios</span><span class="Delimiter">;</span> +<span id="L71" class="LineNr"> 71 </span><span class="Special">Scenario_names_snapshot</span> = <span class="Special">Scenario_names</span><span class="Delimiter">;</span> <span id="L72" class="LineNr"> 72 </span><span class="Delimiter">:(before "End restore_snapshots")</span> -<span id="L73" class="LineNr"> 73 </span>Scenarios = Scenarios_snapshot<span class="Delimiter">;</span> -<span id="L74" class="LineNr"> 74 </span>Scenario_names = Scenario_names_snapshot<span class="Delimiter">;</span> +<span id="L73" class="LineNr"> 73 </span><span class="Special">Scenarios</span> = <span class="Special">Scenarios_snapshot</span><span class="Delimiter">;</span> +<span id="L74" class="LineNr"> 74 </span><span class="Special">Scenario_names</span> = <span class="Special">Scenario_names_snapshot</span><span class="Delimiter">;</span> <span id="L75" class="LineNr"> 75 </span> <span id="L76" class="LineNr"> 76 </span><span class="SalientComment">//:: Parse the 'scenario' form.</span> <span id="L77" class="LineNr"> 77 </span><span class="Comment">//: Simply store the text of the scenario.</span> @@ -146,7 +149,7 @@ if ('onhashchange' in window) { <span id="L80" class="LineNr"> 80 </span><span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>command == <span class="Constant">"scenario"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L81" class="LineNr"> 81 </span> <a href='050scenario.cc.html#L57'>scenario</a> result = <a href='050scenario.cc.html#L91'>parse_scenario</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L82" class="LineNr"> 82 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!result<span class="Delimiter">.</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> -<span id="L83" class="LineNr"> 83 </span> Scenarios<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>result<span class="Delimiter">);</span> +<span id="L83" class="LineNr"> 83 </span> <span class="Special">Scenarios</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>result<span class="Delimiter">);</span> <span id="L84" class="LineNr"> 84 </span><span class="Delimiter">}</span> <span id="L85" class="LineNr"> 85 </span><span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>command == <span class="Constant">"pending-scenario"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L86" class="LineNr"> 86 </span> <span class="Comment">// for temporary use only</span> @@ -157,17 +160,17 @@ if ('onhashchange' in window) { <span id="L91" class="LineNr"> 91 </span><span class="muScenario"><a href='050scenario.cc.html#L57'>scenario</a></span> <a href='050scenario.cc.html#L91'>parse_scenario</a><span class="Delimiter">(</span>istream& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L92" class="LineNr"> 92 </span> <a href='050scenario.cc.html#L57'>scenario</a> result<span class="Delimiter">;</span> <span id="L93" class="LineNr"> 93 </span> result<span class="Delimiter">.</span>name = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> -<span id="L94" class="LineNr"> 94 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Scenario_names<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> -<span id="L95" class="LineNr"> 95 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"duplicate <a href='050scenario.cc.html#L57'>scenario</a> name: '"</span> << result<span class="Delimiter">.</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L96" class="LineNr"> 96 </span> Scenario_names<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">);</span> +<span id="L94" class="LineNr"> 94 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Scenario_names</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> +<span id="L95" class="LineNr"> 95 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"duplicate <a href='050scenario.cc.html#L57'>scenario</a> name: '"</span> << result<span class="Delimiter">.</span>name << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L96" class="LineNr"> 96 </span> <span class="Special">Scenario_names</span><span class="Delimiter">.</span>insert<span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">);</span> <span id="L97" class="LineNr"> 97 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L98" class="LineNr"> 98 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L99" class="LineNr"> 99 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='050scenario.cc.html#L57'>scenario</a> at <a href='003trace.cc.html#L225'>end</a> of file</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L99" class="LineNr"> 99 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='050scenario.cc.html#L57'>scenario</a> at <a href='003trace.cc.html#L225'>end</a> of file\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L100" class="LineNr">100 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L101" class="LineNr">101 </span> <span class="Delimiter">}</span> <span id="L102" class="LineNr">102 </span> <a href='011load.cc.html#L211'>skip_whitespace_and_comments</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L103" class="LineNr">103 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="Constant">'['</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L104" class="LineNr">104 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"Expected '[' after <a href='050scenario.cc.html#L57'>scenario</a> '"</span> << result<span class="Delimiter">.</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L104" class="LineNr">104 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"Expected '[' after <a href='050scenario.cc.html#L57'>scenario</a> '"</span> << result<span class="Delimiter">.</span>name << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L105" class="LineNr">105 </span> exit<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L106" class="LineNr">106 </span> <span class="Delimiter">}</span> <span id="L107" class="LineNr">107 </span> <span class="Comment">// scenarios are take special 'code' strings so we need to ignore brackets</span> @@ -175,13 +178,13 @@ if ('onhashchange' in window) { <span id="L109" class="LineNr">109 </span> result<span class="Delimiter">.</span>to_run = <a href='014literal_string.cc.html#L33'>slurp_quoted</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L110" class="LineNr">110 </span> <span class="Comment">// delete [] delimiters</span> <span id="L111" class="LineNr">111 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!starts_with<span class="Delimiter">(</span>result<span class="Delimiter">.</span>to_run<span class="Delimiter">,</span> <span class="Constant">"["</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L112" class="LineNr">112 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"scenario "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">" should start with '['</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L112" class="LineNr">112 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"scenario "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">" should start with '['\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L113" class="LineNr">113 </span> result<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L114" class="LineNr">114 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L115" class="LineNr">115 </span> <span class="Delimiter">}</span> <span id="L116" class="LineNr">116 </span> result<span class="Delimiter">.</span>to_run<span class="Delimiter">.</span>erase<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> <span id="L117" class="LineNr">117 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>result<span class="Delimiter">.</span>to_run<span class="Delimiter">.</span>at<span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>result<span class="Delimiter">.</span>to_run<span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">)</span> != <span class="Constant">']'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L118" class="LineNr">118 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"scenario "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">" has an unbalanced '['</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L118" class="LineNr">118 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"scenario "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">" has an unbalanced '['\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L119" class="LineNr">119 </span> result<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L120" class="LineNr">120 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L121" class="LineNr">121 </span> <span class="Delimiter">}</span> @@ -217,68 +220,68 @@ if ('onhashchange' in window) { <span id="L151" class="LineNr">151 </span><span class="Comment">//: Treat the text of the scenario as a regular series of instructions.</span> <span id="L152" class="LineNr">152 </span> <span id="L153" class="LineNr">153 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L154" class="LineNr">154 </span><span class="Normal">int</span> Num_core_mu_scenarios = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L154" class="LineNr">154 </span><span class="Normal">int</span> <span class="Special">Num_core_mu_scenarios</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L155" class="LineNr">155 </span><span class="Delimiter">:(after "Check For .mu Files")</span> -<span id="L156" class="LineNr">156 </span>Num_core_mu_scenarios = <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Scenarios<span class="Delimiter">);</span> +<span id="L156" class="LineNr">156 </span><span class="Special">Num_core_mu_scenarios</span> = <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Scenarios</span><span class="Delimiter">);</span> <span id="L157" class="LineNr">157 </span><span class="Delimiter">:(before "End Tests")</span> -<span id="L158" class="LineNr">158 </span>Hide_missing_default_space_errors =<span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L159" class="LineNr">159 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Num_core_mu_scenarios > <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L158" class="LineNr">158 </span><span class="Special">Hide_missing_default_space_errors</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L159" class="LineNr">159 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Num_core_mu_scenarios</span> > <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L160" class="LineNr">160 </span> time<span class="Delimiter">(</span>&t<span class="Delimiter">);</span> <span id="L161" class="LineNr">161 </span> cerr << <span class="Constant">"Mu tests: "</span> << ctime<span class="Delimiter">(</span>&t<span class="Delimiter">);</span> -<span id="L162" class="LineNr">162 </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 < Num_core_mu_scenarios<span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L162" class="LineNr">162 </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 < <span class="Special">Num_core_mu_scenarios</span><span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L163" class="LineNr">163 </span><span class="CommentedCode">//? cerr << '\n' << i << ": " << Scenarios.at(i).name;</span> -<span id="L164" class="LineNr">164 </span> run_mu_scenario<span class="Delimiter">(</span>Scenarios<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> -<span id="L165" class="LineNr">165 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Passed<span class="Delimiter">)</span> cerr << <span class="Constant">"."</span><span class="Delimiter">;</span> +<span id="L164" class="LineNr">164 </span> run_mu_scenario<span class="Delimiter">(</span><span class="Special">Scenarios</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> +<span id="L165" class="LineNr">165 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Passed</span><span class="Delimiter">)</span> cerr << <span class="Constant">"."</span><span class="Delimiter">;</span> <span id="L166" class="LineNr">166 </span> <span class="Normal">else</span> ++num_failures<span class="Delimiter">;</span> <span id="L167" class="LineNr">167 </span> <span class="Delimiter">}</span> -<span id="L168" class="LineNr">168 </span> cerr << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L168" class="LineNr">168 </span> cerr << <span class="Constant">"\n"</span><span class="Delimiter">;</span> <span id="L169" class="LineNr">169 </span><span class="Delimiter">}</span> <span id="L170" class="LineNr">170 </span><span class="Normal">run_app_scenarios</span>: -<span id="L171" class="LineNr">171 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Num_core_mu_scenarios != <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Scenarios<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L171" class="LineNr">171 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Num_core_mu_scenarios</span> != <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Scenarios</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L172" class="LineNr">172 </span> time<span class="Delimiter">(</span>&t<span class="Delimiter">);</span> <span id="L173" class="LineNr">173 </span> cerr << <span class="Constant">"App tests: "</span> << ctime<span class="Delimiter">(</span>&t<span class="Delimiter">);</span> -<span id="L174" class="LineNr">174 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = Num_core_mu_scenarios<span class="Delimiter">;</span> i < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Scenarios<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L174" class="LineNr">174 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Special">Num_core_mu_scenarios</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Scenarios</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L175" class="LineNr">175 </span><span class="CommentedCode">//? cerr << '\n' << i << ": " << Scenarios.at(i).name;</span> -<span id="L176" class="LineNr">176 </span> run_mu_scenario<span class="Delimiter">(</span>Scenarios<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> -<span id="L177" class="LineNr">177 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Passed<span class="Delimiter">)</span> cerr << <span class="Constant">"."</span><span class="Delimiter">;</span> +<span id="L176" class="LineNr">176 </span> run_mu_scenario<span class="Delimiter">(</span><span class="Special">Scenarios</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> +<span id="L177" class="LineNr">177 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Passed</span><span class="Delimiter">)</span> cerr << <span class="Constant">"."</span><span class="Delimiter">;</span> <span id="L178" class="LineNr">178 </span> <span class="Normal">else</span> ++num_failures<span class="Delimiter">;</span> <span id="L179" class="LineNr">179 </span> <span class="Delimiter">}</span> -<span id="L180" class="LineNr">180 </span> cerr << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L180" class="LineNr">180 </span> cerr << <span class="Constant">"\n"</span><span class="Delimiter">;</span> <span id="L181" class="LineNr">181 </span><span class="Delimiter">}</span> <span id="L182" class="LineNr">182 </span> <span id="L183" class="LineNr">183 </span><span class="Comment">//: For faster debugging, support running tests for just the Mu app(s) we are</span> <span id="L184" class="LineNr">184 </span><span class="Comment">//: loading.</span> <span id="L185" class="LineNr">185 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L186" class="LineNr">186 </span><span class="Normal">bool</span> Test_only_app =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L186" class="LineNr">186 </span><span class="Normal">bool</span> <span class="Special">Test_only_app</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L187" class="LineNr">187 </span><span class="Delimiter">:(before "End Commandline Options(*arg)")</span> <span id="L188" class="LineNr">188 </span><span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L73'>is_equal</a><span class="Delimiter">(</span>*arg<span class="Delimiter">,</span> <span class="Constant">"--test-only-app"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L189" class="LineNr">189 </span> Test_only_app =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L189" class="LineNr">189 </span> <span class="Special">Test_only_app</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L190" class="LineNr">190 </span><span class="Delimiter">}</span> <span id="L191" class="LineNr">191 </span><span class="Delimiter">:(after "End Test Run Initialization")</span> -<span id="L192" class="LineNr">192 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Test_only_app && Num_core_mu_scenarios < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Scenarios<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L192" class="LineNr">192 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Test_only_app</span> && <span class="Special">Num_core_mu_scenarios</span> < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Scenarios</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L193" class="LineNr">193 </span> <span class="Identifier">goto</span> run_app_scenarios<span class="Delimiter">;</span> <span id="L194" class="LineNr">194 </span><span class="Delimiter">}</span> <span id="L195" class="LineNr">195 </span> <span id="L196" class="LineNr">196 </span><span class="Comment">//: Convenience: run a single named scenario.</span> <span id="L197" class="LineNr">197 </span><span class="Delimiter">:(after "Test Runs")</span> -<span id="L198" class="LineNr">198 </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#L141'>SIZE</a><span class="Delimiter">(</span>Scenarios<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L199" class="LineNr">199 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Scenarios<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name == argv[argc-<span class="Constant">1</span>]<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L200" class="LineNr">200 </span> run_mu_scenario<span class="Delimiter">(</span>Scenarios<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> -<span id="L201" class="LineNr">201 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Passed<span class="Delimiter">)</span> cerr << <span class="Constant">".</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L198" class="LineNr">198 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Scenarios</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L199" class="LineNr">199 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Scenarios</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name == argv[argc-<span class="Constant">1</span>]<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L200" class="LineNr">200 </span> run_mu_scenario<span class="Delimiter">(</span><span class="Special">Scenarios</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> +<span id="L201" class="LineNr">201 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Passed</span><span class="Delimiter">)</span> cerr << <span class="Constant">".\n"</span><span class="Delimiter">;</span> <span id="L202" class="LineNr">202 </span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L203" class="LineNr">203 </span> <span class="Delimiter">}</span> <span id="L204" class="LineNr">204 </span><span class="Delimiter">}</span> <span id="L205" class="LineNr">205 </span> <span id="L206" class="LineNr">206 </span><span class="Delimiter">:(before "End Globals")</span> <span id="L207" class="LineNr">207 </span><span class="Comment">// this isn't a constant, just a global of type const*</span> -<span id="L208" class="LineNr">208 </span><span class="Normal">const</span> scenario* Current_scenario = <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L208" class="LineNr">208 </span><span class="Normal">const</span> scenario* <span class="Special">Current_scenario</span> = <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L209" class="LineNr">209 </span><span class="Delimiter">:(code)</span> <span id="L210" class="LineNr">210 </span><span class="Normal">void</span> run_mu_scenario<span class="Delimiter">(</span><span class="Normal">const</span> scenario& s<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L211" class="LineNr">211 </span> Current_scenario = &s<span class="Delimiter">;</span> -<span id="L212" class="LineNr">212 </span> <span class="Normal">bool</span> not_already_inside_test = !Trace_stream<span class="Delimiter">;</span> +<span id="L211" class="LineNr">211 </span> <span class="Special">Current_scenario</span> = &s<span class="Delimiter">;</span> +<span id="L212" class="LineNr">212 </span> <span class="Normal">bool</span> not_already_inside_test = !<span class="Special">Trace_stream</span><span class="Delimiter">;</span> <span id="L213" class="LineNr">213 </span><span class="CommentedCode">//? cerr << s.name << '\n';</span> <span id="L214" class="LineNr">214 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>not_already_inside_test<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L215" class="LineNr">215 </span> Trace_stream = <span class="Normal">new</span> trace_stream<span class="Delimiter">;</span> +<span id="L215" class="LineNr">215 </span> <span class="Special">Trace_stream</span> = <span class="Normal">new</span> trace_stream<span class="Delimiter">;</span> <span id="L216" class="LineNr">216 </span> <a href='000organization.cc.html#L134'>reset</a><span class="Delimiter">();</span> <span id="L217" class="LineNr">217 </span> <span class="Delimiter">}</span> <span id="L218" class="LineNr">218 </span> vector<recipe_ordinal> tmp = load<span class="Delimiter">(</span><span class="Constant">"recipe scenario_"</span>+s<span class="Delimiter">.</span>name+<span class="Constant">" [ "</span>+s<span class="Delimiter">.</span>to_run+<span class="Constant">" ]"</span><span class="Delimiter">);</span> @@ -288,14 +291,14 @@ if ('onhashchange' in window) { <span id="L222" class="LineNr">222 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!trace_contains_errors<span class="Delimiter">())</span> <span id="L223" class="LineNr">223 </span> run<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>front<span class="Delimiter">());</span> <span id="L224" class="LineNr">224 </span> <span class="Comment">// End Mu Test Teardown</span> -<span id="L225" class="LineNr">225 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors && <a href='003trace.cc.html#L220'>trace_contains_errors</a><span class="Delimiter">()</span> && !Scenario_testing_scenario<span class="Delimiter">)</span> -<span id="L226" class="LineNr">226 </span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L227" class="LineNr">227 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>not_already_inside_test && Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L228" class="LineNr">228 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Save_trace<span class="Delimiter">)</span> Trace_stream<span class="Delimiter">-></span><a href='003trace.cc.html#L133'>save</a><span class="Delimiter">();</span> -<span id="L229" class="LineNr">229 </span> <span class="Normal">delete</span> Trace_stream<span class="Delimiter">;</span> -<span id="L230" class="LineNr">230 </span> Trace_stream = <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L225" class="LineNr">225 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span> && <a href='003trace.cc.html#L220'>trace_contains_errors</a><span class="Delimiter">()</span> && !<span class="Special">Scenario_testing_scenario</span><span class="Delimiter">)</span> +<span id="L226" class="LineNr">226 </span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L227" class="LineNr">227 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>not_already_inside_test && <span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L228" class="LineNr">228 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Save_trace</span><span class="Delimiter">)</span> <span class="Special">Trace_stream</span><span class="Delimiter">-></span><a href='003trace.cc.html#L133'>save</a><span class="Delimiter">();</span> +<span id="L229" class="LineNr">229 </span> <span class="Normal">delete</span> <span class="Special">Trace_stream</span><span class="Delimiter">;</span> +<span id="L230" class="LineNr">230 </span> <span class="Special">Trace_stream</span> = <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L231" class="LineNr">231 </span> <span class="Delimiter">}</span> -<span id="L232" class="LineNr">232 </span> Current_scenario = <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L232" class="LineNr">232 </span> <span class="Special">Current_scenario</span> = <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L233" class="LineNr">233 </span><span class="Delimiter">}</span> <span id="L234" class="LineNr">234 </span> <span id="L235" class="LineNr">235 </span><span class="Comment">//: Permit numeric locations to be accessed in scenarios.</span> @@ -333,15 +336,15 @@ if ('onhashchange' in window) { <span id="L267" class="LineNr">267 </span><span class="Normal">if</span> <span class="Delimiter">(</span>s == <span class="Constant">"__maybe_make_raw_test__"</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L268" class="LineNr">268 </span><span class="Delimiter">:(before "End Special Scenario Variable Names(r)")</span> <span id="L269" class="LineNr">269 </span><span class="Comment">//: ugly: we only need this for this one test, but need to define it for all time</span> -<span id="L270" class="LineNr">270 </span>Name[r][<span class="Constant">"__maybe_make_raw_test__"</span>] = Reserved_for_tests-<span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L270" class="LineNr">270 </span><span class="Special">Name</span>[r][<span class="Constant">"__maybe_make_raw_test__"</span>] = <span class="Special">Reserved_for_tests-1</span><span class="Delimiter">;</span> <span id="L271" class="LineNr">271 </span><span class="Delimiter">:(code)</span> <span id="L272" class="LineNr">272 </span><span class="Normal">void</span> test_maybe_make_raw<span class="Delimiter">()</span> <span class="Delimiter">{</span> <span id="L273" class="LineNr">273 </span> <span class="Comment">// check that scenarios can use local-scope and special variables together</span> <span id="L274" class="LineNr">274 </span> vector<recipe_ordinal> tmp = load<span class="Delimiter">(</span> -<span id="L275" class="LineNr">275 </span> <span class="Constant">"def scenario_foo [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L276" class="LineNr">276 </span> <span class="Constant">" local-scope</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L277" class="LineNr">277 </span> <span class="Constant">" __maybe_make_raw_test__:num <- copy 34</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L278" class="LineNr">278 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L275" class="LineNr">275 </span> <span class="Constant">"def scenario_foo [\n"</span> +<span id="L276" class="LineNr">276 </span> <span class="Constant">" local-scope\n"</span> +<span id="L277" class="LineNr">277 </span> <span class="Constant">" __maybe_make_raw_test__:num <- copy 34\n"</span> +<span id="L278" class="LineNr">278 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L279" class="LineNr">279 </span> mark_autogenerated<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> <span id="L280" class="LineNr">280 </span> bind_special_scenario_names<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> <span id="L281" class="LineNr">281 </span> <a href='012transform.cc.html#L46'>transform_all</a><span class="Delimiter">();</span> @@ -401,7 +404,7 @@ if ('onhashchange' in window) { <span id="L335" class="LineNr">335 </span><span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">.</span>name == <span class="Constant">"run"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L336" class="LineNr">336 </span> <span class="Comment">// Just inline all instructions inside the run block in the containing</span> <span id="L337" class="LineNr">337 </span> <span class="Comment">// recipe. 'run' is basically a comment; pretend it doesn't exist.</span> -<span id="L338" class="LineNr">338 </span> istringstream in2<span class="Delimiter">(</span><span class="Constant">"[</span><span class="cSpecial">\n</span><span class="Constant">"</span>+curr<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name+<span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L338" class="LineNr">338 </span> istringstream in2<span class="Delimiter">(</span><span class="Constant">"[\n"</span>+curr<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name+<span class="Constant">"\n]\n"</span><span class="Delimiter">);</span> <span id="L339" class="LineNr">339 </span> <a href='011load.cc.html#L83'>slurp_body</a><span class="Delimiter">(</span>in2<span class="Delimiter">,</span> result<span class="Delimiter">);</span> <span id="L340" class="LineNr">340 </span> curr<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L341" class="LineNr">341 </span><span class="Delimiter">}</span> @@ -422,9 +425,9 @@ if ('onhashchange' in window) { <span id="L356" class="LineNr">356 </span><span class="Comment">//: Also includes some special support for checking Mu texts.</span> <span id="L357" class="LineNr">357 </span> <span id="L358" class="LineNr">358 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L359" class="LineNr">359 </span><span class="Normal">bool</span> Scenario_testing_scenario =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L359" class="LineNr">359 </span><span class="Normal">bool</span> <span class="Special">Scenario_testing_scenario</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L360" class="LineNr">360 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L361" class="LineNr">361 </span>Scenario_testing_scenario =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L361" class="LineNr">361 </span><span class="Special">Scenario_testing_scenario</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L362" class="LineNr">362 </span> <span id="L363" class="LineNr">363 </span><span class="Delimiter">:(scenario memory_check)</span> <span id="L364" class="LineNr">364 </span><span class="Special">% Scenario_testing_scenario = true;</span> @@ -440,14 +443,14 @@ if ('onhashchange' in window) { <span id="L374" class="LineNr">374 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L375" class="LineNr">375 </span>MEMORY_SHOULD_CONTAIN<span class="Delimiter">,</span> <span id="L376" class="LineNr">376 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L377" class="LineNr">377 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"memory-should-contain"</span><span class="Delimiter">,</span> MEMORY_SHOULD_CONTAIN<span class="Delimiter">);</span> +<span id="L377" class="LineNr">377 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"memory-should-contain"</span><span class="Delimiter">,</span> MEMORY_SHOULD_CONTAIN<span class="Delimiter">);</span> <span id="L378" class="LineNr">378 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L379" class="LineNr">379 </span><span class="Normal">case</span> MEMORY_SHOULD_CONTAIN: <span class="Delimiter">{</span> <span id="L380" class="LineNr">380 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L381" class="LineNr">381 </span><span class="Delimiter">}</span> <span id="L382" class="LineNr">382 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L383" class="LineNr">383 </span><span class="Normal">case</span> MEMORY_SHOULD_CONTAIN: <span class="Delimiter">{</span> -<span id="L384" class="LineNr">384 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Passed<span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L384" class="LineNr">384 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Passed</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L385" class="LineNr">385 </span> check_memory<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name<span class="Delimiter">);</span> <span id="L386" class="LineNr">386 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L387" class="LineNr">387 </span><span class="Delimiter">}</span> @@ -463,7 +466,7 @@ if ('onhashchange' in window) { <span id="L397" class="LineNr">397 </span> string lhs = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L398" class="LineNr">398 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>lhs<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L399" class="LineNr">399 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L400" class="LineNr">400 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"incomplete 'memory-should-contain' block at <a href='003trace.cc.html#L225'>end</a> of file (0)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L400" class="LineNr">400 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"incomplete 'memory-should-contain' block at <a href='003trace.cc.html#L225'>end</a> of file (0)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L401" class="LineNr">401 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L402" class="LineNr">402 </span> <span class="Delimiter">}</span> <span id="L403" class="LineNr">403 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_integer<span class="Delimiter">(</span>lhs<span class="Delimiter">))</span> <span class="Delimiter">{</span> @@ -477,23 +480,23 @@ if ('onhashchange' in window) { <span id="L411" class="LineNr">411 </span> string rhs = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L412" class="LineNr">412 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>rhs<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L413" class="LineNr">413 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L414" class="LineNr">414 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"incomplete 'memory-should-contain' block at <a href='003trace.cc.html#L225'>end</a> of file (1)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L414" class="LineNr">414 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"incomplete 'memory-should-contain' block at <a href='003trace.cc.html#L225'>end</a> of file (1)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L415" class="LineNr">415 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L416" class="LineNr">416 </span> <span class="Delimiter">}</span> <span id="L417" class="LineNr">417 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_integer<span class="Delimiter">(</span>rhs<span class="Delimiter">)</span> && !is_noninteger<span class="Delimiter">(</span>rhs<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L418" class="LineNr">418 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L418" class="LineNr">418 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L419" class="LineNr">419 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"location '"</span> << address << <span class="Constant">"' can't contain non-number "</span> << rhs << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> -<span id="L420" class="LineNr">420 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L420" class="LineNr">420 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Scenario_testing_scenario</span><span class="Delimiter">)</span> <span class="Special">Passed</span> =<span class="Constant"> false</span><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="Delimiter">}</span> <span id="L423" class="LineNr">423 </span> <span class="Normal">double</span> value = <a href='015literal_noninteger.cc.html#L26'>to_double</a><span class="Delimiter">(</span>rhs<span class="Delimiter">);</span> <span id="L424" class="LineNr">424 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>locations_checked<span class="Delimiter">,</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">))</span> -<span id="L425" class="LineNr">425 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"duplicate expectation for location '"</span> << address << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L425" class="LineNr">425 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"duplicate expectation for location '"</span> << address << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L426" class="LineNr">426 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"checking location "</span> << <a href='043space.cc.html#L101'>address</a> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L427" class="LineNr">427 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">)</span> != value<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L428" class="LineNr">428 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L429" class="LineNr">429 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected location '"</span> << address << <span class="Constant">"' to contain "</span> << no_scientific<span class="Delimiter">(</span>value<span class="Delimiter">)</span> << <span class="Constant">" but saw "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L430" class="LineNr">430 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L427" class="LineNr">427 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">)</span> != value<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L428" class="LineNr">428 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L429" class="LineNr">429 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected location '"</span> << address << <span class="Constant">"' to contain "</span> << no_scientific<span class="Delimiter">(</span>value<span class="Delimiter">)</span> << <span class="Constant">" but saw "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L430" class="LineNr">430 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Scenario_testing_scenario</span><span class="Delimiter">)</span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L431" class="LineNr">431 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L432" class="LineNr">432 </span> <span class="Delimiter">}</span> <span id="L433" class="LineNr">433 </span> locations_checked<span class="Delimiter">.</span>insert<span class="Delimiter">(</span><a href='043space.cc.html#L101'>address</a><span class="Delimiter">);</span> @@ -508,7 +511,7 @@ if ('onhashchange' in window) { <span id="L442" class="LineNr">442 </span> string _assign = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L443" class="LineNr">443 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>_assign<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L444" class="LineNr">444 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L445" class="LineNr">445 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"incomplete 'memory-should-contain' block at <a href='003trace.cc.html#L225'>end</a> of file (2)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L445" class="LineNr">445 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"incomplete 'memory-should-contain' block at <a href='003trace.cc.html#L225'>end</a> of file (2)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L446" class="LineNr">446 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L447" class="LineNr">447 </span> <span class="Delimiter">}</span> <span id="L448" class="LineNr">448 </span> assert<span class="Delimiter">(</span>_assign == <span class="Constant">"<-"</span><span class="Delimiter">);</span> @@ -516,13 +519,13 @@ if ('onhashchange' in window) { <span id="L450" class="LineNr">450 </span> string literal = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L451" class="LineNr">451 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>literal<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L452" class="LineNr">452 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L453" class="LineNr">453 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"incomplete 'memory-should-contain' block at <a href='003trace.cc.html#L225'>end</a> of file (3)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L453" class="LineNr">453 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"incomplete 'memory-should-contain' block at <a href='003trace.cc.html#L225'>end</a> of file (3)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L454" class="LineNr">454 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L455" class="LineNr">455 </span> <span class="Delimiter">}</span> <span id="L456" class="LineNr">456 </span> <span class="Normal">int</span> <a href='043space.cc.html#L101'>address</a> = x<span class="Delimiter">.</span>value<span class="Delimiter">;</span> <span id="L457" class="LineNr">457 </span> <span class="Comment">// exclude quoting brackets</span> <span id="L458" class="LineNr">458 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*literal<span class="Delimiter">.</span>begin<span class="Delimiter">()</span> != <span class="Constant">'['</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L459" class="LineNr">459 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"array:character types inside 'memory-should-contain' can only be compared with text literals surrounded by [], not '"</span> << literal << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L459" class="LineNr">459 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"array:character types inside 'memory-should-contain' can only be compared with text literals surrounded by [], not '"</span> << literal << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L460" class="LineNr">460 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L461" class="LineNr">461 </span> <span class="Delimiter">}</span> <span id="L462" class="LineNr">462 </span> literal<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>literal<span class="Delimiter">.</span>begin<span class="Delimiter">());</span> @@ -531,25 +534,25 @@ if ('onhashchange' in window) { <span id="L465" class="LineNr">465 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L466" class="LineNr">466 </span> <span class="Delimiter">}</span> <span id="L467" class="LineNr">467 </span> <span class="Comment">// End Scenario Type Special-cases</span> -<span id="L468" class="LineNr">468 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"don't know how to check memory for '"</span> << lhs << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L468" class="LineNr">468 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"don't know how to check memory for '"</span> << lhs << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L469" class="LineNr">469 </span><span class="Delimiter">}</span> <span id="L470" class="LineNr">470 </span> <span id="L471" class="LineNr">471 </span><span class="Normal">void</span> check_mu_text<span class="Delimiter">(</span><span class="Normal">int</span> start<span class="Delimiter">,</span> <span class="Normal">const</span> string& literal<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L472" class="LineNr">472 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"checking text length at "</span> << start << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L473" class="LineNr">473 </span> <span class="Normal">int</span> <a href='032array.cc.html#L319'>array_length</a> = <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> start<span class="Delimiter">));</span> +<span id="L473" class="LineNr">473 </span> <span class="Normal">int</span> <a href='032array.cc.html#L319'>array_length</a> = <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> start<span class="Delimiter">));</span> <span id="L474" class="LineNr">474 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='032array.cc.html#L319'>array_length</a> != <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>literal<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L475" class="LineNr">475 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L476" class="LineNr">476 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected location '"</span> << start << <span class="Constant">"' to contain length "</span> << <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>literal<span class="Delimiter">)</span> << <span class="Constant">" of text ["</span> << literal << <span class="Constant">"] but saw "</span> << <a href='032array.cc.html#L319'>array_length</a> << <span class="Constant">" (for text ["</span> << <a href='038new_text.cc.html#L149'>read_mu_characters</a><span class="Delimiter">(</span>start+<span class="Comment">/*</span><span class="Comment">skip length</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> <a href='032array.cc.html#L319'>array_length</a><span class="Delimiter">)</span> << <span class="Constant">"])</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L477" class="LineNr">477 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L475" class="LineNr">475 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L476" class="LineNr">476 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected location '"</span> << start << <span class="Constant">"' to contain length "</span> << <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>literal<span class="Delimiter">)</span> << <span class="Constant">" of text ["</span> << literal << <span class="Constant">"] but saw "</span> << <a href='032array.cc.html#L319'>array_length</a> << <span class="Constant">" (for text ["</span> << <a href='038new_text.cc.html#L149'>read_mu_characters</a><span class="Delimiter">(</span>start+<span class="Comment">/*</span><span class="Comment">skip length</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> <a href='032array.cc.html#L319'>array_length</a><span class="Delimiter">)</span> << <span class="Constant">"])\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L477" class="LineNr">477 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Scenario_testing_scenario</span><span class="Delimiter">)</span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L478" class="LineNr">478 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L479" class="LineNr">479 </span> <span class="Delimiter">}</span> <span id="L480" class="LineNr">480 </span> <span class="Normal">int</span> curr = start+<span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// now skip length</span> <span id="L481" class="LineNr">481 </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#L141'>SIZE</a><span class="Delimiter">(</span>literal<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L482" class="LineNr">482 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"checking location "</span> << curr+i << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L483" class="LineNr">483 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr+i<span class="Delimiter">)</span> != literal<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L484" class="LineNr">484 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L485" class="LineNr">485 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected location "</span> << <span class="Delimiter">(</span>curr+i<span class="Delimiter">)</span> << <span class="Constant">" to contain "</span> << literal<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)</span> << <span class="Constant">" but saw "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr+i<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L486" class="LineNr">486 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L483" class="LineNr">483 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr+i<span class="Delimiter">)</span> != literal<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L484" class="LineNr">484 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L485" class="LineNr">485 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected location "</span> << <span class="Delimiter">(</span>curr+i<span class="Delimiter">)</span> << <span class="Constant">" to contain "</span> << literal<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)</span> << <span class="Constant">" but saw "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr+i<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L486" class="LineNr">486 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Scenario_testing_scenario</span><span class="Delimiter">)</span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L487" class="LineNr">487 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L488" class="LineNr">488 </span> <span class="Delimiter">}</span> <span id="L489" class="LineNr">489 </span> <span class="Delimiter">}</span> @@ -648,14 +651,14 @@ if ('onhashchange' in window) { <span id="L582" class="LineNr">582 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L583" class="LineNr">583 </span>TRACE_SHOULD_CONTAIN<span class="Delimiter">,</span> <span id="L584" class="LineNr">584 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L585" class="LineNr">585 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"trace-should-contain"</span><span class="Delimiter">,</span> TRACE_SHOULD_CONTAIN<span class="Delimiter">);</span> +<span id="L585" class="LineNr">585 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"trace-should-contain"</span><span class="Delimiter">,</span> TRACE_SHOULD_CONTAIN<span class="Delimiter">);</span> <span id="L586" class="LineNr">586 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L587" class="LineNr">587 </span><span class="Normal">case</span> TRACE_SHOULD_CONTAIN: <span class="Delimiter">{</span> <span id="L588" class="LineNr">588 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L589" class="LineNr">589 </span><span class="Delimiter">}</span> <span id="L590" class="LineNr">590 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L591" class="LineNr">591 </span><span class="Normal">case</span> TRACE_SHOULD_CONTAIN: <span class="Delimiter">{</span> -<span id="L592" class="LineNr">592 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Passed<span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L592" class="LineNr">592 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Passed</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L593" class="LineNr">593 </span> check_trace<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name<span class="Delimiter">);</span> <span id="L594" class="LineNr">594 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L595" class="LineNr">595 </span><span class="Delimiter">}</span> @@ -664,34 +667,34 @@ if ('onhashchange' in window) { <span id="L598" class="LineNr">598 </span><span class="Comment">// simplified version of check_trace_contents() that emits errors rather</span> <span id="L599" class="LineNr">599 </span><span class="Comment">// than just printing to stderr</span> <span id="L600" class="LineNr">600 </span><span class="Normal">void</span> check_trace<span class="Delimiter">(</span><span class="Normal">const</span> string& expected<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L601" class="LineNr">601 </span> Trace_stream<span class="Delimiter">-></span><a href='003trace.cc.html#L147'>newline</a><span class="Delimiter">();</span> +<span id="L601" class="LineNr">601 </span> <span class="Special">Trace_stream</span><span class="Delimiter">-></span><a href='003trace.cc.html#L147'>newline</a><span class="Delimiter">();</span> <span id="L602" class="LineNr">602 </span> vector<trace_line> expected_lines = parse_trace<span class="Delimiter">(</span>expected<span class="Delimiter">);</span> <span id="L603" class="LineNr">603 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>expected_lines<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L604" class="LineNr">604 </span> <span class="Normal">int</span> curr_expected_line = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L605" class="LineNr">605 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<trace_line>::iterator p = Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L605" class="LineNr">605 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<trace_line>::iterator p = <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L606" class="LineNr">606 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>expected_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>curr_expected_line<span class="Delimiter">).</span>label != p<span class="Delimiter">-></span>label<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L607" class="LineNr">607 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>expected_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>curr_expected_line<span class="Delimiter">).</span>contents != <a href='003trace.cc.html#L394'>trim</a><span class="Delimiter">(</span>p<span class="Delimiter">-></span>contents<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L608" class="LineNr">608 </span> <span class="Comment">// match</span> <span id="L609" class="LineNr">609 </span> ++curr_expected_line<span class="Delimiter">;</span> <span id="L610" class="LineNr">610 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr_expected_line == <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>expected_lines<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L611" class="LineNr">611 </span> <span class="Delimiter">}</span> -<span id="L612" class="LineNr">612 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L612" class="LineNr">612 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L613" class="LineNr">613 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"missing ["</span> << expected_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>curr_expected_line<span class="Delimiter">).</span>contents << <span class="Constant">"] "</span> -<span id="L614" class="LineNr">614 </span> << <span class="Constant">"in <a href='003trace.cc.html#L189'>trace</a> with label '"</span> << expected_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>curr_expected_line<span class="Delimiter">).</span>label << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L615" class="LineNr">615 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> +<span id="L614" class="LineNr">614 </span> << <span class="Constant">"in <a href='003trace.cc.html#L189'>trace</a> with label '"</span> << expected_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>curr_expected_line<span class="Delimiter">).</span>label << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L615" class="LineNr">615 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> <span id="L616" class="LineNr">616 </span> <a href='003trace.cc.html#L193'>DUMP</a><span class="Delimiter">(</span>expected_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>curr_expected_line<span class="Delimiter">).</span>label<span class="Delimiter">);</span> -<span id="L617" class="LineNr">617 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L617" class="LineNr">617 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Scenario_testing_scenario</span><span class="Delimiter">)</span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L618" class="LineNr">618 </span><span class="Delimiter">}</span> <span id="L619" class="LineNr">619 </span> <span id="L620" class="LineNr">620 </span>vector<trace_line> parse_trace<span class="Delimiter">(</span><span class="Normal">const</span> string& expected<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L621" class="LineNr">621 </span> vector<string> buf = <a href='003trace.cc.html#L370'>split</a><span class="Delimiter">(</span>expected<span class="Delimiter">,</span> <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L621" class="LineNr">621 </span> vector<string> buf = <a href='003trace.cc.html#L370'>split</a><span class="Delimiter">(</span>expected<span class="Delimiter">,</span> <span class="Constant">"\n"</span><span class="Delimiter">);</span> <span id="L622" class="LineNr">622 </span> vector<trace_line> result<span class="Delimiter">;</span> <span id="L623" class="LineNr">623 </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#L141'>SIZE</a><span class="Delimiter">(</span>buf<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L624" class="LineNr">624 </span> buf<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)</span> = <a href='003trace.cc.html#L394'>trim</a><span class="Delimiter">(</span>buf<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span id="L625" class="LineNr">625 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>buf<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>empty<span class="Delimiter">())</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L626" class="LineNr">626 </span> <span class="Normal">int</span> delim = buf<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>find<span class="Delimiter">(</span><span class="Constant">": "</span><span class="Delimiter">);</span> <span id="L627" class="LineNr">627 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>delim == -<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L628" class="LineNr">628 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"lines in 'trace-should-contain' should be of the form <label>: <contents>. Both parts are required.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L628" class="LineNr">628 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"lines in 'trace-should-contain' should be of the form <label>: <contents>. Both parts are required.\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L629" class="LineNr">629 </span> result<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L630" class="LineNr">630 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L631" class="LineNr">631 </span> <span class="Delimiter">}</span> @@ -747,14 +750,14 @@ if ('onhashchange' in window) { <span id="L681" class="LineNr">681 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L682" class="LineNr">682 </span>TRACE_SHOULD_NOT_CONTAIN<span class="Delimiter">,</span> <span id="L683" class="LineNr">683 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L684" class="LineNr">684 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"trace-should-not-contain"</span><span class="Delimiter">,</span> TRACE_SHOULD_NOT_CONTAIN<span class="Delimiter">);</span> +<span id="L684" class="LineNr">684 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"trace-should-not-contain"</span><span class="Delimiter">,</span> TRACE_SHOULD_NOT_CONTAIN<span class="Delimiter">);</span> <span id="L685" class="LineNr">685 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L686" class="LineNr">686 </span><span class="Normal">case</span> TRACE_SHOULD_NOT_CONTAIN: <span class="Delimiter">{</span> <span id="L687" class="LineNr">687 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L688" class="LineNr">688 </span><span class="Delimiter">}</span> <span id="L689" class="LineNr">689 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L690" class="LineNr">690 </span><span class="Normal">case</span> TRACE_SHOULD_NOT_CONTAIN: <span class="Delimiter">{</span> -<span id="L691" class="LineNr">691 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Passed<span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L691" class="LineNr">691 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Passed</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L692" class="LineNr">692 </span> check_trace_missing<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name<span class="Delimiter">);</span> <span id="L693" class="LineNr">693 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L694" class="LineNr">694 </span><span class="Delimiter">}</span> @@ -763,12 +766,12 @@ if ('onhashchange' in window) { <span id="L697" class="LineNr">697 </span><span class="Comment">// simplified version of check_trace_contents() that emits errors rather</span> <span id="L698" class="LineNr">698 </span><span class="Comment">// than just printing to stderr</span> <span id="L699" class="LineNr">699 </span><span class="Normal">bool</span> check_trace_missing<span class="Delimiter">(</span><span class="Normal">const</span> string& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L700" class="LineNr">700 </span> Trace_stream<span class="Delimiter">-></span><a href='003trace.cc.html#L147'>newline</a><span class="Delimiter">();</span> +<span id="L700" class="LineNr">700 </span> <span class="Special">Trace_stream</span><span class="Delimiter">-></span><a href='003trace.cc.html#L147'>newline</a><span class="Delimiter">();</span> <span id="L701" class="LineNr">701 </span> vector<trace_line> lines = parse_trace<span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L702" class="LineNr">702 </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#L141'>SIZE</a><span class="Delimiter">(</span>lines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L703" class="LineNr">703 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>trace_count<span class="Delimiter">(</span>lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>label<span class="Delimiter">,</span> lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>contents<span class="Delimiter">)</span> != <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L704" class="LineNr">704 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"unexpected ["</span> << lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>contents << <span class="Constant">"] in <a href='003trace.cc.html#L189'>trace</a> with label '"</span> << lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>label << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L705" class="LineNr">705 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L704" class="LineNr">704 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"unexpected ["</span> << lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>contents << <span class="Constant">"] in <a href='003trace.cc.html#L189'>trace</a> with label '"</span> << lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>label << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L705" class="LineNr">705 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Scenario_testing_scenario</span><span class="Delimiter">)</span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L706" class="LineNr">706 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L707" class="LineNr">707 </span> <span class="Delimiter">}</span> <span id="L708" class="LineNr">708 </span> <span class="Delimiter">}</span> @@ -811,34 +814,34 @@ if ('onhashchange' in window) { <span id="L745" class="LineNr">745 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L746" class="LineNr">746 </span>CHECK_TRACE_COUNT_FOR_LABEL<span class="Delimiter">,</span> <span id="L747" class="LineNr">747 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L748" class="LineNr">748 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"check-trace-count-for-label"</span><span class="Delimiter">,</span> CHECK_TRACE_COUNT_FOR_LABEL<span class="Delimiter">);</span> +<span id="L748" class="LineNr">748 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"check-trace-count-for-label"</span><span class="Delimiter">,</span> CHECK_TRACE_COUNT_FOR_LABEL<span class="Delimiter">);</span> <span id="L749" class="LineNr">749 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L750" class="LineNr">750 </span><span class="Normal">case</span> CHECK_TRACE_COUNT_FOR_LABEL: <span class="Delimiter">{</span> <span id="L751" class="LineNr">751 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L752" class="LineNr">752 </span> <a href='003trace.cc.html#L196'>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">"'check-trace-count-for-label' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L752" class="LineNr">752 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'check-trace-count-for-label' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L753" class="LineNr">753 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L754" class="LineNr">754 </span> <span class="Delimiter">}</span> <span id="L755" class="LineNr">755 </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="L756" class="LineNr">756 </span> <a href='003trace.cc.html#L196'>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 'check-trace-count-for-label' should be a number (count), 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L756" class="LineNr">756 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'check-trace-count-for-label' should be a number (count), 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L757" class="LineNr">757 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L758" class="LineNr">758 </span> <span class="Delimiter">}</span> <span id="L759" class="LineNr">759 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal_text<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="L760" class="LineNr">760 </span> <a href='003trace.cc.html#L196'>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 'check-trace-count-for-label' should be a literal string (label), 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L760" class="LineNr">760 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second ingredient of 'check-trace-count-for-label' should be a literal string (label), 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L761" class="LineNr">761 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L762" class="LineNr">762 </span> <span class="Delimiter">}</span> <span id="L763" class="LineNr">763 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L764" class="LineNr">764 </span><span class="Delimiter">}</span> <span id="L765" class="LineNr">765 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L766" class="LineNr">766 </span><span class="Normal">case</span> CHECK_TRACE_COUNT_FOR_LABEL: <span class="Delimiter">{</span> -<span id="L767" class="LineNr">767 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Passed<span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L767" class="LineNr">767 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Passed</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L768" class="LineNr">768 </span> <span class="Normal">int</span> expected_count = 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="L769" class="LineNr">769 </span> string label = <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name<span class="Delimiter">;</span> <span id="L770" class="LineNr">770 </span> <span class="Normal">int</span> count = trace_count<span class="Delimiter">(</span>label<span class="Delimiter">);</span> <span id="L771" class="LineNr">771 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>count != expected_count<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L772" class="LineNr">772 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L773" class="LineNr">773 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected "</span> << expected_count << <span class="Constant">" lines in <a href='003trace.cc.html#L189'>trace</a> with label '"</span> << label << <span class="Constant">"' in <a href='003trace.cc.html#L189'>trace</a></span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L774" class="LineNr">774 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> <a href='003trace.cc.html#L193'>DUMP</a><span class="Delimiter">(</span>label<span class="Delimiter">);</span> -<span id="L775" class="LineNr">775 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L772" class="LineNr">772 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L773" class="LineNr">773 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected "</span> << expected_count << <span class="Constant">" lines in <a href='003trace.cc.html#L189'>trace</a> with label '"</span> << label << <span class="Constant">"' in trace\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L774" class="LineNr">774 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> <a href='003trace.cc.html#L193'>DUMP</a><span class="Delimiter">(</span>label<span class="Delimiter">);</span> +<span id="L775" class="LineNr">775 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Scenario_testing_scenario</span><span class="Delimiter">)</span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L776" class="LineNr">776 </span> <span class="Delimiter">}</span> <span id="L777" class="LineNr">777 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L778" class="LineNr">778 </span><span class="Delimiter">}</span> @@ -846,37 +849,37 @@ if ('onhashchange' in window) { <span id="L780" class="LineNr">780 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L781" class="LineNr">781 </span>CHECK_TRACE_COUNT_FOR_LABEL_GREATER_THAN<span class="Delimiter">,</span> <span id="L782" class="LineNr">782 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L783" class="LineNr">783 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"check-trace-count-for-label-greater-than"</span><span class="Delimiter">,</span> CHECK_TRACE_COUNT_FOR_LABEL_GREATER_THAN<span class="Delimiter">);</span> +<span id="L783" class="LineNr">783 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"check-trace-count-for-label-greater-than"</span><span class="Delimiter">,</span> CHECK_TRACE_COUNT_FOR_LABEL_GREATER_THAN<span class="Delimiter">);</span> <span id="L784" class="LineNr">784 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L785" class="LineNr">785 </span><span class="Normal">case</span> CHECK_TRACE_COUNT_FOR_LABEL_GREATER_THAN: <span class="Delimiter">{</span> <span id="L786" class="LineNr">786 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L787" class="LineNr">787 </span> <a href='003trace.cc.html#L196'>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">"'check-trace-count-for-label' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L787" class="LineNr">787 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'check-trace-count-for-label' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L788" class="LineNr">788 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L789" class="LineNr">789 </span> <span class="Delimiter">}</span> <span id="L790" class="LineNr">790 </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="L791" class="LineNr">791 </span> <a href='003trace.cc.html#L196'>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 'check-trace-count-for-label' should be a number (count), 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L791" class="LineNr">791 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'check-trace-count-for-label' should be a number (count), 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L792" class="LineNr">792 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L793" class="LineNr">793 </span> <span class="Delimiter">}</span> <span id="L794" class="LineNr">794 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal_text<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="L795" class="LineNr">795 </span> <a href='003trace.cc.html#L196'>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 'check-trace-count-for-label' should be a literal string (label), 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L795" class="LineNr">795 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second ingredient of 'check-trace-count-for-label' should be a literal string (label), 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L796" class="LineNr">796 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L797" class="LineNr">797 </span> <span class="Delimiter">}</span> <span id="L798" class="LineNr">798 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L799" class="LineNr">799 </span><span class="Delimiter">}</span> <span id="L800" class="LineNr">800 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L801" class="LineNr">801 </span><span class="Normal">case</span> CHECK_TRACE_COUNT_FOR_LABEL_GREATER_THAN: <span class="Delimiter">{</span> -<span id="L802" class="LineNr">802 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Passed<span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L802" class="LineNr">802 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Passed</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L803" class="LineNr">803 </span> <span class="Normal">int</span> expected_count = 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="L804" class="LineNr">804 </span> string label = <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name<span class="Delimiter">;</span> <span id="L805" class="LineNr">805 </span> <span class="Normal">int</span> count = trace_count<span class="Delimiter">(</span>label<span class="Delimiter">);</span> <span id="L806" class="LineNr">806 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>count <= expected_count<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L807" class="LineNr">807 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L808" class="LineNr">808 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected more than "</span> << expected_count << <span class="Constant">" lines in <a href='003trace.cc.html#L189'>trace</a> with label '"</span> << label << <span class="Constant">"' in <a href='003trace.cc.html#L189'>trace</a></span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L809" class="LineNr">809 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L810" class="LineNr">810 </span> cerr << <span class="Constant">"trace contents:</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L807" class="LineNr">807 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L808" class="LineNr">808 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected more than "</span> << expected_count << <span class="Constant">" lines in <a href='003trace.cc.html#L189'>trace</a> with label '"</span> << label << <span class="Constant">"' in trace\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L809" class="LineNr">809 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L810" class="LineNr">810 </span> cerr << <span class="Constant">"trace contents:\n"</span><span class="Delimiter">;</span> <span id="L811" class="LineNr">811 </span> <a href='003trace.cc.html#L193'>DUMP</a><span class="Delimiter">(</span>label<span class="Delimiter">);</span> <span id="L812" class="LineNr">812 </span> <span class="Delimiter">}</span> -<span id="L813" class="LineNr">813 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L813" class="LineNr">813 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Scenario_testing_scenario</span><span class="Delimiter">)</span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L814" class="LineNr">814 </span> <span class="Delimiter">}</span> <span id="L815" class="LineNr">815 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L816" class="LineNr">816 </span><span class="Delimiter">}</span> @@ -884,37 +887,37 @@ if ('onhashchange' in window) { <span id="L818" class="LineNr">818 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L819" class="LineNr">819 </span>CHECK_TRACE_COUNT_FOR_LABEL_LESSER_THAN<span class="Delimiter">,</span> <span id="L820" class="LineNr">820 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L821" class="LineNr">821 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"check-trace-count-for-label-lesser-than"</span><span class="Delimiter">,</span> CHECK_TRACE_COUNT_FOR_LABEL_LESSER_THAN<span class="Delimiter">);</span> +<span id="L821" class="LineNr">821 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"check-trace-count-for-label-lesser-than"</span><span class="Delimiter">,</span> CHECK_TRACE_COUNT_FOR_LABEL_LESSER_THAN<span class="Delimiter">);</span> <span id="L822" class="LineNr">822 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L823" class="LineNr">823 </span><span class="Normal">case</span> CHECK_TRACE_COUNT_FOR_LABEL_LESSER_THAN: <span class="Delimiter">{</span> <span id="L824" class="LineNr">824 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L825" class="LineNr">825 </span> <a href='003trace.cc.html#L196'>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">"'check-trace-count-for-label' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L825" class="LineNr">825 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'check-trace-count-for-label' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L826" class="LineNr">826 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L827" class="LineNr">827 </span> <span class="Delimiter">}</span> <span id="L828" class="LineNr">828 </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="L829" class="LineNr">829 </span> <a href='003trace.cc.html#L196'>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 'check-trace-count-for-label' should be a number (count), 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L829" class="LineNr">829 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'check-trace-count-for-label' should be a number (count), 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L830" class="LineNr">830 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L831" class="LineNr">831 </span> <span class="Delimiter">}</span> <span id="L832" class="LineNr">832 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal_text<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="L833" class="LineNr">833 </span> <a href='003trace.cc.html#L196'>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 'check-trace-count-for-label' should be a literal string (label), 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L833" class="LineNr">833 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second ingredient of 'check-trace-count-for-label' should be a literal string (label), 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L834" class="LineNr">834 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L835" class="LineNr">835 </span> <span class="Delimiter">}</span> <span id="L836" class="LineNr">836 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L837" class="LineNr">837 </span><span class="Delimiter">}</span> <span id="L838" class="LineNr">838 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L839" class="LineNr">839 </span><span class="Normal">case</span> CHECK_TRACE_COUNT_FOR_LABEL_LESSER_THAN: <span class="Delimiter">{</span> -<span id="L840" class="LineNr">840 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Passed<span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L840" class="LineNr">840 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Passed</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L841" class="LineNr">841 </span> <span class="Normal">int</span> expected_count = 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="L842" class="LineNr">842 </span> string label = <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name<span class="Delimiter">;</span> <span id="L843" class="LineNr">843 </span> <span class="Normal">int</span> count = trace_count<span class="Delimiter">(</span>label<span class="Delimiter">);</span> <span id="L844" class="LineNr">844 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>count >= expected_count<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L845" class="LineNr">845 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L846" class="LineNr">846 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected less than "</span> << expected_count << <span class="Constant">" lines in <a href='003trace.cc.html#L189'>trace</a> with label '"</span> << label << <span class="Constant">"' in <a href='003trace.cc.html#L189'>trace</a></span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L847" class="LineNr">847 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L848" class="LineNr">848 </span> cerr << <span class="Constant">"trace contents:</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L845" class="LineNr">845 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L846" class="LineNr">846 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected less than "</span> << expected_count << <span class="Constant">" lines in <a href='003trace.cc.html#L189'>trace</a> with label '"</span> << label << <span class="Constant">"' in trace\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L847" class="LineNr">847 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L848" class="LineNr">848 </span> cerr << <span class="Constant">"trace contents:\n"</span><span class="Delimiter">;</span> <span id="L849" class="LineNr">849 </span> <a href='003trace.cc.html#L193'>DUMP</a><span class="Delimiter">(</span>label<span class="Delimiter">);</span> <span id="L850" class="LineNr">850 </span> <span class="Delimiter">}</span> -<span id="L851" class="LineNr">851 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L851" class="LineNr">851 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Scenario_testing_scenario</span><span class="Delimiter">)</span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L852" class="LineNr">852 </span> <span class="Delimiter">}</span> <span id="L853" class="LineNr">853 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L854" class="LineNr">854 </span><span class="Delimiter">}</span> @@ -933,7 +936,7 @@ if ('onhashchange' in window) { <span id="L867" class="LineNr">867 </span><span class="Comment">//: Minor detail: ignore 'system' calls in scenarios, since anything we do</span> <span id="L868" class="LineNr">868 </span><span class="Comment">//: with them is by definition impossible to test through Mu.</span> <span id="L869" class="LineNr">869 </span><span class="Delimiter">:(after "case _SYSTEM:")</span> -<span id="L870" class="LineNr">870 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Current_scenario<span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L870" class="LineNr">870 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Current_scenario</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L871" class="LineNr">871 </span> <span id="L872" class="LineNr">872 </span><span class="SalientComment">//:: Warn if people use '_' manually in recipe names. They're reserved for internal use.</span> <span id="L873" class="LineNr">873 </span> @@ -949,15 +952,15 @@ if ('onhashchange' in window) { <span id="L883" class="LineNr">883 </span>is_autogenerated =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L884" class="LineNr">884 </span><span class="Delimiter">:(code)</span> <span id="L885" class="LineNr">885 </span><span class="Normal">void</span> mark_autogenerated<span class="Delimiter">(</span><a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L886" class="LineNr">886 </span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>is_autogenerated =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L886" class="LineNr">886 </span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>is_autogenerated =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L887" class="LineNr">887 </span><span class="Delimiter">}</span> <span id="L888" class="LineNr">888 </span> <span id="L889" class="LineNr">889 </span><span class="Delimiter">:(after "void transform_all()")</span> -<span id="L890" class="LineNr">890 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<recipe_ordinal<span class="Delimiter">,</span> recipe>::iterator p = Recipe<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Recipe<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L890" class="LineNr">890 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<recipe_ordinal<span class="Delimiter">,</span> recipe>::iterator p = <span class="Special">Recipe</span><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Recipe</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L891" class="LineNr">891 </span> <span class="Normal">const</span> recipe& r = p<span class="Delimiter">-></span>second<span class="Delimiter">;</span> <span id="L892" class="LineNr">892 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>r<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">'_'</span><span class="Delimiter">)</span> == string::npos<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L893" class="LineNr">893 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>r<span class="Delimiter">.</span>is_autogenerated<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// created by previous call to transform_all()</span> -<span id="L894" class="LineNr">894 </span> <a href='003trace.cc.html#L196'>raise</a> << r<span class="Delimiter">.</span>name << <span class="Constant">": don't create recipes with '_' in the name</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L894" class="LineNr">894 </span> <a href='003trace.cc.html#L196'>raise</a> << r<span class="Delimiter">.</span>name << <span class="Constant">": don't create recipes with '_' in the name\n"</span> << end<span class="Delimiter">();</span> <span id="L895" class="LineNr">895 </span> <span class="Delimiter">}</span> <span id="L896" class="LineNr">896 </span> <span id="L897" class="LineNr">897 </span><span class="SalientComment">//:: Helpers</span> @@ -965,14 +968,14 @@ if ('onhashchange' in window) { <span id="L899" class="LineNr">899 </span><span class="Delimiter">:(code)</span> <span id="L900" class="LineNr">900 </span><span class="Comment">// just for the scenarios running scenarios in C++ layers</span> <span id="L901" class="LineNr">901 </span><span class="Normal">void</span> run_mu_scenario<span class="Delimiter">(</span><span class="Normal">const</span> string& form<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L902" class="LineNr">902 </span> Scenario_names<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L902" class="LineNr">902 </span> <span class="Special">Scenario_names</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L903" class="LineNr">903 </span> istringstream in<span class="Delimiter">(</span>form<span class="Delimiter">);</span> <span id="L904" class="LineNr">904 </span> in >> std::noskipws<span class="Delimiter">;</span> <span id="L905" class="LineNr">905 </span> <a href='011load.cc.html#L211'>skip_whitespace_and_comments</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L906" class="LineNr">906 </span> string _scenario = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L907" class="LineNr">907 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>_scenario<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L908" class="LineNr">908 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L909" class="LineNr">909 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"no <a href='050scenario.cc.html#L57'>scenario</a> in string passed into run_mu_scenario()</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L909" class="LineNr">909 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"no <a href='050scenario.cc.html#L57'>scenario</a> in string passed into run_mu_scenario()\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L910" class="LineNr">910 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L911" class="LineNr">911 </span> <span class="Delimiter">}</span> <span id="L912" class="LineNr">912 </span> assert<span class="Delimiter">(</span>_scenario == <span class="Constant">"scenario"</span><span class="Delimiter">);</span> diff --git a/html/051scenario_test.mu.html b/html/051scenario_test.mu.html index 744b4554..0503e8a3 100644 --- a/html/051scenario_test.mu.html +++ b/html/051scenario_test.mu.html @@ -11,16 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -54,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/051scenario_test.mu'>https://github.com/akkartik/mu/blob/master/051scenario_test.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># tests for 'scenario' in previous layer</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/052tangle.cc.html b/html/052tangle.cc.html index 54968c93..ab68c1f3 100644 --- a/html/052tangle.cc.html +++ b/html/052tangle.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .traceAbsent { color: #c00000; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/052tangle.cc'>https://github.com/akkartik/mu/blob/master/052tangle.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Allow code for recipes to be pulled in from multiple places and inserted</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: at special labels called 'waypoints' using two new top-level commands:</span> @@ -95,25 +98,25 @@ if ('onhashchange' in window) { <span id="L32" class="LineNr"> 32 </span><span class="Comment">//: while loading recipes, load before/after fragments</span> <span id="L33" class="LineNr"> 33 </span> <span id="L34" class="LineNr"> 34 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L35" class="LineNr"> 35 </span>map<string <span class="Comment">/*</span><span class="Comment">label</span><span class="Comment">*/</span><span class="Delimiter">,</span> recipe> Before_fragments<span class="Delimiter">,</span> After_fragments<span class="Delimiter">;</span> -<span id="L36" class="LineNr"> 36 </span>set<string <span class="Comment">/*</span><span class="Comment">label</span><span class="Comment">*/</span>> Fragments_used<span class="Delimiter">;</span> +<span id="L35" class="LineNr"> 35 </span>map<string <span class="Comment">/*</span><span class="Comment">label</span><span class="Comment">*/</span><span class="Delimiter">,</span> recipe> <span class="Special">Before_fragments</span><span class="Delimiter">,</span> <span class="Special">After_fragments</span><span class="Delimiter">;</span> +<span id="L36" class="LineNr"> 36 </span>set<string <span class="Comment">/*</span><span class="Comment">label</span><span class="Comment">*/</span>> <span class="Special">Fragments_used</span><span class="Delimiter">;</span> <span id="L37" class="LineNr"> 37 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L38" class="LineNr"> 38 </span>Before_fragments<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L39" class="LineNr"> 39 </span>After_fragments<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L40" class="LineNr"> 40 </span>Fragments_used<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L38" class="LineNr"> 38 </span><span class="Special">Before_fragments</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L39" class="LineNr"> 39 </span><span class="Special">After_fragments</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L40" class="LineNr"> 40 </span><span class="Special">Fragments_used</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L41" class="LineNr"> 41 </span> <span id="L42" class="LineNr"> 42 </span><span class="Delimiter">:(before "End Command Handlers")</span> <span id="L43" class="LineNr"> 43 </span><span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>command == <span class="Constant">"before"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L44" class="LineNr"> 44 </span> string label = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L45" class="LineNr"> 45 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>label<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L46" class="LineNr"> 46 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L47" class="LineNr"> 47 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'before' block at <a href='003trace.cc.html#L225'>end</a> of file</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L47" class="LineNr"> 47 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'before' block at <a href='003trace.cc.html#L225'>end</a> of file\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L48" class="LineNr"> 48 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L49" class="LineNr"> 49 </span> <span class="Delimiter">}</span> <span id="L50" class="LineNr"> 50 </span> <a href='010vm.cc.html#L19'>recipe</a> tmp<span class="Delimiter">;</span> <span id="L51" class="LineNr"> 51 </span> <a href='011load.cc.html#L83'>slurp_body</a><span class="Delimiter">(</span>in<span class="Delimiter">,</span> tmp<span class="Delimiter">);</span> <span id="L52" class="LineNr"> 52 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='052tangle.cc.html#L13'>is_waypoint</a><span class="Delimiter">(</span>label<span class="Delimiter">))</span> -<span id="L53" class="LineNr"> 53 </span> Before_fragments[label]<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>Before_fragments[label]<span class="Delimiter">.</span>steps<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">(),</span> tmp<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> tmp<span class="Delimiter">.</span>steps<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">());</span> +<span id="L53" class="LineNr"> 53 </span> <span class="Special">Before_fragments</span>[label]<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>insert<span class="Delimiter">(</span><span class="Special">Before_fragments</span>[label]<span class="Delimiter">.</span>steps<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">(),</span> tmp<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> tmp<span class="Delimiter">.</span>steps<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">());</span> <span id="L54" class="LineNr"> 54 </span> <span class="Normal">else</span> <span id="L55" class="LineNr"> 55 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"can't tangle before non-waypoint "</span> << label << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span id="L56" class="LineNr"> 56 </span> <span class="Comment">// End before Command Handler</span> @@ -122,13 +125,13 @@ if ('onhashchange' in window) { <span id="L59" class="LineNr"> 59 </span> string label = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L60" class="LineNr"> 60 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>label<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L61" class="LineNr"> 61 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L62" class="LineNr"> 62 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'after' block at <a href='003trace.cc.html#L225'>end</a> of file</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L62" class="LineNr"> 62 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'after' block at <a href='003trace.cc.html#L225'>end</a> of file\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L63" class="LineNr"> 63 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L64" class="LineNr"> 64 </span> <span class="Delimiter">}</span> <span id="L65" class="LineNr"> 65 </span> <a href='010vm.cc.html#L19'>recipe</a> tmp<span class="Delimiter">;</span> <span id="L66" class="LineNr"> 66 </span> <a href='011load.cc.html#L83'>slurp_body</a><span class="Delimiter">(</span>in<span class="Delimiter">,</span> tmp<span class="Delimiter">);</span> <span id="L67" class="LineNr"> 67 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='052tangle.cc.html#L13'>is_waypoint</a><span class="Delimiter">(</span>label<span class="Delimiter">))</span> -<span id="L68" class="LineNr"> 68 </span> After_fragments[label]<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>After_fragments[label]<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> tmp<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> tmp<span class="Delimiter">.</span>steps<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">());</span> +<span id="L68" class="LineNr"> 68 </span> <span class="Special">After_fragments</span>[label]<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>insert<span class="Delimiter">(</span><span class="Special">After_fragments</span>[label]<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> tmp<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> tmp<span class="Delimiter">.</span>steps<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">());</span> <span id="L69" class="LineNr"> 69 </span> <span class="Normal">else</span> <span id="L70" class="LineNr"> 70 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"can't tangle after non-waypoint "</span> << label << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span id="L71" class="LineNr"> 71 </span> <span class="Comment">// End after Command Handler</span> @@ -137,7 +140,7 @@ if ('onhashchange' in window) { <span id="L74" class="LineNr"> 74 </span><span class="Comment">//: after all recipes are loaded, insert fragments at appropriate labels.</span> <span id="L75" class="LineNr"> 75 </span> <span id="L76" class="LineNr"> 76 </span><span class="Delimiter">:(after "Begin Instruction Inserting/Deleting Transforms")</span> -<span id="L77" class="LineNr"> 77 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>insert_fragments<span class="Delimiter">);</span> <span class="Comment">// NOT idempotent</span> +<span id="L77" class="LineNr"> 77 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>insert_fragments<span class="Delimiter">);</span> <span class="Comment">// NOT idempotent</span> <span id="L78" class="LineNr"> 78 </span> <span id="L79" class="LineNr"> 79 </span><span class="Comment">//: We might need to perform multiple passes, in case inserted fragments</span> <span id="L80" class="LineNr"> 80 </span><span class="Comment">//: include more labels that need further insertions. Track which labels we've</span> @@ -149,7 +152,7 @@ if ('onhashchange' in window) { <span id="L86" class="LineNr"> 86 </span> <span id="L87" class="LineNr"> 87 </span><span class="Delimiter">:(code)</span> <span id="L88" class="LineNr"> 88 </span><span class="Normal">void</span> insert_fragments<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="L89" class="LineNr"> 89 </span> insert_fragments<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">));</span> +<span id="L89" class="LineNr"> 89 </span> insert_fragments<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">));</span> <span id="L90" class="LineNr"> 90 </span><span class="Delimiter">}</span> <span id="L91" class="LineNr"> 91 </span> <span id="L92" class="LineNr"> 92 </span><span class="Normal">void</span> insert_fragments<span class="Delimiter">(</span>recipe& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -168,19 +171,19 @@ if ('onhashchange' in window) { <span id="L105" class="LineNr">105 </span> <span class="Delimiter">}</span> <span id="L106" class="LineNr">106 </span> inst<span class="Delimiter">.</span>tangle_done =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L107" class="LineNr">107 </span> made_progress =<span class="Constant"> true</span><span class="Delimiter">;</span> -<span id="L108" class="LineNr">108 </span> Fragments_used<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>label<span class="Delimiter">);</span> +<span id="L108" class="LineNr">108 </span> <span class="Special">Fragments_used</span><span class="Delimiter">.</span>insert<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>label<span class="Delimiter">);</span> <span id="L109" class="LineNr">109 </span> ostringstream prefix<span class="Delimiter">;</span> <span id="L110" class="LineNr">110 </span> prefix << <span class="Constant">'+'</span> << r<span class="Delimiter">.</span>name << <span class="Constant">'_'</span> << pass << <span class="Constant">'_'</span> << i<span class="Delimiter">;</span> <span id="L111" class="LineNr">111 </span> <span class="Comment">// ok to use contains_key even though Before_fragments uses [],</span> <span id="L112" class="LineNr">112 </span> <span class="Comment">// because appending an empty recipe is a noop</span> -<span id="L113" class="LineNr">113 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Before_fragments<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>label<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L113" class="LineNr">113 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Before_fragments</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>label<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L114" class="LineNr">114 </span> <a href='003trace.cc.html#L189'>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">"insert fragments before label "</span> << inst<span class="Delimiter">.</span>label << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L115" class="LineNr">115 </span> <a href='052tangle.cc.html#L128'>append_fragment</a><span class="Delimiter">(</span>result<span class="Delimiter">,</span> Before_fragments[inst<span class="Delimiter">.</span>label]<span class="Delimiter">.</span>steps<span class="Delimiter">,</span> prefix<span class="Delimiter">.</span>str<span class="Delimiter">());</span> +<span id="L115" class="LineNr">115 </span> <a href='052tangle.cc.html#L128'>append_fragment</a><span class="Delimiter">(</span>result<span class="Delimiter">,</span> <span class="Special">Before_fragments</span>[inst<span class="Delimiter">.</span>label]<span class="Delimiter">.</span>steps<span class="Delimiter">,</span> prefix<span class="Delimiter">.</span>str<span class="Delimiter">());</span> <span id="L116" class="LineNr">116 </span> <span class="Delimiter">}</span> <span id="L117" class="LineNr">117 </span> result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>inst<span class="Delimiter">);</span> -<span id="L118" class="LineNr">118 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>After_fragments<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>label<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L118" class="LineNr">118 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">After_fragments</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>label<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L119" class="LineNr">119 </span> <a href='003trace.cc.html#L189'>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">"insert fragments after label "</span> << inst<span class="Delimiter">.</span>label << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L120" class="LineNr">120 </span> <a href='052tangle.cc.html#L128'>append_fragment</a><span class="Delimiter">(</span>result<span class="Delimiter">,</span> After_fragments[inst<span class="Delimiter">.</span>label]<span class="Delimiter">.</span>steps<span class="Delimiter">,</span> prefix<span class="Delimiter">.</span>str<span class="Delimiter">());</span> +<span id="L120" class="LineNr">120 </span> <a href='052tangle.cc.html#L128'>append_fragment</a><span class="Delimiter">(</span>result<span class="Delimiter">,</span> <span class="Special">After_fragments</span>[inst<span class="Delimiter">.</span>label]<span class="Delimiter">.</span>steps<span class="Delimiter">,</span> prefix<span class="Delimiter">.</span>str<span class="Delimiter">());</span> <span id="L121" class="LineNr">121 </span> <span class="Delimiter">}</span> <span id="L122" class="LineNr">122 </span> <span class="Delimiter">}</span> <span id="L123" class="LineNr">123 </span> r<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>swap<span class="Delimiter">(</span>result<span class="Delimiter">);</span> @@ -228,12 +231,12 @@ if ('onhashchange' in window) { <span id="L165" class="LineNr">165 </span><a href='052tangle.cc.html#L167'>check_insert_fragments</a><span class="Delimiter">();</span> <span id="L166" class="LineNr">166 </span><span class="Delimiter">:(code)</span> <span id="L167" class="LineNr">167 </span><span class="Normal">void</span> <a href='052tangle.cc.html#L167'>check_insert_fragments</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L168" class="LineNr">168 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<string<span class="Delimiter">,</span> recipe>::iterator p = Before_fragments<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Before_fragments<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L169" class="LineNr">169 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Fragments_used<span class="Delimiter">,</span> p<span class="Delimiter">-></span>first<span class="Delimiter">))</span> +<span id="L168" class="LineNr">168 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<string<span class="Delimiter">,</span> recipe>::iterator p = <span class="Special">Before_fragments</span><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Before_fragments</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L169" class="LineNr">169 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Fragments_used</span><span class="Delimiter">,</span> p<span class="Delimiter">-></span>first<span class="Delimiter">))</span> <span id="L170" class="LineNr">170 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"could not locate insert before label "</span> << p<span class="Delimiter">-></span>first << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L171" class="LineNr">171 </span> <span class="Delimiter">}</span> -<span id="L172" class="LineNr">172 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<string<span class="Delimiter">,</span> recipe>::iterator p = After_fragments<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != After_fragments<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L173" class="LineNr">173 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Fragments_used<span class="Delimiter">,</span> p<span class="Delimiter">-></span>first<span class="Delimiter">))</span> +<span id="L172" class="LineNr">172 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<string<span class="Delimiter">,</span> recipe>::iterator p = <span class="Special">After_fragments</span><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">After_fragments</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L173" class="LineNr">173 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Fragments_used</span><span class="Delimiter">,</span> p<span class="Delimiter">-></span>first<span class="Delimiter">))</span> <span id="L174" class="LineNr">174 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"could not locate insert after label "</span> << p<span class="Delimiter">-></span>first << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L175" class="LineNr">175 </span> <span class="Delimiter">}</span> <span id="L176" class="LineNr">176 </span><span class="Delimiter">}</span> @@ -507,29 +510,29 @@ if ('onhashchange' in window) { <span id="L444" class="LineNr">444 </span><span class="Delimiter">:(code)</span> <span id="L445" class="LineNr">445 </span><span class="Normal">void</span> <a href='052tangle.cc.html#L445'>test_new_fragment_after_tangle</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> <span id="L446" class="LineNr">446 </span> <span class="Comment">// define a recipe</span> -<span id="L447" class="LineNr">447 </span> load<span class="Delimiter">(</span><span class="Constant">"def foo [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L448" class="LineNr">448 </span> <span class="Constant">" local-scope</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L449" class="LineNr">449 </span> <span class="Constant">" <label></span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L450" class="LineNr">450 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L451" class="LineNr">451 </span> <span class="Constant">"after <label> [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L452" class="LineNr">452 </span> <span class="Constant">" 1:num/raw <- copy 34</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L453" class="LineNr">453 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L447" class="LineNr">447 </span> load<span class="Delimiter">(</span><span class="Constant">"def foo [\n"</span> +<span id="L448" class="LineNr">448 </span> <span class="Constant">" local-scope\n"</span> +<span id="L449" class="LineNr">449 </span> <span class="Constant">" <label>\n"</span> +<span id="L450" class="LineNr">450 </span> <span class="Constant">"]\n"</span> +<span id="L451" class="LineNr">451 </span> <span class="Constant">"after <label> [\n"</span> +<span id="L452" class="LineNr">452 </span> <span class="Constant">" 1:num/raw <- copy 34\n"</span> +<span id="L453" class="LineNr">453 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L454" class="LineNr">454 </span> <a href='012transform.cc.html#L46'>transform_all</a><span class="Delimiter">();</span> <span id="L455" class="LineNr">455 </span> <a href='003trace.cc.html#L256'>CHECK_TRACE_DOESNT_CONTAIN_ERRORS</a><span class="Delimiter">();</span> -<span id="L456" class="LineNr">456 </span> Hide_errors =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L456" class="LineNr">456 </span> <span class="Special">Hide_errors</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L457" class="LineNr">457 </span> <span class="Comment">// try to tangle into recipe foo after transform</span> -<span id="L458" class="LineNr">458 </span> load<span class="Delimiter">(</span><span class="Constant">"before <label> [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L459" class="LineNr">459 </span> <span class="Constant">" 2:num/raw <- copy 35</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L460" class="LineNr">460 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L458" class="LineNr">458 </span> load<span class="Delimiter">(</span><span class="Constant">"before <label> [\n"</span> +<span id="L459" class="LineNr">459 </span> <span class="Constant">" 2:num/raw <- copy 35\n"</span> +<span id="L460" class="LineNr">460 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L461" class="LineNr">461 </span> <a href='003trace.cc.html#L255'>CHECK_TRACE_CONTAINS_ERRORS</a><span class="Delimiter">();</span> <span id="L462" class="LineNr">462 </span><span class="Delimiter">}</span> <span id="L463" class="LineNr">463 </span> <span id="L464" class="LineNr">464 </span><span class="Delimiter">:(before "End before Command Handler")</span> -<span id="L465" class="LineNr">465 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Fragments_used<span class="Delimiter">,</span> label<span class="Delimiter">))</span> -<span id="L466" class="LineNr">466 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"we've already tangled some code at label "</span> << label << <span class="Constant">" in a previous call to transform_all(). Those locations won't be updated.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L465" class="LineNr">465 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Fragments_used</span><span class="Delimiter">,</span> label<span class="Delimiter">))</span> +<span id="L466" class="LineNr">466 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"we've already tangled some code at label "</span> << label << <span class="Constant">" in a previous call to transform_all(). Those locations won't be updated.\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L467" class="LineNr">467 </span><span class="Delimiter">:(before "End after Command Handler")</span> -<span id="L468" class="LineNr">468 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Fragments_used<span class="Delimiter">,</span> label<span class="Delimiter">))</span> -<span id="L469" class="LineNr">469 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"we've already tangled some code at label "</span> << label << <span class="Constant">" in a previous call to transform_all(). Those locations won't be updated.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L468" class="LineNr">468 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Fragments_used</span><span class="Delimiter">,</span> label<span class="Delimiter">))</span> +<span id="L469" class="LineNr">469 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"we've already tangled some code at label "</span> << label << <span class="Constant">" in a previous call to transform_all(). Those locations won't be updated.\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> </pre> </body> </html> diff --git a/html/053recipe_header.cc.html b/html/053recipe_header.cc.html index e7a2cff7..79c0dc60 100644 --- a/html/053recipe_header.cc.html +++ b/html/053recipe_header.cc.html @@ -11,23 +11,25 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } .SalientComment { color: #00ffff; } .traceAbsent { color: #c00000; } .muRecipe { color: #ff8700; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Error { color: #ffffff; background-color: #ff6060; padding-bottom: 1px; } .cSpecial { color: #008000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -62,6 +64,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/053recipe_header.cc'>https://github.com/akkartik/mu/blob/master/053recipe_header.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Advanced notation for the common/easy case where a recipe takes some fixed</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: number of ingredients and yields some fixed number of products.</span> @@ -100,11 +103,11 @@ if ('onhashchange' in window) { <span id="L35" class="LineNr"> 35 </span> string s = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L36" class="LineNr"> 36 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>s<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L37" class="LineNr"> 37 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L38" class="LineNr"> 38 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> header at <a href='003trace.cc.html#L225'>end</a> of file (0)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L38" class="LineNr"> 38 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> header at <a href='003trace.cc.html#L225'>end</a> of file (0)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L39" class="LineNr"> 39 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L40" class="LineNr"> 40 </span> <span class="Delimiter">}</span> <span id="L41" class="LineNr"> 41 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>s == <span class="Constant">"<-"</span><span class="Delimiter">)</span> -<span id="L42" class="LineNr"> 42 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"recipe "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">" should say '->' and not '<-'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L42" class="LineNr"> 42 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"recipe "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">" should say '->' and not '<-'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L43" class="LineNr"> 43 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>s == <span class="Constant">"->"</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L44" class="LineNr"> 44 </span> result<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span>s<span class="Delimiter">));</span> <span id="L45" class="LineNr"> 45 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"header ingredient: "</span> << result<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>back<span class="Delimiter">().</span>original_string << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> @@ -114,7 +117,7 @@ if ('onhashchange' in window) { <span id="L49" class="LineNr"> 49 </span> string s = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L50" class="LineNr"> 50 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>s<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L51" class="LineNr"> 51 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L52" class="LineNr"> 52 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> header at <a href='003trace.cc.html#L225'>end</a> of file (1)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L52" class="LineNr"> 52 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete <a href='010vm.cc.html#L19'>recipe</a> header at <a href='003trace.cc.html#L225'>end</a> of file (1)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L53" class="LineNr"> 53 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L54" class="LineNr"> 54 </span> <span class="Delimiter">}</span> <span id="L55" class="LineNr"> 55 </span> result<span class="Delimiter">.</span>products<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span>s<span class="Delimiter">));</span> @@ -183,10 +186,10 @@ if ('onhashchange' in window) { <span id="L118" class="LineNr">118 </span><span class="traceContains">+error: <a href='000organization.cc.html#L113'>main</a>: <a href='010vm.cc.html#L19'>recipe</a> body must begin with '['</span> <span id="L119" class="LineNr">119 </span> <span id="L120" class="LineNr">120 </span><span class="Delimiter">:(after "Begin debug_string(recipe x)")</span> -<span id="L121" class="LineNr">121 </span>out << <span class="Constant">"ingredients:</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L121" class="LineNr">121 </span>out << <span class="Constant">"ingredients:\n"</span><span class="Delimiter">;</span> <span id="L122" class="LineNr">122 </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#L141'>SIZE</a><span class="Delimiter">(</span>x<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L123" class="LineNr">123 </span> out << <span class="Constant">" "</span> << debug_string<span class="Delimiter">(</span>x<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L124" class="LineNr">124 </span>out << <span class="Constant">"products:</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L124" class="LineNr">124 </span>out << <span class="Constant">"products:\n"</span><span class="Delimiter">;</span> <span id="L125" class="LineNr">125 </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#L141'>SIZE</a><span class="Delimiter">(</span>x<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L126" class="LineNr">126 </span> out << <span class="Constant">" "</span> << debug_string<span class="Delimiter">(</span>x<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L127" class="LineNr">127 </span> @@ -243,7 +246,7 @@ if ('onhashchange' in window) { <span id="L178" class="LineNr">178 </span><span class="Delimiter">:(before "End Rewrite Instruction(curr, <a href='010vm.cc.html#L19'>recipe</a> result)")</span> <span id="L179" class="LineNr">179 </span><span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">.</span>name == <span class="Constant">"load-ingredients"</span> || curr<span class="Delimiter">.</span>name == <span class="Constant">"load-inputs"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L180" class="LineNr">180 </span> curr<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L181" class="LineNr">181 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> op = get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"next-ingredient-without-typechecking"</span><span class="Delimiter">);</span> +<span id="L181" class="LineNr">181 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> op = get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"next-ingredient-without-typechecking"</span><span class="Delimiter">);</span> <span id="L182" class="LineNr">182 </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#L141'>SIZE</a><span class="Delimiter">(</span>result<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L183" class="LineNr">183 </span> curr<span class="Delimiter">.</span>operation = op<span class="Delimiter">;</span> <span id="L184" class="LineNr">184 </span> curr<span class="Delimiter">.</span>name = <span class="Constant">"next-ingredient-without-typechecking"</span><span class="Delimiter">;</span> @@ -253,7 +256,7 @@ if ('onhashchange' in window) { <span id="L188" class="LineNr">188 </span> <span class="Delimiter">}</span> <span id="L189" class="LineNr">189 </span><span class="Delimiter">}</span> <span id="L190" class="LineNr">190 </span><span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">.</span>name == <span class="Constant">"next-ingredient-without-typechecking"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L191" class="LineNr">191 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"never call 'next-ingredient-without-typechecking' directly</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L191" class="LineNr">191 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"never call 'next-ingredient-without-typechecking' directly\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L192" class="LineNr">192 </span> curr<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L193" class="LineNr">193 </span><span class="Delimiter">}</span> <span id="L194" class="LineNr">194 </span> @@ -261,14 +264,14 @@ if ('onhashchange' in window) { <span id="L196" class="LineNr">196 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L197" class="LineNr">197 </span>NEXT_INGREDIENT_WITHOUT_TYPECHECKING<span class="Delimiter">,</span> <span id="L198" class="LineNr">198 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L199" class="LineNr">199 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"next-ingredient-without-typechecking"</span><span class="Delimiter">,</span> NEXT_INGREDIENT_WITHOUT_TYPECHECKING<span class="Delimiter">);</span> +<span id="L199" class="LineNr">199 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"next-ingredient-without-typechecking"</span><span class="Delimiter">,</span> NEXT_INGREDIENT_WITHOUT_TYPECHECKING<span class="Delimiter">);</span> <span id="L200" class="LineNr">200 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L201" class="LineNr">201 </span><span class="Normal">case</span> NEXT_INGREDIENT_WITHOUT_TYPECHECKING: <span class="Delimiter">{</span> <span id="L202" class="LineNr">202 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L203" class="LineNr">203 </span><span class="Delimiter">}</span> <span id="L204" class="LineNr">204 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L205" class="LineNr">205 </span><span class="Normal">case</span> NEXT_INGREDIENT_WITHOUT_TYPECHECKING: <span class="Delimiter">{</span> -<span id="L206" class="LineNr">206 </span> assert<span class="Delimiter">(</span>!Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L206" class="LineNr">206 </span> assert<span class="Delimiter">(</span>!<span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> <span id="L207" class="LineNr">207 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L208" class="LineNr">208 </span> products<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span> <span id="L209" class="LineNr">209 </span> <a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">.</span>at<span class="Delimiter">(</span><a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">().</span>next_ingredient_to_process<span class="Delimiter">));</span> @@ -298,7 +301,7 @@ if ('onhashchange' in window) { <span id="L233" class="LineNr">233 </span> <span id="L234" class="LineNr">234 </span><span class="Delimiter">:(after "use-before-set Error")</span> <span id="L235" class="LineNr">235 </span><span class="Normal">if</span> <span class="Delimiter">(</span>is_present_in_ingredients<span class="Delimiter">(</span>caller<span class="Delimiter">,</span> ingredient<span class="Delimiter">.</span>name<span class="Delimiter">))</span> -<span id="L236" class="LineNr">236 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" did you forget 'load-ingredients'?</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L236" class="LineNr">236 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" did you forget 'load-ingredients'?\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L237" class="LineNr">237 </span> <span id="L238" class="LineNr">238 </span><span class="Delimiter">:(scenario load_ingredients_missing_error_2)</span> <span id="L239" class="LineNr">239 </span><span class="Special">% Hide_errors = true;</span> @@ -310,8 +313,8 @@ if ('onhashchange' in window) { <span id="L245" class="LineNr">245 </span><span class="traceContains">+error: did you forget 'load-ingredients'?</span> <span id="L246" class="LineNr">246 </span> <span id="L247" class="LineNr">247 </span><span class="Delimiter">:(after "missing-type Error 1")</span> -<span id="L248" class="LineNr">248 </span><span class="Normal">if</span> <span class="Delimiter">(</span>is_present_in_ingredients<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> recipe_name<span class="Delimiter">)),</span> x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> -<span id="L249" class="LineNr">249 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" did you forget 'load-ingredients'?</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L248" class="LineNr">248 </span><span class="Normal">if</span> <span class="Delimiter">(</span>is_present_in_ingredients<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> recipe_name<span class="Delimiter">)),</span> x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> +<span id="L249" class="LineNr">249 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" did you forget 'load-ingredients'?\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L250" class="LineNr">250 </span> <span id="L251" class="LineNr">251 </span><span class="Delimiter">:(code)</span> <span id="L252" class="LineNr">252 </span><span class="Normal">bool</span> is_present_in_ingredients<span class="Delimiter">(</span><span class="Normal">const</span> recipe& callee<span class="Delimiter">,</span> <span class="Normal">const</span> string& ingredient_name<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -349,29 +352,29 @@ if ('onhashchange' in window) { <span id="L284" class="LineNr">284 </span><span class="traceContains">+error: <a href='000organization.cc.html#L113'>main</a>: product 0 has the wrong type at '1:point <- foo 34'</span> <span id="L285" class="LineNr">285 </span> <span id="L286" class="LineNr">286 </span><span class="Delimiter">:(after "Transform.push_back(check_instruction)")</span> -<span id="L287" class="LineNr">287 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_calls_against_header<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L287" class="LineNr">287 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_calls_against_header<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L288" class="LineNr">288 </span><span class="Delimiter">:(code)</span> <span id="L289" class="LineNr">289 </span><span class="Normal">void</span> check_calls_against_header<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="L290" class="LineNr">290 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L290" class="LineNr">290 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L291" class="LineNr">291 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- type-check calls inside <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L292" class="LineNr">292 </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#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L293" class="LineNr">293 </span> <span class="Normal">const</span> instruction& inst = caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L294" class="LineNr">294 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='028call_return.cc.html#L115'>is_primitive</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L295" class="LineNr">295 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">);</span> +<span id="L295" class="LineNr">295 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">);</span> <span id="L296" class="LineNr">296 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!callee<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L297" class="LineNr">297 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">long</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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">),</span> <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>callee<span class="Delimiter">.</span>ingredients<span class="Delimiter">));</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L298" class="LineNr">298 </span> <span class="Comment">// ingredients coerced from call to callee</span> <span id="L299" class="LineNr">299 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>callee<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="L300" class="LineNr">300 </span> <a href='003trace.cc.html#L196'>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">"ingredient "</span> << i << <span class="Constant">" has the wrong type at '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L301" class="LineNr">301 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" ['"</span> << to_string<span class="Delimiter">(</span>callee<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">)</span> << <span class="Constant">"' vs '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">)</span> << <span class="Constant">"']</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L300" class="LineNr">300 </span> <a href='003trace.cc.html#L196'>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">"ingredient "</span> << i << <span class="Constant">" has the wrong type at '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L301" class="LineNr">301 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" ['"</span> << to_string<span class="Delimiter">(</span>callee<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">)</span> << <span class="Constant">"' vs '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">)</span> << <span class="Constant">"']\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L302" class="LineNr">302 </span> <span class="Delimiter">}</span> <span id="L303" class="LineNr">303 </span> <span class="Delimiter">}</span> <span id="L304" class="LineNr">304 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">long</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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">),</span> <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>callee<span class="Delimiter">.</span>products<span class="Delimiter">));</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L305" class="LineNr">305 </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="L306" class="LineNr">306 </span> <span class="Comment">// products coerced from callee to call</span> <span id="L307" class="LineNr">307 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> callee<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="L308" class="LineNr">308 </span> <a href='003trace.cc.html#L196'>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">"product "</span> << i << <span class="Constant">" has the wrong type at '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L309" class="LineNr">309 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" ['"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">)</span> << <span class="Constant">"' vs '"</span> << to_string<span class="Delimiter">(</span>callee<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">)</span> << <span class="Constant">"']</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L308" class="LineNr">308 </span> <a href='003trace.cc.html#L196'>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">"product "</span> << i << <span class="Constant">" has the wrong type at '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L309" class="LineNr">309 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" ['"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">)</span> << <span class="Constant">"' vs '"</span> << to_string<span class="Delimiter">(</span>callee<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">)</span> << <span class="Constant">"']\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L310" class="LineNr">310 </span> <span class="Delimiter">}</span> <span id="L311" class="LineNr">311 </span> <span class="Delimiter">}</span> <span id="L312" class="LineNr">312 </span> <span class="Delimiter">}</span> @@ -391,23 +394,23 @@ if ('onhashchange' in window) { <span id="L326" class="LineNr">326 </span><span class="traceContains">+error: add2: replied with the wrong type at 'return z'</span> <span id="L327" class="LineNr">327 </span> <span id="L328" class="LineNr">328 </span><span class="Delimiter">:(before "End Checks")</span> -<span id="L329" class="LineNr">329 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_return_instructions_against_header<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L329" class="LineNr">329 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_return_instructions_against_header<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L330" class="LineNr">330 </span> <span id="L331" class="LineNr">331 </span><span class="Delimiter">:(code)</span> <span id="L332" class="LineNr">332 </span><span class="Normal">void</span> check_return_instructions_against_header<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="L333" class="LineNr">333 </span> <span class="Normal">const</span> recipe& caller_recipe = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L333" class="LineNr">333 </span> <span class="Normal">const</span> recipe& caller_recipe = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L334" class="LineNr">334 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!caller_recipe<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L335" class="LineNr">335 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- checking return instructions against header for "</span> << caller_recipe<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L336" class="LineNr">336 </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#L141'>SIZE</a><span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L337" class="LineNr">337 </span> <span class="Normal">const</span> instruction& inst = caller_recipe<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L338" class="LineNr">338 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name != <span class="Constant">"reply"</span> && inst<span class="Delimiter">.</span>name != <span class="Constant">"return"</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L339" class="LineNr">339 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>products<span class="Delimiter">)</span> != <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L340" class="LineNr">340 </span> <a href='003trace.cc.html#L196'>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">"replied with the wrong number of products at '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L340" class="LineNr">340 </span> <a href='003trace.cc.html#L196'>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">"replied with the wrong number of products at '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L341" class="LineNr">341 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L342" class="LineNr">342 </span> <span class="Delimiter">}</span> <span id="L343" class="LineNr">343 </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#L141'>SIZE</a><span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L344" class="LineNr">344 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_match<span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>products<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 id="L345" class="LineNr">345 </span> <a href='003trace.cc.html#L196'>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">"replied with the wrong type at '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L345" class="LineNr">345 </span> <a href='003trace.cc.html#L196'>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">"replied with the wrong type at '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L346" class="LineNr">346 </span> <span class="Delimiter">}</span> <span id="L347" class="LineNr">347 </span> <span class="Delimiter">}</span> <span id="L348" class="LineNr">348 </span><span class="Delimiter">}</span> @@ -462,18 +465,18 @@ if ('onhashchange' in window) { <span id="L397" class="LineNr">397 </span>map<string<span class="Delimiter">,</span> <span class="Normal">int</span>> ingredient_index<span class="Delimiter">;</span> <span id="L398" class="LineNr">398 </span> <span id="L399" class="LineNr">399 </span><span class="Delimiter">:(after "Begin Instruction Modifying Transforms")</span> -<span id="L400" class="LineNr">400 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_header_ingredients<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L400" class="LineNr">400 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_header_ingredients<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L401" class="LineNr">401 </span> <span id="L402" class="LineNr">402 </span><span class="Delimiter">:(code)</span> <span id="L403" class="LineNr">403 </span><span class="Normal">void</span> check_header_ingredients<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="L404" class="LineNr">404 </span> recipe& caller_recipe = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L404" class="LineNr">404 </span> recipe& caller_recipe = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L405" class="LineNr">405 </span> caller_recipe<span class="Delimiter">.</span>ingredient_index<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L406" class="LineNr">406 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- checking return instructions against header for "</span> << caller_recipe<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L407" class="LineNr">407 </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#L141'>SIZE</a><span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L408" class="LineNr">408 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type == <span class="Constant">NULL</span><span class="Delimiter">)</span> -<span id="L409" class="LineNr">409 </span> <a href='003trace.cc.html#L196'>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">"ingredient '"</span> << caller_recipe<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name << <span class="Constant">"' has no type</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L409" class="LineNr">409 </span> <a href='003trace.cc.html#L196'>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">"ingredient '"</span> << caller_recipe<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name << <span class="Constant">"' has no type\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L410" class="LineNr">410 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>ingredient_index<span class="Delimiter">,</span> caller_recipe<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">))</span> -<span id="L411" class="LineNr">411 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << caller_recipe<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name << <span class="Constant">"' can't repeat in the ingredients</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L411" class="LineNr">411 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << caller_recipe<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name << <span class="Constant">"' can't repeat in the ingredients\n"</span> << end<span class="Delimiter">();</span> <span id="L412" class="LineNr">412 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>ingredient_index<span class="Delimiter">,</span> caller_recipe<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">,</span> i<span class="Delimiter">);</span> <span id="L413" class="LineNr">413 </span> <span class="Delimiter">}</span> <span id="L414" class="LineNr">414 </span><span class="Delimiter">}</span> @@ -494,11 +497,11 @@ if ('onhashchange' in window) { <span id="L429" class="LineNr">429 </span><span class="traceContains">+mem: storing 8 in location 1</span> <span id="L430" class="LineNr">430 </span> <span id="L431" class="LineNr">431 </span><span class="Delimiter">:(after "Begin Type Modifying Transforms")</span> -<span id="L432" class="LineNr">432 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>deduce_types_from_header<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L432" class="LineNr">432 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>deduce_types_from_header<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L433" class="LineNr">433 </span> <span id="L434" class="LineNr">434 </span><span class="Delimiter">:(code)</span> <span id="L435" class="LineNr">435 </span><span class="Normal">void</span> deduce_types_from_header<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="L436" class="LineNr">436 </span> recipe& caller_recipe = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L436" class="LineNr">436 </span> recipe& caller_recipe = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L437" class="LineNr">437 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L438" class="LineNr">438 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- deduce types from header for "</span> << caller_recipe<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L439" class="LineNr">439 </span> map<string<span class="Delimiter">,</span> <span class="Normal">const</span> type_tree*> header_type<span class="Delimiter">;</span> @@ -551,11 +554,11 @@ if ('onhashchange' in window) { <span id="L486" class="LineNr">486 </span><span class="traceContains">+mem: storing 8 in location 1</span> <span id="L487" class="LineNr">487 </span> <span id="L488" class="LineNr">488 </span><span class="Delimiter">:(after "Transform.push_back(check_header_ingredients)")</span> -<span id="L489" class="LineNr">489 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>fill_in_return_ingredients<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L489" class="LineNr">489 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>fill_in_return_ingredients<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L490" class="LineNr">490 </span> <span id="L491" class="LineNr">491 </span><span class="Delimiter">:(code)</span> <span id="L492" class="LineNr">492 </span><span class="Normal">void</span> fill_in_return_ingredients<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="L493" class="LineNr">493 </span> recipe& caller_recipe = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L493" class="LineNr">493 </span> recipe& caller_recipe = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L494" class="LineNr">494 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- fill in return ingredients from header for <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller_recipe<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L495" class="LineNr">495 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!caller_recipe<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L496" class="LineNr">496 </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#L141'>SIZE</a><span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -684,17 +687,17 @@ if ('onhashchange' in window) { <span id="L619" class="LineNr">619 </span><span class="traceContains">+error: <a href='010vm.cc.html#L19'>recipe</a> 'main' must return at most a single product, a number</span> <span id="L620" class="LineNr">620 </span> <span id="L621" class="LineNr">621 </span><span class="Delimiter">:(after "Transform.push_back(expand_type_abbreviations)")</span> -<span id="L622" class="LineNr">622 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_recipe_header_constraints<span class="Delimiter">);</span> +<span id="L622" class="LineNr">622 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_recipe_header_constraints<span class="Delimiter">);</span> <span id="L623" class="LineNr">623 </span><span class="Delimiter">:(code)</span> <span id="L624" class="LineNr">624 </span><span class="Normal">void</span> check_recipe_header_constraints<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="L625" class="LineNr">625 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L625" class="LineNr">625 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L626" class="LineNr">626 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name != <span class="Constant">"main"</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L627" class="LineNr">627 </span> <a href='003trace.cc.html#L189'>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">"check <a href='010vm.cc.html#L19'>recipe</a> header constraints for <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L628" class="LineNr">628 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!caller<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L629" class="LineNr">629 </span> reagent<span class="Comment">/*</span><span class="Comment">local</span><span class="Comment">*/</span> expected_ingredient<span class="Delimiter">(</span><span class="Constant">"x:<a href='043space.cc.html#L101'>address</a>:array:character"</span><span class="Delimiter">);</span> <span id="L630" class="LineNr">630 </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#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L631" class="LineNr">631 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_strictly_match<span class="Delimiter">(</span>expected_ingredient<span class="Delimiter">,</span> caller<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="L632" class="LineNr">632 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"ingredients of <a href='010vm.cc.html#L19'>recipe</a> 'main' must all be text (address:array:character)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L632" class="LineNr">632 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"ingredients of <a href='010vm.cc.html#L19'>recipe</a> 'main' must all be text (address:array:character)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L633" class="LineNr">633 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L634" class="LineNr">634 </span> <span class="Delimiter">}</span> <span id="L635" class="LineNr">635 </span> <span class="Delimiter">}</span> @@ -702,7 +705,7 @@ if ('onhashchange' in window) { <span id="L637" class="LineNr">637 </span> reagent<span class="Comment">/*</span><span class="Comment">local</span><span class="Comment">*/</span> expected_product<span class="Delimiter">(</span><span class="Constant">"x:number"</span><span class="Delimiter">);</span> <span id="L638" class="LineNr">638 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>nprod > <span class="Constant">1</span> <span id="L639" class="LineNr">639 </span> || <span class="Delimiter">(</span>nprod == <span class="Constant">1</span> && !types_strictly_match<span class="Delimiter">(</span>expected_product<span class="Delimiter">,</span> caller<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="Delimiter">{</span> -<span id="L640" class="LineNr">640 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"recipe 'main' must return at most a single product, a number</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L640" class="LineNr">640 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"recipe 'main' must return at most a single product, a number\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L641" class="LineNr">641 </span> <span class="Delimiter">}</span> <span id="L642" class="LineNr">642 </span><span class="Delimiter">}</span> </pre> diff --git a/html/054static_dispatch.cc.html b/html/054static_dispatch.cc.html index 72eebcac..d5280b10 100644 --- a/html/054static_dispatch.cc.html +++ b/html/054static_dispatch.cc.html @@ -11,23 +11,25 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } .CommentedCode { color: #6c6c6c; } .traceAbsent { color: #c00000; } .muRecipe { color: #ff8700; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .cSpecial { color: #008000; } .muData { color: #ffff00; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -62,6 +64,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/054static_dispatch.cc'>https://github.com/akkartik/mu/blob/master/054static_dispatch.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Transform to maintain multiple variants of a recipe depending on the</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: number and types of the ingredients and products. Allows us to use nice</span> @@ -83,28 +86,28 @@ if ('onhashchange' in window) { <span id="L18" class="LineNr"> 18 </span><span class="Comment">//: flag an error if headers collide.</span> <span id="L19" class="LineNr"> 19 </span> <span id="L20" class="LineNr"> 20 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L21" class="LineNr"> 21 </span>map<string<span class="Delimiter">,</span> vector<recipe_ordinal> > Recipe_variants<span class="Delimiter">;</span> +<span id="L21" class="LineNr"> 21 </span>map<string<span class="Delimiter">,</span> vector<recipe_ordinal> > <span class="Special">Recipe_variants</span><span class="Delimiter">;</span> <span id="L22" class="LineNr"> 22 </span><span class="Delimiter">:(before "End One-time Setup")</span> -<span id="L23" class="LineNr"> 23 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">,</span> vector<recipe_ordinal><span class="Delimiter">());</span> <span class="Comment">// since we manually added main to Recipe_ordinal</span> +<span id="L23" class="LineNr"> 23 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_variants</span><span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">,</span> vector<recipe_ordinal><span class="Delimiter">());</span> <span class="Comment">// since we manually added main to Recipe_ordinal</span> <span id="L24" class="LineNr"> 24 </span> <span id="L25" class="LineNr"> 25 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L26" class="LineNr"> 26 </span>map<string<span class="Delimiter">,</span> vector<recipe_ordinal> > Recipe_variants_snapshot<span class="Delimiter">;</span> +<span id="L26" class="LineNr"> 26 </span>map<string<span class="Delimiter">,</span> vector<recipe_ordinal> > <span class="Special">Recipe_variants_snapshot</span><span class="Delimiter">;</span> <span id="L27" class="LineNr"> 27 </span><span class="Delimiter">:(before "End save_snapshots")</span> -<span id="L28" class="LineNr"> 28 </span>Recipe_variants_snapshot = Recipe_variants<span class="Delimiter">;</span> +<span id="L28" class="LineNr"> 28 </span><span class="Special">Recipe_variants_snapshot</span> = <span class="Special">Recipe_variants</span><span class="Delimiter">;</span> <span id="L29" class="LineNr"> 29 </span><span class="Delimiter">:(before "End restore_snapshots")</span> -<span id="L30" class="LineNr"> 30 </span>Recipe_variants = Recipe_variants_snapshot<span class="Delimiter">;</span> +<span id="L30" class="LineNr"> 30 </span><span class="Special">Recipe_variants</span> = <span class="Special">Recipe_variants_snapshot</span><span class="Delimiter">;</span> <span id="L31" class="LineNr"> 31 </span> <span id="L32" class="LineNr"> 32 </span><span class="Delimiter">:(before "End Load Recipe Header(result)")</span> <span id="L33" class="LineNr"> 33 </span><span class="Comment">// there can only ever be one variant for main</span> -<span id="L34" class="LineNr"> 34 </span><span class="Normal">if</span> <span class="Delimiter">(</span>result<span class="Delimiter">.</span>name != <span class="Constant">"main"</span> && <a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L35" class="LineNr"> 35 </span> <span class="Normal">const</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r = get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">);</span> -<span id="L36" class="LineNr"> 36 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">)</span> || get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>has_header<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L34" class="LineNr"> 34 </span><span class="Normal">if</span> <span class="Delimiter">(</span>result<span class="Delimiter">.</span>name != <span class="Constant">"main"</span> && <a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L35" class="LineNr"> 35 </span> <span class="Normal">const</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r = get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">);</span> +<span id="L36" class="LineNr"> 36 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">)</span> || get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>has_header<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L37" class="LineNr"> 37 </span> string new_name = <a href='054static_dispatch.cc.html#L56'>matching_variant_name</a><span class="Delimiter">(</span>result<span class="Delimiter">);</span> <span id="L38" class="LineNr"> 38 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>new_name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L39" class="LineNr"> 39 </span> <span class="Comment">// variant doesn't already exist</span> <span id="L40" class="LineNr"> 40 </span> new_name = <a href='054static_dispatch.cc.html#L111'>next_unused_recipe_name</a><span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">);</span> -<span id="L41" class="LineNr"> 41 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> new_name<span class="Delimiter">,</span> Next_recipe_ordinal++<span class="Delimiter">);</span> -<span id="L42" class="LineNr"> 42 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> new_name<span class="Delimiter">));</span> +<span id="L41" class="LineNr"> 41 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> new_name<span class="Delimiter">,</span> <span class="Special">Next_recipe_ordinal</span>++<span class="Delimiter">);</span> +<span id="L42" class="LineNr"> 42 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Recipe_variants</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> new_name<span class="Delimiter">));</span> <span id="L43" class="LineNr"> 43 </span> <span class="Delimiter">}</span> <span id="L44" class="LineNr"> 44 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"load"</span><span class="Delimiter">)</span> << <span class="Constant">"switching "</span> << result<span class="Delimiter">.</span>name << <span class="Constant">" to "</span> << new_name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L45" class="LineNr"> 45 </span> result<span class="Delimiter">.</span>name = new_name<span class="Delimiter">;</span> @@ -113,16 +116,16 @@ if ('onhashchange' in window) { <span id="L48" class="LineNr"> 48 </span><span class="Delimiter">}</span> <span id="L49" class="LineNr"> 49 </span><span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L50" class="LineNr"> 50 </span> <span class="Comment">// save first variant</span> -<span id="L51" class="LineNr"> 51 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">,</span> Next_recipe_ordinal++<span class="Delimiter">);</span> -<span id="L52" class="LineNr"> 52 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">));</span> +<span id="L51" class="LineNr"> 51 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">,</span> <span class="Special">Next_recipe_ordinal</span>++<span class="Delimiter">);</span> +<span id="L52" class="LineNr"> 52 </span> <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Recipe_variants</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> result<span class="Delimiter">.</span>name<span class="Delimiter">));</span> <span id="L53" class="LineNr"> 53 </span><span class="Delimiter">}</span> <span id="L54" class="LineNr"> 54 </span> <span id="L55" class="LineNr"> 55 </span><span class="Delimiter">:(code)</span> <span id="L56" class="LineNr"> 56 </span>string <a href='054static_dispatch.cc.html#L56'>matching_variant_name</a><span class="Delimiter">(</span><span class="Normal">const</span> recipe& rr<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L57" class="LineNr"> 57 </span> <span class="Normal">const</span> vector<recipe_ordinal>& variants = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> rr<span class="Delimiter">.</span>name<span class="Delimiter">);</span> +<span id="L57" class="LineNr"> 57 </span> <span class="Normal">const</span> vector<recipe_ordinal>& variants = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Recipe_variants</span><span class="Delimiter">,</span> rr<span class="Delimiter">.</span>name<span class="Delimiter">);</span> <span id="L58" class="LineNr"> 58 </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#L141'>SIZE</a><span class="Delimiter">(</span>variants<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L59" class="LineNr"> 59 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> variants<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="L60" class="LineNr"> 60 </span> <span class="Normal">const</span> recipe& candidate = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> +<span id="L59" class="LineNr"> 59 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> variants<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="L60" class="LineNr"> 60 </span> <span class="Normal">const</span> recipe& candidate = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span id="L61" class="LineNr"> 61 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!all_reagents_match<span class="Delimiter">(</span>rr<span class="Delimiter">,</span> candidate<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L62" class="LineNr"> 62 </span> <span class="Identifier">return</span> candidate<span class="Delimiter">.</span>name<span class="Delimiter">;</span> <span id="L63" class="LineNr"> 63 </span> <span class="Delimiter">}</span> @@ -148,10 +151,10 @@ if ('onhashchange' in window) { <span id="L83" class="LineNr"> 83 </span><span class="Delimiter">}</span> <span id="L84" class="LineNr"> 84 </span> <span id="L85" class="LineNr"> 85 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L86" class="LineNr"> 86 </span>set<string> Literal_type_names<span class="Delimiter">;</span> +<span id="L86" class="LineNr"> 86 </span>set<string> <span class="Special">Literal_type_names</span><span class="Delimiter">;</span> <span id="L87" class="LineNr"> 87 </span><span class="Delimiter">:(before "End One-time Setup")</span> -<span id="L88" class="LineNr"> 88 </span>Literal_type_names<span class="Delimiter">.</span>insert<span class="Delimiter">(</span><span class="Constant">"number"</span><span class="Delimiter">);</span> -<span id="L89" class="LineNr"> 89 </span>Literal_type_names<span class="Delimiter">.</span>insert<span class="Delimiter">(</span><span class="Constant">"character"</span><span class="Delimiter">);</span> +<span id="L88" class="LineNr"> 88 </span><span class="Special">Literal_type_names</span><span class="Delimiter">.</span>insert<span class="Delimiter">(</span><span class="Constant">"number"</span><span class="Delimiter">);</span> +<span id="L89" class="LineNr"> 89 </span><span class="Special">Literal_type_names</span><span class="Delimiter">.</span>insert<span class="Delimiter">(</span><span class="Constant">"character"</span><span class="Delimiter">);</span> <span id="L90" class="LineNr"> 90 </span><span class="Delimiter">:(code)</span> <span id="L91" class="LineNr"> 91 </span><span class="Normal">bool</span> deeply_equal_type_names<span class="Delimiter">(</span><span class="Normal">const</span> reagent& a<span class="Delimiter">,</span> <span class="Normal">const</span> reagent& b<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L92" class="LineNr"> 92 </span> <span class="Identifier">return</span> deeply_equal_type_names<span class="Delimiter">(</span>a<span class="Delimiter">.</span>type<span class="Delimiter">,</span> b<span class="Delimiter">.</span>type<span class="Delimiter">);</span> @@ -164,9 +167,9 @@ if ('onhashchange' in window) { <span id="L99" class="LineNr"> 99 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>a<span class="Delimiter">-></span>name == <span class="Constant">"literal"</span> && b<span class="Delimiter">-></span>name == <span class="Constant">"literal"</span><span class="Delimiter">)</span> <span id="L100" class="LineNr">100 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L101" class="LineNr">101 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>a<span class="Delimiter">-></span>name == <span class="Constant">"literal"</span><span class="Delimiter">)</span> -<span id="L102" class="LineNr">102 </span> <span class="Identifier">return</span> Literal_type_names<span class="Delimiter">.</span>find<span class="Delimiter">(</span>b<span class="Delimiter">-></span>name<span class="Delimiter">)</span> != Literal_type_names<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L102" class="LineNr">102 </span> <span class="Identifier">return</span> <span class="Special">Literal_type_names</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>b<span class="Delimiter">-></span>name<span class="Delimiter">)</span> != <span class="Special">Literal_type_names</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L103" class="LineNr">103 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>b<span class="Delimiter">-></span>name == <span class="Constant">"literal"</span><span class="Delimiter">)</span> -<span id="L104" class="LineNr">104 </span> <span class="Identifier">return</span> Literal_type_names<span class="Delimiter">.</span>find<span class="Delimiter">(</span>a<span class="Delimiter">-></span>name<span class="Delimiter">)</span> != Literal_type_names<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L104" class="LineNr">104 </span> <span class="Identifier">return</span> <span class="Special">Literal_type_names</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>a<span class="Delimiter">-></span>name<span class="Delimiter">)</span> != <span class="Special">Literal_type_names</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L105" class="LineNr">105 </span> <span class="Identifier">return</span> a<span class="Delimiter">-></span>name == b<span class="Delimiter">-></span>name<span class="Delimiter">;</span> <span id="L106" class="LineNr">106 </span> <span class="Delimiter">}</span> <span id="L107" class="LineNr">107 </span> <span class="Identifier">return</span> deeply_equal_type_names<span class="Delimiter">(</span>a<span class="Delimiter">-></span>left<span class="Delimiter">,</span> b<span class="Delimiter">-></span>left<span class="Delimiter">)</span> @@ -177,7 +180,7 @@ if ('onhashchange' in window) { <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">2</span><span class="Delimiter">;</span> <span class="Comment">/*</span><span class="Comment">forever</span><span class="Comment">*/</span><span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L113" class="LineNr">113 </span> ostringstream out<span class="Delimiter">;</span> <span id="L114" class="LineNr">114 </span> out << recipe_name << <span class="Constant">'_'</span> << i<span class="Delimiter">;</span> -<span id="L115" class="LineNr">115 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> out<span class="Delimiter">.</span>str<span class="Delimiter">()))</span> +<span id="L115" class="LineNr">115 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> out<span class="Delimiter">.</span>str<span class="Delimiter">()))</span> <span id="L116" class="LineNr">116 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> <span id="L117" class="LineNr">117 </span> <span class="Delimiter">}</span> <span id="L118" class="LineNr">118 </span><span class="Delimiter">}</span> @@ -213,7 +216,7 @@ if ('onhashchange' in window) { <span id="L148" class="LineNr">148 </span> <span id="L149" class="LineNr">149 </span><span class="Comment">//: after filling in all missing types (because we'll be introducing 'blank' types in this transform in a later layer, for shape-shifting recipes)</span> <span id="L150" class="LineNr">150 </span><span class="Delimiter">:(after "Transform.push_back(transform_names)")</span> -<span id="L151" class="LineNr">151 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L163'>resolve_ambiguous_calls</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L151" class="LineNr">151 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L163'>resolve_ambiguous_calls</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L152" class="LineNr">152 </span> <span id="L153" class="LineNr">153 </span><span class="Comment">//: In a later layer we'll introduce recursion in resolve_ambiguous_calls, by</span> <span id="L154" class="LineNr">154 </span><span class="Comment">//: having it generate code for shape-shifting recipes and then transform such</span> @@ -222,11 +225,11 @@ if ('onhashchange' in window) { <span id="L157" class="LineNr">157 </span><span class="Comment">//: We're punning the 'call' data structure just because it has slots for</span> <span id="L158" class="LineNr">158 </span><span class="Comment">//: calling recipe and calling instruction.</span> <span id="L159" class="LineNr">159 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L160" class="LineNr">160 </span>list<call> Resolve_stack<span class="Delimiter">;</span> +<span id="L160" class="LineNr">160 </span>list<call> <span class="Special">Resolve_stack</span><span class="Delimiter">;</span> <span id="L161" class="LineNr">161 </span> <span id="L162" class="LineNr">162 </span><span class="Delimiter">:(code)</span> <span id="L163" class="LineNr">163 </span><span class="Normal">void</span> <a href='054static_dispatch.cc.html#L163'>resolve_ambiguous_calls</a><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="L164" class="LineNr">164 </span> recipe& caller_recipe = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L164" class="LineNr">164 </span> recipe& caller_recipe = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L165" class="LineNr">165 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- resolve ambiguous calls for <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller_recipe<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L166" class="LineNr">166 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L167" class="LineNr">167 </span> instruction& inst = caller_recipe<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> @@ -237,19 +240,19 @@ if ('onhashchange' in window) { <span id="L172" class="LineNr">172 </span> <span id="L173" class="LineNr">173 </span><span class="Normal">void</span> <a href='054static_dispatch.cc.html#L173'>resolve_ambiguous_call</a><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="Normal">int</span> index<span class="Delimiter">,</span> instruction& inst<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& caller_recipe<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L174" class="LineNr">174 </span> <span class="Comment">// End resolve_ambiguous_call(r, index, inst, caller_recipe) Special-cases</span> -<span id="L175" class="LineNr">175 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L326'>non_ghost_size</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">))</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L175" class="LineNr">175 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L326'>non_ghost_size</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Recipe_variants</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">))</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L176" class="LineNr">176 </span> <a href='003trace.cc.html#L189'>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">"instruction "</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L177" class="LineNr">177 </span> Resolve_stack<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>call<span class="Delimiter">(</span>r<span class="Delimiter">,</span> index<span class="Delimiter">));</span> +<span id="L177" class="LineNr">177 </span> <span class="Special">Resolve_stack</span><span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>call<span class="Delimiter">(</span>r<span class="Delimiter">,</span> index<span class="Delimiter">));</span> <span id="L178" class="LineNr">178 </span> string new_name = best_variant<span class="Delimiter">(</span>inst<span class="Delimiter">,</span> caller_recipe<span class="Delimiter">);</span> <span id="L179" class="LineNr">179 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!new_name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span id="L180" class="LineNr">180 </span> inst<span class="Delimiter">.</span>name = new_name<span class="Delimiter">;</span> -<span id="L181" class="LineNr">181 </span> assert<span class="Delimiter">(</span>Resolve_stack<span class="Delimiter">.</span>front<span class="Delimiter">().</span>running_recipe == r<span class="Delimiter">);</span> -<span id="L182" class="LineNr">182 </span> assert<span class="Delimiter">(</span>Resolve_stack<span class="Delimiter">.</span>front<span class="Delimiter">().</span>running_step_index == index<span class="Delimiter">);</span> -<span id="L183" class="LineNr">183 </span> Resolve_stack<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> +<span id="L181" class="LineNr">181 </span> assert<span class="Delimiter">(</span><span class="Special">Resolve_stack</span><span class="Delimiter">.</span>front<span class="Delimiter">().</span>running_recipe == r<span class="Delimiter">);</span> +<span id="L182" class="LineNr">182 </span> assert<span class="Delimiter">(</span><span class="Special">Resolve_stack</span><span class="Delimiter">.</span>front<span class="Delimiter">().</span>running_step_index == index<span class="Delimiter">);</span> +<span id="L183" class="LineNr">183 </span> <span class="Special">Resolve_stack</span><span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> <span id="L184" class="LineNr">184 </span><span class="Delimiter">}</span> <span id="L185" class="LineNr">185 </span> <span id="L186" class="LineNr">186 </span>string best_variant<span class="Delimiter">(</span><span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& caller_recipe<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L187" class="LineNr">187 </span> <span class="Normal">const</span> vector<recipe_ordinal>& variants = get<span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">);</span> +<span id="L187" class="LineNr">187 </span> <span class="Normal">const</span> vector<recipe_ordinal>& variants = get<span class="Delimiter">(</span><span class="Special">Recipe_variants</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">);</span> <span id="L188" class="LineNr">188 </span> vector<recipe_ordinal> candidates<span class="Delimiter">;</span> <span id="L189" class="LineNr">189 </span> <span id="L190" class="LineNr">190 </span> <span class="Comment">// Static Dispatch Phase 1</span> @@ -268,32 +271,32 @@ if ('onhashchange' in window) { <span id="L203" class="LineNr">203 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!candidates<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span> best_variant<span class="Delimiter">(</span>inst<span class="Delimiter">,</span> candidates<span class="Delimiter">).</span>name<span class="Delimiter">;</span> <span id="L204" class="LineNr">204 </span> <span id="L205" class="LineNr">205 </span> <span class="Comment">// error messages</span> -<span id="L206" class="LineNr">206 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_primitive<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">)))</span> <span class="Delimiter">{</span> <span class="Comment">// we currently don't check types for primitive variants</span> +<span id="L206" class="LineNr">206 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_primitive<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">)))</span> <span class="Delimiter">{</span> <span class="Comment">// we currently don't check types for primitive variants</span> <span id="L207" class="LineNr">207 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>variants<span class="Delimiter">)</span> == <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L208" class="LineNr">208 </span> <a href='003trace.cc.html#L196'>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">"types don't match in call for '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> -<span id="L209" class="LineNr">209 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" which tries to call '"</span> << original_header_label<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> variants<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#L225'>end</a><span class="Delimiter">();</span> +<span id="L208" class="LineNr">208 </span> <a href='003trace.cc.html#L196'>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">"types don't match in call for '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> +<span id="L209" class="LineNr">209 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" which tries to call '"</span> << original_header_label<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L210" class="LineNr">210 </span> <span class="Delimiter">}</span> <span id="L211" class="LineNr">211 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> -<span id="L212" class="LineNr">212 </span> <a href='003trace.cc.html#L196'>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">"failed to find a matching call for '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L213" class="LineNr">213 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" available variants are:</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L212" class="LineNr">212 </span> <a href='003trace.cc.html#L196'>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">"failed to find a matching call for '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L213" class="LineNr">213 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" available variants are:\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L214" class="LineNr">214 </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#L141'>SIZE</a><span class="Delimiter">(</span>variants<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> -<span id="L215" class="LineNr">215 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" "</span> << <a href='054static_dispatch.cc.html#L501'>original_header_label</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L215" class="LineNr">215 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" "</span> << <a href='054static_dispatch.cc.html#L501'>original_header_label</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L216" class="LineNr">216 </span> <span class="Delimiter">}</span> -<span id="L217" class="LineNr">217 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>list<call>::iterator p = <span class="Comment">/*</span><span class="Comment">skip</span><span class="Comment">*/</span>++Resolve_stack<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Resolve_stack<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L218" class="LineNr">218 </span> <span class="Normal">const</span> recipe& specializer_recipe = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">);</span> +<span id="L217" class="LineNr">217 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>list<call>::iterator p = <span class="Comment">/*</span><span class="Comment">skip</span><span class="Comment">*/</span>++<span class="Special">Resolve_stack</span><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Resolve_stack</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L218" class="LineNr">218 </span> <span class="Normal">const</span> recipe& specializer_recipe = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">);</span> <span id="L219" class="LineNr">219 </span> <span class="Normal">const</span> instruction& specializer_inst = specializer_recipe<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>p<span class="Delimiter">-></span>running_step_index<span class="Delimiter">);</span> <span id="L220" class="LineNr">220 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>specializer_recipe<span class="Delimiter">.</span>name != <span class="Constant">"interactive"</span><span class="Delimiter">)</span> -<span id="L221" class="LineNr">221 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" (from '"</span> << to_original_string<span class="Delimiter">(</span>specializer_inst<span class="Delimiter">)</span> << <span class="Constant">"' in "</span> << specializer_recipe<span class="Delimiter">.</span>name << <span class="Constant">")</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L221" class="LineNr">221 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" (from '"</span> << to_original_string<span class="Delimiter">(</span>specializer_inst<span class="Delimiter">)</span> << <span class="Constant">"' in "</span> << specializer_recipe<span class="Delimiter">.</span>name << <span class="Constant">")\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L222" class="LineNr">222 </span> <span class="Normal">else</span> -<span id="L223" class="LineNr">223 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" (from '"</span> << to_original_string<span class="Delimiter">(</span>specializer_inst<span class="Delimiter">)</span> << <span class="Constant">"')</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L223" class="LineNr">223 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" (from '"</span> << to_original_string<span class="Delimiter">(</span>specializer_inst<span class="Delimiter">)</span> << <span class="Constant">"')\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L224" class="LineNr">224 </span> <span class="Comment">// One special-case to help with the rewrite_stash transform. (cross-layer)</span> <span id="L225" class="LineNr">225 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>specializer_inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">"stash_"</span><span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L226" class="LineNr">226 </span> <a href='010vm.cc.html#L33'>instruction</a> stash_inst<span class="Delimiter">;</span> <span id="L227" class="LineNr">227 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L333'>next_stash</a><span class="Delimiter">(</span>*p<span class="Delimiter">,</span> &stash_inst<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L228" class="LineNr">228 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>specializer_recipe<span class="Delimiter">.</span>name != <span class="Constant">"interactive"</span><span class="Delimiter">)</span> -<span id="L229" class="LineNr">229 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" (part of '"</span> << to_original_string<span class="Delimiter">(</span>stash_inst<span class="Delimiter">)</span> << <span class="Constant">"' in "</span> << specializer_recipe<span class="Delimiter">.</span>name << <span class="Constant">")</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L229" class="LineNr">229 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" (part of '"</span> << to_original_string<span class="Delimiter">(</span>stash_inst<span class="Delimiter">)</span> << <span class="Constant">"' in "</span> << specializer_recipe<span class="Delimiter">.</span>name << <span class="Constant">")\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L230" class="LineNr">230 </span> <span class="Normal">else</span> -<span id="L231" class="LineNr">231 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" (part of '"</span> << to_original_string<span class="Delimiter">(</span>stash_inst<span class="Delimiter">)</span> << <span class="Constant">"')</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L231" class="LineNr">231 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" (part of '"</span> << to_original_string<span class="Delimiter">(</span>stash_inst<span class="Delimiter">)</span> << <span class="Constant">"')\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L232" class="LineNr">232 </span> <span class="Delimiter">}</span> <span id="L233" class="LineNr">233 </span> <span class="Delimiter">}</span> <span id="L234" class="LineNr">234 </span> <span class="Delimiter">}</span> @@ -307,7 +310,7 @@ if ('onhashchange' in window) { <span id="L242" class="LineNr">242 </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#L141'>SIZE</a><span class="Delimiter">(</span>variants<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L243" class="LineNr">243 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)</span> == -<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L244" class="LineNr">244 </span> <a href='003trace.cc.html#L189'>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">"checking variant (strict) "</span> << i << <span class="Constant">": "</span> << header_label<span class="Delimiter">(</span>variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L245" class="LineNr">245 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L251'>all_header_reagents_strictly_match</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))))</span> +<span id="L245" class="LineNr">245 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L251'>all_header_reagents_strictly_match</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))))</span> <span id="L246" class="LineNr">246 </span> result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span id="L247" class="LineNr">247 </span> <span class="Delimiter">}</span> <span id="L248" class="LineNr">248 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> @@ -336,7 +339,7 @@ if ('onhashchange' in window) { <span id="L271" class="LineNr">271 </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#L141'>SIZE</a><span class="Delimiter">(</span>variants<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L272" class="LineNr">272 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)</span> == -<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L273" class="LineNr">273 </span> <a href='003trace.cc.html#L189'>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">"checking variant "</span> << i << <span class="Constant">": "</span> << header_label<span class="Delimiter">(</span>variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L274" class="LineNr">274 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L280'>all_header_reagents_match</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))))</span> +<span id="L274" class="LineNr">274 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L280'>all_header_reagents_match</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))))</span> <span id="L275" class="LineNr">275 </span> result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span id="L276" class="LineNr">276 </span> <span class="Delimiter">}</span> <span id="L277" class="LineNr">277 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> @@ -362,11 +365,11 @@ if ('onhashchange' in window) { <span id="L297" class="LineNr">297 </span><span class="Comment">// tie-breaker for each phase</span> <span id="L298" class="LineNr">298 </span><span class="Normal">const</span> recipe& best_variant<span class="Delimiter">(</span><span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> vector<recipe_ordinal>& candidates<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L299" class="LineNr">299 </span> assert<span class="Delimiter">(</span>!candidates<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L300" class="LineNr">300 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>candidates<span class="Delimiter">)</span> == <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> candidates<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> +<span id="L300" class="LineNr">300 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>candidates<span class="Delimiter">)</span> == <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">return</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> candidates<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> <span id="L301" class="LineNr">301 </span> <span class="Normal">int</span> min_score = <span class="Constant">999</span><span class="Delimiter">;</span> <span id="L302" class="LineNr">302 </span> <span class="Normal">int</span> min_index = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L303" class="LineNr">303 </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#L141'>SIZE</a><span class="Delimiter">(</span>candidates<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L304" class="LineNr">304 </span> <span class="Normal">const</span> recipe& candidate = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> candidates<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> +<span id="L304" class="LineNr">304 </span> <span class="Normal">const</span> recipe& candidate = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> candidates<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span id="L305" class="LineNr">305 </span> <span class="Comment">// prefer variants without extra or missing ingredients or products</span> <span id="L306" class="LineNr">306 </span> <span class="Normal">int</span> score = abs<span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>candidate<span class="Delimiter">.</span>products<span class="Delimiter">)</span>-SIZE<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">))</span> <span id="L307" class="LineNr">307 </span> + abs<span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>candidate<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span>-SIZE<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">));</span> @@ -385,7 +388,7 @@ if ('onhashchange' in window) { <span id="L320" class="LineNr">320 </span> min_index = i<span class="Delimiter">;</span> <span id="L321" class="LineNr">321 </span> <span class="Delimiter">}</span> <span id="L322" class="LineNr">322 </span> <span class="Delimiter">}</span> -<span id="L323" class="LineNr">323 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> candidates<span class="Delimiter">.</span>at<span class="Delimiter">(</span>min_index<span class="Delimiter">));</span> +<span id="L323" class="LineNr">323 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> candidates<span class="Delimiter">.</span>at<span class="Delimiter">(</span>min_index<span class="Delimiter">));</span> <span id="L324" class="LineNr">324 </span><span class="Delimiter">}</span> <span id="L325" class="LineNr">325 </span> <span id="L326" class="LineNr">326 </span><span class="Normal">int</span> <a href='054static_dispatch.cc.html#L326'>non_ghost_size</a><span class="Delimiter">(</span>vector<recipe_ordinal>& variants<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -396,7 +399,7 @@ if ('onhashchange' in window) { <span id="L331" class="LineNr">331 </span><span class="Delimiter">}</span> <span id="L332" class="LineNr">332 </span> <span id="L333" class="LineNr">333 </span><span class="Normal">bool</span> <a href='054static_dispatch.cc.html#L333'>next_stash</a><span class="Delimiter">(</span><span class="Normal">const</span> call& c<span class="Delimiter">,</span> instruction* stash_inst<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L334" class="LineNr">334 </span> <span class="Normal">const</span> recipe& specializer_recipe = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> c<span class="Delimiter">.</span>running_recipe<span class="Delimiter">);</span> +<span id="L334" class="LineNr">334 </span> <span class="Normal">const</span> recipe& specializer_recipe = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> c<span class="Delimiter">.</span>running_recipe<span class="Delimiter">);</span> <span id="L335" class="LineNr">335 </span> <span class="Normal">int</span> index = c<span class="Delimiter">.</span>running_step_index<span class="Delimiter">;</span> <span id="L336" class="LineNr">336 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>++index<span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>specializer_recipe<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L337" class="LineNr">337 </span> <span class="Normal">const</span> instruction& inst = specializer_recipe<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> @@ -549,7 +552,7 @@ if ('onhashchange' in window) { <span id="L484" class="LineNr">484 </span> <span id="L485" class="LineNr">485 </span><span class="Delimiter">:(replace{} "string header_label(const <a href='010vm.cc.html#L14'>recipe_ordinal</a> r)")</span> <span id="L486" class="LineNr">486 </span>string header_label<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="L487" class="LineNr">487 </span> <span class="Identifier">return</span> header_label<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">));</span> +<span id="L487" class="LineNr">487 </span> <span class="Identifier">return</span> header_label<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">));</span> <span id="L488" class="LineNr">488 </span><span class="Delimiter">}</span> <span id="L489" class="LineNr">489 </span><span class="Delimiter">:(code)</span> <span id="L490" class="LineNr">490 </span>string header_label<span class="Delimiter">(</span><span class="Normal">const</span> recipe& caller<span class="Delimiter">)</span> <span class="Delimiter">{</span> diff --git a/html/055shape_shifting_container.cc.html b/html/055shape_shifting_container.cc.html index 27314549..e8730f55 100644 --- a/html/055shape_shifting_container.cc.html +++ b/html/055shape_shifting_container.cc.html @@ -11,23 +11,25 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } .SalientComment { color: #00ffff; } .CommentedCode { color: #6c6c6c; } .muRecipe { color: #ff8700; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .cSpecial { color: #008000; } .muData { color: #ffff00; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -62,6 +64,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/055shape_shifting_container.cc'>https://github.com/akkartik/mu/blob/master/055shape_shifting_container.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">//:: Container definitions can contain 'type ingredients'</span> <span id="L2" class="LineNr"> 2 </span> @@ -185,7 +188,7 @@ if ('onhashchange' in window) { <span id="L120" class="LineNr">120 </span><span class="Comment">// that appears after foo.</span> <span id="L121" class="LineNr">121 </span><span class="Normal">extern</span> <span class="Normal">const</span> <span class="Normal">int</span> START_TYPE_INGREDIENTS = <span class="Constant">2000</span><span class="Delimiter">;</span> <span id="L122" class="LineNr">122 </span><span class="Delimiter">:(before "End Commandline Parsing")</span> <span class="Comment">// after loading .mu files</span> -<span id="L123" class="LineNr">123 </span>assert<span class="Delimiter">(</span>Next_type_ordinal < START_TYPE_INGREDIENTS<span class="Delimiter">);</span> +<span id="L123" class="LineNr">123 </span>assert<span class="Delimiter">(</span><span class="Special">Next_type_ordinal</span> < START_TYPE_INGREDIENTS<span class="Delimiter">);</span> <span id="L124" class="LineNr">124 </span> <span id="L125" class="LineNr">125 </span><span class="Delimiter">:(before "End type_info Fields")</span> <span id="L126" class="LineNr">126 </span>map<string<span class="Delimiter">,</span> type_ordinal> type_ingredient_names<span class="Delimiter">;</span> @@ -214,20 +217,20 @@ if ('onhashchange' in window) { <span id="L149" class="LineNr">149 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!slurp_type_ingredients<span class="Delimiter">(</span>in<span class="Delimiter">,</span> type_ingredient_names<span class="Delimiter">,</span> name<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L150" class="LineNr">150 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L151" class="LineNr">151 </span> <span class="Delimiter">}</span> -<span id="L152" class="LineNr">152 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">)</span> -<span id="L153" class="LineNr">153 </span> && <a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L154" class="LineNr">154 </span> <span class="Normal">const</span> type_info& previous_info = get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">));</span> +<span id="L152" class="LineNr">152 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> name<span class="Delimiter">)</span> +<span id="L153" class="LineNr">153 </span> && <a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> name<span class="Delimiter">)))</span> <span class="Delimiter">{</span> +<span id="L154" class="LineNr">154 </span> <span class="Normal">const</span> type_info& previous_info = get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> name<span class="Delimiter">));</span> <span id="L155" class="LineNr">155 </span> <span class="Comment">// we've already seen this container; make sure type ingredients match</span> <span id="L156" class="LineNr">156 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type_ingredients_match<span class="Delimiter">(</span>type_ingredient_names<span class="Delimiter">,</span> previous_info<span class="Delimiter">.</span>type_ingredient_names<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L157" class="LineNr">157 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"headers of "</span> << command << <span class="Constant">" '"</span> << name << <span class="Constant">"' must use identical type ingredients</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L157" class="LineNr">157 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"headers of "</span> << command << <span class="Constant">" '"</span> << name << <span class="Constant">"' must use identical type ingredients\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L158" class="LineNr">158 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L159" class="LineNr">159 </span> <span class="Delimiter">}</span> <span id="L160" class="LineNr">160 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L161" class="LineNr">161 </span> <span class="Delimiter">}</span> <span id="L162" class="LineNr">162 </span> <span class="Comment">// we haven't seen this container before</span> -<span id="L163" class="LineNr">163 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">)</span> || get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> -<span id="L164" class="LineNr">164 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L165" class="LineNr">165 </span> type_info& info = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> name<span class="Delimiter">));</span> +<span id="L163" class="LineNr">163 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> name<span class="Delimiter">)</span> || get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> name<span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> +<span id="L164" class="LineNr">164 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> name<span class="Delimiter">,</span> <span class="Special">Next_type_ordinal</span>++<span class="Delimiter">);</span> +<span id="L165" class="LineNr">165 </span> type_info& info = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> name<span class="Delimiter">));</span> <span id="L166" class="LineNr">166 </span> info<span class="Delimiter">.</span>type_ingredient_names<span class="Delimiter">.</span>swap<span class="Delimiter">(</span>type_ingredient_names<span class="Delimiter">);</span> <span id="L167" class="LineNr">167 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L168" class="LineNr">168 </span><span class="Delimiter">}</span> @@ -237,15 +240,15 @@ if ('onhashchange' in window) { <span id="L172" class="LineNr">172 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L173" class="LineNr">173 </span> string curr = slurp_until<span class="Delimiter">(</span>in<span class="Delimiter">,</span> <span class="Constant">':'</span><span class="Delimiter">);</span> <span id="L174" class="LineNr">174 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L175" class="LineNr">175 </span> <a href='003trace.cc.html#L196'>raise</a> << container_name << <span class="Constant">": empty type ingredients not permitted</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L175" class="LineNr">175 </span> <a href='003trace.cc.html#L196'>raise</a> << container_name << <span class="Constant">": empty type ingredients not permitted\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L176" class="LineNr">176 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L177" class="LineNr">177 </span> <span class="Delimiter">}</span> <span id="L178" class="LineNr">178 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!starts_with<span class="Delimiter">(</span>curr<span class="Delimiter">,</span> <span class="Constant">"_"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L179" class="LineNr">179 </span> <a href='003trace.cc.html#L196'>raise</a> << container_name << <span class="Constant">": type ingredient '"</span> << curr << <span class="Constant">"' must begin with an underscore</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L179" class="LineNr">179 </span> <a href='003trace.cc.html#L196'>raise</a> << container_name << <span class="Constant">": type ingredient '"</span> << curr << <span class="Constant">"' must begin with an underscore\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L180" class="LineNr">180 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L181" class="LineNr">181 </span> <span class="Delimiter">}</span> <span id="L182" class="LineNr">182 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>out<span class="Delimiter">.</span>find<span class="Delimiter">(</span>curr<span class="Delimiter">)</span> != out<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L183" class="LineNr">183 </span> <a href='003trace.cc.html#L196'>raise</a> << container_name << <span class="Constant">": can't repeat type ingredient name'"</span> << curr << <span class="Constant">"' in a single container definition</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L183" class="LineNr">183 </span> <a href='003trace.cc.html#L196'>raise</a> << container_name << <span class="Constant">": can't repeat type ingredient name'"</span> << curr << <span class="Constant">"' in a single container definition\n"</span> << end<span class="Delimiter">();</span> <span id="L184" class="LineNr">184 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L185" class="LineNr">185 </span> <span class="Delimiter">}</span> <span id="L186" class="LineNr">186 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>out<span class="Delimiter">,</span> curr<span class="Delimiter">,</span> next_type_ordinal++<span class="Delimiter">);</span> @@ -274,7 +277,7 @@ if ('onhashchange' in window) { <span id="L209" class="LineNr">209 </span> <span id="L210" class="LineNr">210 </span><span class="Delimiter">:(before "End Container Type Checks")</span> <span id="L211" class="LineNr">211 </span><span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>value >= START_TYPE_INGREDIENTS -<span id="L212" class="LineNr">212 </span> && <span class="Delimiter">(</span>type<span class="Delimiter">-></span>value - START_TYPE_INGREDIENTS<span class="Delimiter">)</span> < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>type_ingredient_names<span class="Delimiter">))</span> +<span id="L212" class="LineNr">212 </span> && <span class="Delimiter">(</span>type<span class="Delimiter">-></span>value - START_TYPE_INGREDIENTS<span class="Delimiter">)</span> < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>type_ingredient_names<span class="Delimiter">))</span> <span id="L213" class="LineNr">213 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L214" class="LineNr">214 </span> <span id="L215" class="LineNr">215 </span><span class="Delimiter">:(scenario size_of_shape_shifting_exclusive_container)</span> @@ -374,18 +377,18 @@ if ('onhashchange' in window) { <span id="L309" class="LineNr">309 </span> <span id="L310" class="LineNr">310 </span><span class="Delimiter">:(before "End size_of(type) Non-atom Special-cases")</span> <span id="L311" class="LineNr">311 </span>assert<span class="Delimiter">(</span>type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>atom<span class="Delimiter">);</span> -<span id="L312" class="LineNr">312 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L312" class="LineNr">312 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L313" class="LineNr">313 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"no such type "</span> << type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L314" class="LineNr">314 </span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L315" class="LineNr">315 </span><span class="Delimiter">}</span> -<span id="L316" class="LineNr">316 </span>type_info t = get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value<span class="Delimiter">);</span> +<span id="L316" class="LineNr">316 </span>type_info t = get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>left<span class="Delimiter">-></span>value<span class="Delimiter">);</span> <span id="L317" class="LineNr">317 </span><span class="Normal">if</span> <span class="Delimiter">(</span>t<span class="Delimiter">.</span>kind == <a href='010vm.cc.html#L180'>CONTAINER</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L318" class="LineNr">318 </span> <span class="Comment">// size of a container is the sum of the sizes of its elements</span> <span id="L319" class="LineNr">319 </span> <span class="Normal">int</span> result = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L320" class="LineNr">320 </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#L141'>SIZE</a><span class="Delimiter">(</span>t<span class="Delimiter">.</span>elements<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L321" class="LineNr">321 </span> <span class="Comment">// todo: strengthen assertion to disallow mutual type recursion</span> <span id="L322" class="LineNr">322 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>get_base_type<span class="Delimiter">(</span>t<span class="Delimiter">.</span>elements<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">)-></span>value == get_base_type<span class="Delimiter">(</span>type<span class="Delimiter">)-></span>value<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L323" class="LineNr">323 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"container "</span> << t<span class="Delimiter">.</span>name << <span class="Constant">" can't include itself as a member</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L323" class="LineNr">323 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"container "</span> << t<span class="Delimiter">.</span>name << <span class="Constant">" can't include itself as a member\n"</span> << end<span class="Delimiter">();</span> <span id="L324" class="LineNr">324 </span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L325" class="LineNr">325 </span> <span class="Delimiter">}</span> <span id="L326" class="LineNr">326 </span> result += size_of<span class="Delimiter">(</span><a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>type<span class="Delimiter">,</span> i<span class="Delimiter">));</span> @@ -512,109 +515,109 @@ if ('onhashchange' in window) { <span id="L447" class="LineNr">447 </span> <span id="L448" class="LineNr">448 </span><span class="Delimiter">:(before "End Unit Tests")</span> <span id="L449" class="LineNr">449 </span><span class="Normal">void</span> test_replace_type_ingredients_entire<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L450" class="LineNr">450 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_elem [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L451" class="LineNr">451 </span> <span class="Constant">" x:_elem</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L452" class="LineNr">452 </span> <span class="Constant">" y:num</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L453" class="LineNr">453 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L450" class="LineNr">450 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_elem [\n"</span> +<span id="L451" class="LineNr">451 </span> <span class="Constant">" x:_elem\n"</span> +<span id="L452" class="LineNr">452 </span> <span class="Constant">" y:num\n"</span> +<span id="L453" class="LineNr">453 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L454" class="LineNr">454 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"x:foo:point"</span><span class="Delimiter">);</span> <span id="L455" class="LineNr">455 </span> reagent element = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L456" class="LineNr">456 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: </span><span class="cSpecial">\"</span><span class="Constant">point</span><span class="cSpecial">\"</span><span class="Constant">}"</span><span class="Delimiter">);</span> +<span id="L456" class="LineNr">456 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: \"</span>point\<span class="Constant">"}"</span><span class="Delimiter">);</span> <span id="L457" class="LineNr">457 </span><span class="Delimiter">}</span> <span id="L458" class="LineNr">458 </span> <span id="L459" class="LineNr">459 </span><span class="Normal">void</span> test_replace_type_ingredients_tail<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L460" class="LineNr">460 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_elem [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L461" class="LineNr">461 </span> <span class="Constant">" x:_elem</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L462" class="LineNr">462 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L463" class="LineNr">463 </span> <span class="Constant">"container bar:_elem [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L464" class="LineNr">464 </span> <span class="Constant">" x:foo:_elem</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L465" class="LineNr">465 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L460" class="LineNr">460 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_elem [\n"</span> +<span id="L461" class="LineNr">461 </span> <span class="Constant">" x:_elem\n"</span> +<span id="L462" class="LineNr">462 </span> <span class="Constant">"]\n"</span> +<span id="L463" class="LineNr">463 </span> <span class="Constant">"container bar:_elem [\n"</span> +<span id="L464" class="LineNr">464 </span> <span class="Constant">" x:foo:_elem\n"</span> +<span id="L465" class="LineNr">465 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L466" class="LineNr">466 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"x:bar:point"</span><span class="Delimiter">);</span> <span id="L467" class="LineNr">467 </span> reagent element = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L468" class="LineNr">468 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: (</span><span class="cSpecial">\"</span><span class="Constant">foo</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">point</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> +<span id="L468" class="LineNr">468 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: (\"</span>foo\<span class="Constant">" \"</span>point\<span class="Constant">")}"</span><span class="Delimiter">);</span> <span id="L469" class="LineNr">469 </span><span class="Delimiter">}</span> <span id="L470" class="LineNr">470 </span> <span id="L471" class="LineNr">471 </span><span class="Normal">void</span> test_replace_type_ingredients_head_tail_multiple<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L472" class="LineNr">472 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_elem [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L473" class="LineNr">473 </span> <span class="Constant">" x:_elem</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L474" class="LineNr">474 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L475" class="LineNr">475 </span> <span class="Constant">"container bar:_elem [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L476" class="LineNr">476 </span> <span class="Constant">" x:foo:_elem</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L477" class="LineNr">477 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L472" class="LineNr">472 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_elem [\n"</span> +<span id="L473" class="LineNr">473 </span> <span class="Constant">" x:_elem\n"</span> +<span id="L474" class="LineNr">474 </span> <span class="Constant">"]\n"</span> +<span id="L475" class="LineNr">475 </span> <span class="Constant">"container bar:_elem [\n"</span> +<span id="L476" class="LineNr">476 </span> <span class="Constant">" x:foo:_elem\n"</span> +<span id="L477" class="LineNr">477 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L478" class="LineNr">478 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"x:bar:<a href='043space.cc.html#L101'>address</a>:array:character"</span><span class="Delimiter">);</span> <span id="L479" class="LineNr">479 </span> reagent element = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L480" class="LineNr">480 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: (</span><span class="cSpecial">\"</span><span class="Constant">foo</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L101'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">character</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> +<span id="L480" class="LineNr">480 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: (\"</span>foo\<span class="Constant">" \"</span>address\<span class="Constant">" \"</span>array\<span class="Constant">" \"</span>character\<span class="Constant">")}"</span><span class="Delimiter">);</span> <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> test_replace_type_ingredients_head_middle<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L484" class="LineNr">484 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_elem [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L485" class="LineNr">485 </span> <span class="Constant">" x:_elem</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L486" class="LineNr">486 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L487" class="LineNr">487 </span> <span class="Constant">"container bar:_elem [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L488" class="LineNr">488 </span> <span class="Constant">" x:foo:_elem:num</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L489" class="LineNr">489 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L484" class="LineNr">484 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_elem [\n"</span> +<span id="L485" class="LineNr">485 </span> <span class="Constant">" x:_elem\n"</span> +<span id="L486" class="LineNr">486 </span> <span class="Constant">"]\n"</span> +<span id="L487" class="LineNr">487 </span> <span class="Constant">"container bar:_elem [\n"</span> +<span id="L488" class="LineNr">488 </span> <span class="Constant">" x:foo:_elem:num\n"</span> +<span id="L489" class="LineNr">489 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L490" class="LineNr">490 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"x:bar:address"</span><span class="Delimiter">);</span> <span id="L491" class="LineNr">491 </span> reagent element = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L492" class="LineNr">492 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: (</span><span class="cSpecial">\"</span><span class="Constant">foo</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L101'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">number</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> +<span id="L492" class="LineNr">492 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{x: (\"</span>foo\<span class="Constant">" \"</span>address\<span class="Constant">" \"</span>number\<span class="Constant">")}"</span><span class="Delimiter">);</span> <span id="L493" class="LineNr">493 </span><span class="Delimiter">}</span> <span id="L494" class="LineNr">494 </span> <span id="L495" class="LineNr">495 </span><span class="Normal">void</span> test_replace_last_type_ingredient_with_multiple<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L496" class="LineNr">496 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_a:_b [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L497" class="LineNr">497 </span> <span class="Constant">" x:_a</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L498" class="LineNr">498 </span> <span class="Constant">" y:_b</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L499" class="LineNr">499 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L496" class="LineNr">496 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_a:_b [\n"</span> +<span id="L497" class="LineNr">497 </span> <span class="Constant">" x:_a\n"</span> +<span id="L498" class="LineNr">498 </span> <span class="Constant">" y:_b\n"</span> +<span id="L499" class="LineNr">499 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L500" class="LineNr">500 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"{f: (foo number (address array character))}"</span><span class="Delimiter">);</span> <span id="L501" class="LineNr">501 </span> reagent element1 = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L502" class="LineNr">502 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element1<span class="Delimiter">),</span> <span class="Constant">"{x: </span><span class="cSpecial">\"</span><span class="Constant">number</span><span class="cSpecial">\"</span><span class="Constant">}"</span><span class="Delimiter">);</span> +<span id="L502" class="LineNr">502 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element1<span class="Delimiter">),</span> <span class="Constant">"{x: \"</span>number\<span class="Constant">"}"</span><span class="Delimiter">);</span> <span id="L503" class="LineNr">503 </span> reagent element2 = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L504" class="LineNr">504 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element2<span class="Delimiter">),</span> <span class="Constant">"{y: (</span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L101'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">character</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> +<span id="L504" class="LineNr">504 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element2<span class="Delimiter">),</span> <span class="Constant">"{y: (\"</span>address\<span class="Constant">" \"</span>array\<span class="Constant">" \"</span>character\<span class="Constant">")}"</span><span class="Delimiter">);</span> <span id="L505" class="LineNr">505 </span><span class="Delimiter">}</span> <span id="L506" class="LineNr">506 </span> <span id="L507" class="LineNr">507 </span><span class="Normal">void</span> test_replace_last_type_ingredient_inside_compound<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L508" class="LineNr">508 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_a:_b [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L509" class="LineNr">509 </span> <span class="Constant">" {x: (bar _a (address _b))}</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L510" class="LineNr">510 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L508" class="LineNr">508 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_a:_b [\n"</span> +<span id="L509" class="LineNr">509 </span> <span class="Constant">" {x: (bar _a (address _b))}\n"</span> +<span id="L510" class="LineNr">510 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L511" class="LineNr">511 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"f:foo:number:array:character"</span><span class="Delimiter">);</span> <span id="L512" class="LineNr">512 </span> reagent element = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L513" class="LineNr">513 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span>names_to_string_without_quotes<span class="Delimiter">(</span>element<span class="Delimiter">.</span>type<span class="Delimiter">),</span> <span class="Constant">"(bar number (address array character))"</span><span class="Delimiter">);</span> <span id="L514" class="LineNr">514 </span><span class="Delimiter">}</span> <span id="L515" class="LineNr">515 </span> <span id="L516" class="LineNr">516 </span><span class="Normal">void</span> test_replace_middle_type_ingredient_with_multiple<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L517" class="LineNr">517 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_a:_b:_c [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L518" class="LineNr">518 </span> <span class="Constant">" x:_a</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L519" class="LineNr">519 </span> <span class="Constant">" y:_b</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L520" class="LineNr">520 </span> <span class="Constant">" z:_c</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L521" class="LineNr">521 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L517" class="LineNr">517 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_a:_b:_c [\n"</span> +<span id="L518" class="LineNr">518 </span> <span class="Constant">" x:_a\n"</span> +<span id="L519" class="LineNr">519 </span> <span class="Constant">" y:_b\n"</span> +<span id="L520" class="LineNr">520 </span> <span class="Constant">" z:_c\n"</span> +<span id="L521" class="LineNr">521 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L522" class="LineNr">522 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"{f: (foo number (address array character) boolean)}"</span><span class="Delimiter">);</span> <span id="L523" class="LineNr">523 </span> reagent element1 = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L524" class="LineNr">524 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element1<span class="Delimiter">),</span> <span class="Constant">"{x: </span><span class="cSpecial">\"</span><span class="Constant">number</span><span class="cSpecial">\"</span><span class="Constant">}"</span><span class="Delimiter">);</span> +<span id="L524" class="LineNr">524 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element1<span class="Delimiter">),</span> <span class="Constant">"{x: \"</span>number\<span class="Constant">"}"</span><span class="Delimiter">);</span> <span id="L525" class="LineNr">525 </span> reagent element2 = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L526" class="LineNr">526 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element2<span class="Delimiter">),</span> <span class="Constant">"{y: (</span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L101'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">character</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> +<span id="L526" class="LineNr">526 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element2<span class="Delimiter">),</span> <span class="Constant">"{y: (\"</span>address\<span class="Constant">" \"</span>array\<span class="Constant">" \"</span>character\<span class="Constant">")}"</span><span class="Delimiter">);</span> <span id="L527" class="LineNr">527 </span> reagent element3 = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">2</span><span class="Delimiter">);</span> -<span id="L528" class="LineNr">528 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element3<span class="Delimiter">),</span> <span class="Constant">"{z: </span><span class="cSpecial">\"</span><span class="Constant">boolean</span><span class="cSpecial">\"</span><span class="Constant">}"</span><span class="Delimiter">);</span> +<span id="L528" class="LineNr">528 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element3<span class="Delimiter">),</span> <span class="Constant">"{z: \"</span>boolean\<span class="Constant">"}"</span><span class="Delimiter">);</span> <span id="L529" class="LineNr">529 </span><span class="Delimiter">}</span> <span id="L530" class="LineNr">530 </span> <span id="L531" class="LineNr">531 </span><span class="Normal">void</span> test_replace_middle_type_ingredient_with_multiple2<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L532" class="LineNr">532 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_key:_value [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L533" class="LineNr">533 </span> <span class="Constant">" key:_key</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L534" class="LineNr">534 </span> <span class="Constant">" value:_value</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L535" class="LineNr">535 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L532" class="LineNr">532 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_key:_value [\n"</span> +<span id="L533" class="LineNr">533 </span> <span class="Constant">" key:_key\n"</span> +<span id="L534" class="LineNr">534 </span> <span class="Constant">" value:_value\n"</span> +<span id="L535" class="LineNr">535 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L536" class="LineNr">536 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"{f: (foo (address array character) number)}"</span><span class="Delimiter">);</span> <span id="L537" class="LineNr">537 </span> reagent element = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L538" class="LineNr">538 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{key: (</span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L101'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">character</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> +<span id="L538" class="LineNr">538 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{key: (\"</span>address\<span class="Constant">" \"</span>array\<span class="Constant">" \"</span>character\<span class="Constant">")}"</span><span class="Delimiter">);</span> <span id="L539" class="LineNr">539 </span><span class="Delimiter">}</span> <span id="L540" class="LineNr">540 </span> <span id="L541" class="LineNr">541 </span><span class="Normal">void</span> test_replace_middle_type_ingredient_with_multiple3<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L542" class="LineNr">542 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo_table:_key:_value [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L543" class="LineNr">543 </span> <span class="Constant">" data:&:@:foo_table_row:_key:_value</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L544" class="LineNr">544 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L545" class="LineNr">545 </span> <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L546" class="LineNr">546 </span> <span class="Constant">"container foo_table_row:_key:_value [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L547" class="LineNr">547 </span> <span class="Constant">" key:_key</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L548" class="LineNr">548 </span> <span class="Constant">" value:_value</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L549" class="LineNr">549 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L542" class="LineNr">542 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo_table:_key:_value [\n"</span> +<span id="L543" class="LineNr">543 </span> <span class="Constant">" data:&:@:foo_table_row:_key:_value\n"</span> +<span id="L544" class="LineNr">544 </span> <span class="Constant">"]\n"</span> +<span id="L545" class="LineNr">545 </span> <span class="Constant">"\n"</span> +<span id="L546" class="LineNr">546 </span> <span class="Constant">"container foo_table_row:_key:_value [\n"</span> +<span id="L547" class="LineNr">547 </span> <span class="Constant">" key:_key\n"</span> +<span id="L548" class="LineNr">548 </span> <span class="Constant">" value:_value\n"</span> +<span id="L549" class="LineNr">549 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L550" class="LineNr">550 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"{f: (foo_table (address array character) number)}"</span><span class="Delimiter">);</span> <span id="L551" class="LineNr">551 </span> reagent element = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L552" class="LineNr">552 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{data: (</span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L101'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">foo_table_row</span><span class="cSpecial">\"</span><span class="Constant"> (</span><span class="cSpecial">\"</span><span class="Constant"><a href='043space.cc.html#L101'>address</a></span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">array</span><span class="cSpecial">\"</span><span class="Constant"> </span><span class="cSpecial">\"</span><span class="Constant">character</span><span class="cSpecial">\"</span><span class="Constant">) </span><span class="cSpecial">\"</span><span class="Constant">number</span><span class="cSpecial">\"</span><span class="Constant">)}"</span><span class="Delimiter">);</span> +<span id="L552" class="LineNr">552 </span> <a href='002test.cc.html#L31'>CHECK_EQ</a><span class="Delimiter">(</span><a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>element<span class="Delimiter">),</span> <span class="Constant">"{data: (\"</span>address\<span class="Constant">" \"</span>array\<span class="Constant">" \"</span>foo_table_row\<span class="Constant">" (\"</span>address\<span class="Constant">" \"</span>array\<span class="Constant">" \"</span>character\<span class="Constant">") \"</span>number\<span class="Constant">")}"</span><span class="Delimiter">);</span> <span id="L553" class="LineNr">553 </span><span class="Delimiter">}</span> <span id="L554" class="LineNr">554 </span> <span id="L555" class="LineNr">555 </span><span class="Delimiter">:(code)</span> diff --git a/html/056shape_shifting_recipe.cc.html b/html/056shape_shifting_recipe.cc.html index 498320b6..c7af3430 100644 --- a/html/056shape_shifting_recipe.cc.html +++ b/html/056shape_shifting_recipe.cc.html @@ -11,23 +11,25 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } .SalientComment { color: #00ffff; } .CommentedCode { color: #6c6c6c; } .muRecipe { color: #ff8700; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .traceContains { color: #008000; } .muData { color: #ffff00; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -62,6 +64,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/056shape_shifting_recipe.cc'>https://github.com/akkartik/mu/blob/master/056shape_shifting_recipe.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">//:: Like container definitions, recipes too can contain type parameters.</span> <span id="L2" class="LineNr"> 2 </span> @@ -96,11 +99,11 @@ if ('onhashchange' in window) { <span id="L31" class="LineNr"> 31 </span> <span id="L32" class="LineNr"> 32 </span><span class="Delimiter">:(before "End Transform Checks")</span> <span id="L33" class="LineNr"> 33 </span>r<span class="Delimiter">.</span>transformed_until = t<span class="Delimiter">;</span> -<span id="L34" class="LineNr"> 34 </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="Normal">static_cast</span><transform_fn><span class="Delimiter">(</span>expand_type_abbreviations<span class="Delimiter">)</span> && <a href='056shape_shifting_recipe.cc.html#L156'>any_type_ingredient_in_header</a><span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment"><a href='010vm.cc.html#L14'>recipe_ordinal</a></span><span class="Comment">*/</span>p<span class="Delimiter">-></span>first<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L34" class="LineNr"> 34 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Transform</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>t<span class="Delimiter">)</span> != <span class="Normal">static_cast</span><transform_fn><span class="Delimiter">(</span>expand_type_abbreviations<span class="Delimiter">)</span> && <a href='056shape_shifting_recipe.cc.html#L156'>any_type_ingredient_in_header</a><span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment"><a href='010vm.cc.html#L14'>recipe_ordinal</a></span><span class="Comment">*/</span>p<span class="Delimiter">-></span>first<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L35" class="LineNr"> 35 </span> <span id="L36" class="LineNr"> 36 </span><span class="Delimiter">:(after "Running One Instruction")</span> -<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#L156'>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="L37" class="LineNr"> 37 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Current_routine</span><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#L156'>any_type_ingredient_in_header</a><span class="Delimiter">(</span><span class="Special">Current_routine</span><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#L196'>raise</a> << <span class="Constant">"ran into unspecialized shape-shifting <a href='010vm.cc.html#L19'>recipe</a> "</span> << <a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">()</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L41" class="LineNr"> 41 </span><span class="CommentedCode">//? exit(0);</span> @@ -115,7 +118,7 @@ if ('onhashchange' in window) { <span id="L50" class="LineNr"> 50 </span>candidates = <a href='056shape_shifting_recipe.cc.html#L73'>strictly_matching_shape_shifting_variants</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> variants<span class="Delimiter">);</span> <span id="L51" class="LineNr"> 51 </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="L52" class="LineNr"> 52 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> exemplar = <a href='056shape_shifting_recipe.cc.html#L106'>best_shape_shifting_variant</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> candidates<span class="Delimiter">);</span> -<span id="L53" class="LineNr"> 53 </span> <a href='003trace.cc.html#L189'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L53" class="LineNr"> 53 </span> <a href='003trace.cc.html#L189'>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><span class="Special">Recipe</span><span class="Delimiter">,</span> exemplar<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L54" class="LineNr"> 54 </span> string new_recipe_name = <a href='056shape_shifting_recipe.cc.html#L241'>insert_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="L55" class="LineNr"> 55 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>new_recipe_name != <span class="Constant">""</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L56" class="LineNr"> 56 </span> <a href='003trace.cc.html#L189'>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> << new_recipe_name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> @@ -127,9 +130,9 @@ if ('onhashchange' in window) { <span id="L62" class="LineNr"> 62 </span><span class="Comment">//: recipes can be called</span> <span id="L63" class="LineNr"> 63 </span> <span id="L64" class="LineNr"> 64 </span><span class="Delimiter">:(before "End Instruction Operation Checks")</span> -<span id="L65" class="LineNr"> 65 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">)</span> && !is_primitive<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">)</span> +<span id="L65" class="LineNr"> 65 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">)</span> && !is_primitive<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">)</span> <span id="L66" class="LineNr"> 66 </span> && <a href='056shape_shifting_recipe.cc.html#L156'>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="L67" class="LineNr"> 67 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L67" class="LineNr"> 67 </span> <a href='003trace.cc.html#L196'>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\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L68" class="LineNr"> 68 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L69" class="LineNr"> 69 </span><span class="Delimiter">}</span> <span id="L70" class="LineNr"> 70 </span> @@ -140,7 +143,7 @@ if ('onhashchange' in window) { <span id="L75" class="LineNr"> 75 </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#L141'>SIZE</a><span class="Delimiter">(</span>variants<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L76" class="LineNr"> 76 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)</span> == -<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L77" class="LineNr"> 77 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!any_type_ingredient_in_header<span class="Delimiter">(</span>variants<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="L78" class="LineNr"> 78 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!all_concrete_header_reagents_strictly_match<span class="Delimiter">(</span>inst<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> variants<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="L78" class="LineNr"> 78 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!all_concrete_header_reagents_strictly_match<span class="Delimiter">(</span>inst<span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> variants<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="L79" class="LineNr"> 79 </span> result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>variants<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span id="L80" class="LineNr"> 80 </span> <span class="Delimiter">}</span> <span id="L81" class="LineNr"> 81 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> @@ -182,10 +185,10 @@ if ('onhashchange' in window) { <span id="L117" class="LineNr"> 117 </span><span class="CommentedCode">//? cerr << "C picking shape-shifting variant:\n";</span> <span id="L118" class="LineNr"> 118 </span> vector<recipe_ordinal> result3 = <a href='056shape_shifting_recipe.cc.html#L128'>keep_max</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> result2<span class="Delimiter">,</span> number_of_type_ingredients<span class="Delimiter">);</span> <span id="L119" class="LineNr"> 119 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>result3<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L120" class="LineNr"> 120 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">Couldn't decide the best shape-shifting variant for instruction '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> -<span id="L121" class="LineNr"> 121 </span> cerr << <span class="Constant">"This is a hole in Mu. Please copy the following candidates into an email to Kartik Agaram <mu@akkartik.com></span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L120" class="LineNr"> 120 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"\nCouldn't decide the best shape-shifting variant for instruction '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> +<span id="L121" class="LineNr"> 121 </span> cerr << <span class="Constant">"This is a hole in Mu. Please copy the following candidates into an email to Kartik Agaram <mu@akkartik.com>\n"</span><span class="Delimiter">;</span> <span id="L122" class="LineNr"> 122 </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#L141'>SIZE</a><span class="Delimiter">(</span>candidates<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> -<span id="L123" class="LineNr"> 123 </span> cerr << <span class="Constant">" "</span> << header_label<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> candidates<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L123" class="LineNr"> 123 </span> cerr << <span class="Constant">" "</span> << header_label<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> candidates<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L124" class="LineNr"> 124 </span> <span class="Delimiter">}</span> <span id="L125" class="LineNr"> 125 </span> <span class="Identifier">return</span> result3<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L126" class="LineNr"> 126 </span><span class="Delimiter">}</span> @@ -213,13 +216,13 @@ if ('onhashchange' in window) { <span id="L148" class="LineNr"> 148 </span><span class="Delimiter">}</span> <span id="L149" class="LineNr"> 149 </span> <span id="L150" class="LineNr"> 150 </span><span class="Normal">int</span> <a href='056shape_shifting_recipe.cc.html#L150'>arity_fit</a><span class="Delimiter">(</span><span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> candidate<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L151" class="LineNr"> 151 </span> <span class="Normal">const</span> recipe& r = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> candidate<span class="Delimiter">);</span> +<span id="L151" class="LineNr"> 151 </span> <span class="Normal">const</span> recipe& r = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> candidate<span class="Delimiter">);</span> <span id="L152" class="LineNr"> 152 </span> <span class="Identifier">return</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> - <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>products<span class="Delimiter">))</span> <span id="L153" class="LineNr"> 153 </span> + <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> - <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">));</span> <span id="L154" class="LineNr"> 154 </span><span class="Delimiter">}</span> <span id="L155" class="LineNr"> 155 </span> <span id="L156" class="LineNr"> 156 </span><span class="Normal">bool</span> <a href='056shape_shifting_recipe.cc.html#L156'>any_type_ingredient_in_header</a><span class="Delimiter">(</span><a href='010vm.cc.html#L14'>recipe_ordinal</a> variant<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L157" class="LineNr"> 157 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> variant<span class="Delimiter">);</span> +<span id="L157" class="LineNr"> 157 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> variant<span class="Delimiter">);</span> <span id="L158" class="LineNr"> 158 </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#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L159" class="LineNr"> 159 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>contains_type_ingredient_name<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> <span id="L160" class="LineNr"> 160 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> @@ -250,9 +253,9 @@ if ('onhashchange' in window) { <span id="L185" class="LineNr"> 185 </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="L186" class="LineNr"> 186 </span> <span class="Comment">// both from and to are atoms</span> <span id="L187" class="LineNr"> 187 </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="L188" class="LineNr"> 188 </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#L225'>end</a><span class="Delimiter">();</span> +<span id="L188" class="LineNr"> 188 </span> <span class="Identifier">return</span> <span class="Special">Literal_type_names</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>to<span class="Delimiter">-></span>name<span class="Delimiter">)</span> != <span class="Special">Literal_type_names</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L189" class="LineNr"> 189 </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="L190" class="LineNr"> 190 </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#L225'>end</a><span class="Delimiter">();</span> +<span id="L190" class="LineNr"> 190 </span> <span class="Identifier">return</span> <span class="Special">Literal_type_names</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>from<span class="Delimiter">-></span>name<span class="Delimiter">)</span> != <span class="Special">Literal_type_names</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L191" class="LineNr"> 191 </span> <span class="Identifier">return</span> to<span class="Delimiter">-></span>name == from<span class="Delimiter">-></span>name<span class="Delimiter">;</span> <span id="L192" class="LineNr"> 192 </span><span class="Delimiter">}</span> <span id="L193" class="LineNr"> 193 </span> @@ -267,7 +270,7 @@ if ('onhashchange' in window) { <span id="L202" class="LineNr"> 202 </span><span class="Delimiter">}</span> <span id="L203" class="LineNr"> 203 </span> <span id="L204" class="LineNr"> 204 </span><span class="Normal">int</span> number_of_concrete_type_names<span class="Delimiter">(</span><span class="Normal">const</span> instruction& <span class="Comment">/*</span><span class="Comment">unused</span><span class="Comment">*/</span><span class="Delimiter">,</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L205" class="LineNr"> 205 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L205" class="LineNr"> 205 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L206" class="LineNr"> 206 </span> <span class="Normal">int</span> result = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L207" class="LineNr"> 207 </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#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L208" class="LineNr"> 208 </span> result += number_of_concrete_type_names<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">);</span> @@ -285,7 +288,7 @@ if ('onhashchange' in window) { <span id="L220" class="LineNr"> 220 </span><span class="Delimiter">}</span> <span id="L221" class="LineNr"> 221 </span> <span id="L222" class="LineNr"> 222 </span><span class="Normal">int</span> number_of_type_ingredients<span class="Delimiter">(</span><span class="Normal">const</span> instruction& <span class="Comment">/*</span><span class="Comment">unused</span><span class="Comment">*/</span><span class="Delimiter">,</span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L223" class="LineNr"> 223 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L223" class="LineNr"> 223 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L224" class="LineNr"> 224 </span> <span class="Normal">int</span> result = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L225" class="LineNr"> 225 </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#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L226" class="LineNr"> 226 </span> result += number_of_type_ingredients<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">);</span> @@ -305,13 +308,13 @@ if ('onhashchange' in window) { <span id="L240" class="LineNr"> 240 </span><span class="Comment">// returns name of new variant</span> <span id="L241" class="LineNr"> 241 </span>string <a href='056shape_shifting_recipe.cc.html#L241'>insert_new_variant</a><span class="Delimiter">(</span><a href='010vm.cc.html#L14'>recipe_ordinal</a> exemplar<span class="Delimiter">,</span> <span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& caller_recipe<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L242" class="LineNr"> 242 </span> string new_name = <a href='054static_dispatch.cc.html#L111'>next_unused_recipe_name</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name<span class="Delimiter">);</span> -<span id="L243" class="LineNr"> 243 </span> assert<span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> new_name<span class="Delimiter">));</span> -<span id="L244" class="LineNr"> 244 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> new_recipe_ordinal = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> new_name<span class="Delimiter">,</span> Next_recipe_ordinal++<span class="Delimiter">);</span> +<span id="L243" class="LineNr"> 243 </span> assert<span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> new_name<span class="Delimiter">));</span> +<span id="L244" class="LineNr"> 244 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> new_recipe_ordinal = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> new_name<span class="Delimiter">,</span> <span class="Special">Next_recipe_ordinal</span>++<span class="Delimiter">);</span> <span id="L245" class="LineNr"> 245 </span> <span class="Comment">// make a copy</span> -<span id="L246" class="LineNr"> 246 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> exemplar<span class="Delimiter">));</span> -<span id="L247" class="LineNr"> 247 </span> assert<span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> new_recipe_ordinal<span class="Delimiter">));</span> -<span id="L248" class="LineNr"> 248 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> new_recipe_ordinal<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> exemplar<span class="Delimiter">));</span> -<span id="L249" class="LineNr"> 249 </span> recipe& new_recipe = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> new_recipe_ordinal<span class="Delimiter">);</span> +<span id="L246" class="LineNr"> 246 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> exemplar<span class="Delimiter">));</span> +<span id="L247" class="LineNr"> 247 </span> assert<span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> new_recipe_ordinal<span class="Delimiter">));</span> +<span id="L248" class="LineNr"> 248 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> new_recipe_ordinal<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> exemplar<span class="Delimiter">));</span> +<span id="L249" class="LineNr"> 249 </span> recipe& new_recipe = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> new_recipe_ordinal<span class="Delimiter">);</span> <span id="L250" class="LineNr"> 250 </span> new_recipe<span class="Delimiter">.</span>name = new_name<span class="Delimiter">;</span> <span id="L251" class="LineNr"> 251 </span> new_recipe<span class="Delimiter">.</span>ordinal = new_recipe_ordinal<span class="Delimiter">;</span> <span id="L252" class="LineNr"> 252 </span> new_recipe<span class="Delimiter">.</span>is_autogenerated =<span class="Constant"> true</span><span class="Delimiter">;</span> @@ -320,9 +323,9 @@ if ('onhashchange' in window) { <span id="L255" class="LineNr"> 255 </span> <a href='003trace.cc.html#L189'>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> << new_recipe<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L256" class="LineNr"> 256 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << new_recipe<span class="Delimiter">.</span>name << <span class="Constant">": performing transforms until check_or_set_types_by_name"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L257" class="LineNr"> 257 </span> <span class="Normal">int</span> transform_index = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L258" class="LineNr"> 258 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>transform_index = <span class="Constant">0</span><span class="Delimiter">;</span> transform_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Transform<span class="Delimiter">);</span> ++transform_index<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L259" class="LineNr"> 259 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Transform<span class="Delimiter">.</span>at<span class="Delimiter">(</span>transform_index<span class="Delimiter">)</span> == <a href='046check_type_by_name.cc.html#L35'>check_or_set_types_by_name</a><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L260" class="LineNr"> 260 </span> <span class="Delimiter">(</span>*Transform<span class="Delimiter">.</span>at<span class="Delimiter">(</span>transform_index<span class="Delimiter">))(</span>new_recipe_ordinal<span class="Delimiter">);</span> +<span id="L258" class="LineNr"> 258 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>transform_index = <span class="Constant">0</span><span class="Delimiter">;</span> transform_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Transform</span><span class="Delimiter">);</span> ++transform_index<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L259" class="LineNr"> 259 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Transform</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>transform_index<span class="Delimiter">)</span> == <a href='046check_type_by_name.cc.html#L35'>check_or_set_types_by_name</a><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L260" class="LineNr"> 260 </span> <span class="Delimiter">(</span>*<span class="Special">Transform</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>transform_index<span class="Delimiter">))(</span>new_recipe_ordinal<span class="Delimiter">);</span> <span id="L261" class="LineNr"> 261 </span> <span class="Delimiter">}</span> <span id="L262" class="LineNr"> 262 </span> new_recipe<span class="Delimiter">.</span>transformed_until = transform_index-<span class="Constant">1</span><span class="Delimiter">;</span> <span id="L263" class="LineNr"> 263 </span> @@ -334,21 +337,21 @@ if ('onhashchange' in window) { <span id="L269" class="LineNr"> 269 </span> <span class="Delimiter">{</span> <span id="L270" class="LineNr"> 270 </span> map<string<span class="Delimiter">,</span> <span class="Normal">const</span> type_tree*> mappings<span class="Delimiter">;</span> <span id="L271" class="LineNr"> 271 </span> <span class="Normal">bool</span> error =<span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L272" class="LineNr"> 272 </span> <a href='056shape_shifting_recipe.cc.html#L328'>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="L272" class="LineNr"> 272 </span> <a href='056shape_shifting_recipe.cc.html#L328'>compute_type_ingredient_mappings</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><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="L273" class="LineNr"> 273 </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#L141'>SIZE</a><span class="Delimiter">(</span>mappings<span class="Delimiter">)</span> != <a href='056shape_shifting_recipe.cc.html#L466'>type_ingredient_count_in_header</a><span class="Delimiter">(</span>exemplar<span class="Delimiter">));</span> <span id="L274" class="LineNr"> 274 </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="L275" class="LineNr"> 275 </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#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span id="L276" class="LineNr"> 276 </span> <span class="Normal">delete</span> p<span class="Delimiter">-></span>second<span class="Delimiter">;</span> <span id="L277" class="LineNr"> 277 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>error<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">""</span><span class="Delimiter">;</span> <span id="L278" class="LineNr"> 278 </span> <span class="Delimiter">}</span> -<span id="L279" class="LineNr"> 279 </span> ensure_all_concrete_types<span class="Delimiter">(</span>new_recipe<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> exemplar<span class="Delimiter">));</span> +<span id="L279" class="LineNr"> 279 </span> ensure_all_concrete_types<span class="Delimiter">(</span>new_recipe<span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> exemplar<span class="Delimiter">));</span> <span id="L280" class="LineNr"> 280 </span> <span id="L281" class="LineNr"> 281 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << new_recipe<span class="Delimiter">.</span>name << <span class="Constant">": recording the new variant before recursively calling resolve_ambiguous_calls"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L282" class="LineNr"> 282 </span> get<span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>new_recipe_ordinal<span class="Delimiter">);</span> +<span id="L282" class="LineNr"> 282 </span> get<span class="Delimiter">(</span><span class="Special">Recipe_variants</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>new_recipe_ordinal<span class="Delimiter">);</span> <span id="L283" class="LineNr"> 283 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << new_recipe<span class="Delimiter">.</span>name << <span class="Constant">": performing remaining transforms (including resolve_ambiguous_calls)"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L284" class="LineNr"> 284 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">nada</span><span class="Comment">*/</span><span class="Delimiter">;</span> transform_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Transform<span class="Delimiter">);</span> ++transform_index<span class="Delimiter">)</span> -<span id="L285" class="LineNr"> 285 </span> <span class="Delimiter">(</span>*Transform<span class="Delimiter">.</span>at<span class="Delimiter">(</span>transform_index<span class="Delimiter">))(</span>new_recipe_ordinal<span class="Delimiter">);</span> -<span id="L286" class="LineNr"> 286 </span> new_recipe<span class="Delimiter">.</span>transformed_until = <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Transform<span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L284" class="LineNr"> 284 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">nada</span><span class="Comment">*/</span><span class="Delimiter">;</span> transform_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Transform</span><span class="Delimiter">);</span> ++transform_index<span class="Delimiter">)</span> +<span id="L285" class="LineNr"> 285 </span> <span class="Delimiter">(</span>*<span class="Special">Transform</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>transform_index<span class="Delimiter">))(</span>new_recipe_ordinal<span class="Delimiter">);</span> +<span id="L286" class="LineNr"> 286 </span> new_recipe<span class="Delimiter">.</span>transformed_until = <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Transform</span><span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">;</span> <span id="L287" class="LineNr"> 287 </span> <span class="Identifier">return</span> new_recipe<span class="Delimiter">.</span>name<span class="Delimiter">;</span> <span id="L288" class="LineNr"> 288 </span><span class="Delimiter">}</span> <span id="L289" class="LineNr"> 289 </span> @@ -381,7 +384,7 @@ if ('onhashchange' in window) { <span id="L316" class="LineNr"> 316 </span> <span class="Comment">// We've found it useful in the past for tracking down bugs in</span> <span id="L317" class="LineNr"> 317 </span> <span class="Comment">// specialization.</span> <span id="L318" class="LineNr"> 318 </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="L319" class="LineNr"> 319 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L319" class="LineNr"> 319 </span> <a href='003trace.cc.html#L196'>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)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L320" class="LineNr"> 320 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L321" class="LineNr"> 321 </span> <span class="Delimiter">}</span> <span id="L322" class="LineNr"> 322 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><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> @@ -420,7 +423,7 @@ if ('onhashchange' in window) { <span id="L355" class="LineNr"> 355 </span> <span class="Comment">// probably a bug in mu</span> <span id="L356" class="LineNr"> 356 </span> <span class="Comment">// todo: make this smarter; only flag an error if exemplar_type contains some *new* type ingredient</span> <span id="L357" class="LineNr"> 357 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> -<span id="L358" class="LineNr"> 358 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L358" class="LineNr"> 358 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" (called from '"</span> << to_original_string<span class="Delimiter">(</span>call_instruction<span class="Delimiter">)</span> << <span class="Constant">"')\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L359" class="LineNr"> 359 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L360" class="LineNr"> 360 </span> <span class="Delimiter">}</span> <span id="L361" class="LineNr"> 361 </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> @@ -442,7 +445,7 @@ if ('onhashchange' in window) { <span id="L377" class="LineNr"> 377 </span> <span class="Delimiter">}</span> <span id="L378" class="LineNr"> 378 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L379" class="LineNr"> 379 </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="L380" class="LineNr"> 380 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L380" class="LineNr"> 380 </span> <a href='003trace.cc.html#L196'>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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L381" class="LineNr"> 381 </span> *error =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L382" class="LineNr"> 382 </span> <span class="Normal">delete</span> curr_refinement_type<span class="Delimiter">;</span> <span id="L383" class="LineNr"> 383 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> @@ -492,7 +495,7 @@ if ('onhashchange' in window) { <span id="L427" class="LineNr"> 427 </span> string before = <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>x<span class="Delimiter">);</span> <span id="L428" class="LineNr"> 428 </span> <a href='003trace.cc.html#L189'>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#L225'>end</a><span class="Delimiter">();</span> <span id="L429" class="LineNr"> 429 </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="L430" class="LineNr"> 430 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L430" class="LineNr"> 430 </span> <a href='003trace.cc.html#L196'>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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L431" class="LineNr"> 431 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L432" class="LineNr"> 432 </span> <span class="Delimiter">}</span> <span id="L433" class="LineNr"> 433 </span> replace_type_ingredients<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">,</span> mappings<span class="Delimiter">);</span> @@ -509,19 +512,19 @@ if ('onhashchange' in window) { <span id="L444" class="LineNr"> 444 </span> replace_type_ingredients<span class="Delimiter">(</span>type<span class="Delimiter">-></span>right<span class="Delimiter">,</span> mappings<span class="Delimiter">);</span> <span id="L445" class="LineNr"> 445 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L446" class="LineNr"> 446 </span> <span class="Delimiter">}</span> -<span id="L447" class="LineNr"> 447 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Comment">// todo: ugly side effect</span> -<span id="L448" class="LineNr"> 448 </span> type<span class="Delimiter">-></span>value = get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> +<span id="L447" class="LineNr"> 447 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Comment">// todo: ugly side effect</span> +<span id="L448" class="LineNr"> 448 </span> type<span class="Delimiter">-></span>value = get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> <span id="L449" class="LineNr"> 449 </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="L450" class="LineNr"> 450 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L451" class="LineNr"> 451 </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="L452" class="LineNr"> 452 </span> <a href='003trace.cc.html#L189'>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#L225'>end</a><span class="Delimiter">();</span> <span id="L453" class="LineNr"> 453 </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="L454" class="LineNr"> 454 </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="L454" class="LineNr"> 454 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> replacement<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L455" class="LineNr"> 455 </span> <span class="Comment">// error in program; should be reported elsewhere</span> <span id="L456" class="LineNr"> 456 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L457" class="LineNr"> 457 </span> <span class="Delimiter">}</span> <span id="L458" class="LineNr"> 458 </span> type<span class="Delimiter">-></span>name = <span class="Delimiter">(</span>replacement<span class="Delimiter">-></span>name == <span class="Constant">"literal"</span><span class="Delimiter">)</span> ? <span class="Constant">"number"</span> : replacement<span class="Delimiter">-></span>name<span class="Delimiter">;</span> -<span id="L459" class="LineNr"> 459 </span> type<span class="Delimiter">-></span>value = get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> +<span id="L459" class="LineNr"> 459 </span> type<span class="Delimiter">-></span>value = get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>name<span class="Delimiter">);</span> <span id="L460" class="LineNr"> 460 </span> <span class="Delimiter">}</span> <span id="L461" class="LineNr"> 461 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L462" class="LineNr"> 462 </span> *type = *replacement<span class="Delimiter">;</span> @@ -529,7 +532,7 @@ if ('onhashchange' in window) { <span id="L464" class="LineNr"> 464 </span><span class="Delimiter">}</span> <span id="L465" class="LineNr"> 465 </span> <span id="L466" class="LineNr"> 466 </span><span class="Normal">int</span> <a href='056shape_shifting_recipe.cc.html#L466'>type_ingredient_count_in_header</a><span class="Delimiter">(</span><a href='010vm.cc.html#L14'>recipe_ordinal</a> variant<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L467" class="LineNr"> 467 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> variant<span class="Delimiter">);</span> +<span id="L467" class="LineNr"> 467 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> variant<span class="Delimiter">);</span> <span id="L468" class="LineNr"> 468 </span> set<string> type_ingredients<span class="Delimiter">;</span> <span id="L469" class="LineNr"> 469 </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#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span id="L470" class="LineNr"> 470 </span> accumulate_type_ingredients<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>type<span class="Delimiter">,</span> type_ingredients<span class="Delimiter">);</span> @@ -736,21 +739,21 @@ if ('onhashchange' in window) { <span id="L671" class="LineNr"> 671 </span><span class="Comment">// this one needs a little more fine-grained control</span> <span id="L672" class="LineNr"> 672 </span><span class="Normal">void</span> <a href='056shape_shifting_recipe.cc.html#L672'>test_shape_shifting_new_ingredient_does_not_pollute_global_namespace</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> <span id="L673" class="LineNr"> 673 </span> <span class="Comment">// if you specialize a shape-shifting recipe that allocates a type-ingredient..</span> -<span id="L674" class="LineNr"> 674 </span> <a href='012transform.cc.html#L99'>transform</a><span class="Delimiter">(</span><span class="Constant">"def barz x:_elem [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L675" class="LineNr"> 675 </span> <span class="Constant">" local-scope</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L676" class="LineNr"> 676 </span> <span class="Constant">" load-ingredients</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L677" class="LineNr"> 677 </span> <span class="Constant">" y:&:num <- new _elem:type</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L678" class="LineNr"> 678 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L679" class="LineNr"> 679 </span> <span class="Constant">"def fooz [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L680" class="LineNr"> 680 </span> <span class="Constant">" local-scope</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L681" class="LineNr"> 681 </span> <span class="Constant">" barz 34</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L682" class="LineNr"> 682 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L674" class="LineNr"> 674 </span> <a href='012transform.cc.html#L99'>transform</a><span class="Delimiter">(</span><span class="Constant">"def barz x:_elem [\n"</span> +<span id="L675" class="LineNr"> 675 </span> <span class="Constant">" local-scope\n"</span> +<span id="L676" class="LineNr"> 676 </span> <span class="Constant">" load-ingredients\n"</span> +<span id="L677" class="LineNr"> 677 </span> <span class="Constant">" y:&:num <- new _elem:type\n"</span> +<span id="L678" class="LineNr"> 678 </span> <span class="Constant">"]\n"</span> +<span id="L679" class="LineNr"> 679 </span> <span class="Constant">"def fooz [\n"</span> +<span id="L680" class="LineNr"> 680 </span> <span class="Constant">" local-scope\n"</span> +<span id="L681" class="LineNr"> 681 </span> <span class="Constant">" barz 34\n"</span> +<span id="L682" class="LineNr"> 682 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L683" class="LineNr"> 683 </span> <span class="Comment">// ..and if you then try to load a new shape-shifting container with that</span> <span id="L684" class="LineNr"> 684 </span> <span class="Comment">// type-ingredient</span> -<span id="L685" class="LineNr"> 685 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_elem [</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L686" class="LineNr"> 686 </span> <span class="Constant">" x:_elem</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L687" class="LineNr"> 687 </span> <span class="Constant">" y:num</span><span class="cSpecial">\n</span><span class="Constant">"</span> -<span id="L688" class="LineNr"> 688 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L685" class="LineNr"> 685 </span> run<span class="Delimiter">(</span><span class="Constant">"container foo:_elem [\n"</span> +<span id="L686" class="LineNr"> 686 </span> <span class="Constant">" x:_elem\n"</span> +<span id="L687" class="LineNr"> 687 </span> <span class="Constant">" y:num\n"</span> +<span id="L688" class="LineNr"> 688 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L689" class="LineNr"> 689 </span> <span class="Comment">// then it should work as usual</span> <span id="L690" class="LineNr"> 690 </span> reagent callsite<span class="Delimiter">(</span><span class="Constant">"x:foo:point"</span><span class="Delimiter">);</span> <span id="L691" class="LineNr"> 691 </span> reagent element = <a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>callsite<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> diff --git a/html/057immutable.cc.html b/html/057immutable.cc.html index 7de41706..e329f342 100644 --- a/html/057immutable.cc.html +++ b/html/057immutable.cc.html @@ -11,21 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.cSpecial { color: #008000; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -60,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/057immutable.cc'>https://github.com/akkartik/mu/blob/master/057immutable.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Ingredients of a recipe are meant to be immutable unless they're also</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: products. This layer will start enforcing this check.</span> @@ -398,7 +400,7 @@ if ('onhashchange' in window) { <span id="L335" class="LineNr">335 </span>$error: <span class="Constant">0</span> <span id="L336" class="LineNr">336 </span> <span id="L337" class="LineNr">337 </span><span class="Delimiter">:(before "End Transforms")</span> -<span id="L338" class="LineNr">338 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='057immutable.cc.html#L341'>check_immutable_ingredients</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L338" class="LineNr">338 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='057immutable.cc.html#L341'>check_immutable_ingredients</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L339" class="LineNr">339 </span> <span id="L340" class="LineNr">340 </span><span class="Delimiter">:(code)</span> <span id="L341" class="LineNr">341 </span><span class="Normal">void</span> <a href='057immutable.cc.html#L341'>check_immutable_ingredients</a><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> @@ -406,7 +408,7 @@ if ('onhashchange' in window) { <span id="L343" class="LineNr">343 </span> <span class="Comment">// a) we never write to its contents directly,</span> <span id="L344" class="LineNr">344 </span> <span class="Comment">// b) we never call 'put' or 'put-index' on it, and</span> <span id="L345" class="LineNr">345 </span> <span class="Comment">// c) any non-primitive recipe calls in the body aren't returning it as a product</span> -<span id="L346" class="LineNr">346 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L346" class="LineNr">346 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L347" class="LineNr">347 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- check mutability of ingredients in <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L348" class="LineNr">348 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!caller<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">// skip check for old-style recipes calling next-ingredient directly</span> <span id="L349" class="LineNr">349 </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#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -426,7 +428,7 @@ if ('onhashchange' in window) { <span id="L363" class="LineNr">363 </span> <span id="L364" class="LineNr">364 </span><span class="Normal">void</span> <a href='057immutable.cc.html#L364'>update_aliases</a><span class="Delimiter">(</span><span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> set<reagent<span class="Delimiter">,</span> name_and_space_lt>& current_ingredient_and_aliases<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L365" class="LineNr">365 </span> set<<span class="Normal">int</span>> current_ingredient_indices = <a href='057immutable.cc.html#L544'>ingredient_indices</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> current_ingredient_and_aliases<span class="Delimiter">);</span> -<span id="L366" class="LineNr">366 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L366" class="LineNr">366 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L367" class="LineNr">367 </span> <span class="Comment">// primitive recipe</span> <span id="L368" class="LineNr">368 </span> <span class="Normal">switch</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L369" class="LineNr">369 </span> <span class="Normal">case</span> <a href='010vm.cc.html#L196'>COPY</a>: @@ -457,7 +459,7 @@ if ('onhashchange' in window) { <span id="L394" class="LineNr">394 </span> <span id="L395" class="LineNr">395 </span>set<<span class="Normal">int</span>> <a href='057immutable.cc.html#L395'>scan_contained_in_product_indices</a><span class="Delimiter">(</span><span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> set<<span class="Normal">int</span>>& <a href='057immutable.cc.html#L544'>ingredient_indices</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L396" class="LineNr">396 </span> set<reagent<span class="Delimiter">,</span> name_and_space_lt> selected_ingredients<span class="Delimiter">;</span> -<span id="L397" class="LineNr">397 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">);</span> +<span id="L397" class="LineNr">397 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">);</span> <span id="L398" class="LineNr">398 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>set<<span class="Normal">int</span>>::iterator p = <a href='057immutable.cc.html#L544'>ingredient_indices</a><span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <a href='057immutable.cc.html#L544'>ingredient_indices</a><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L399" class="LineNr">399 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*p >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>callee<span class="Delimiter">.</span>ingredients<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// optional immutable ingredient</span> <span id="L400" class="LineNr">400 </span> selected_ingredients<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>callee<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>*p<span class="Delimiter">));</span> @@ -480,8 +482,8 @@ if ('onhashchange' in window) { <span id="L417" class="LineNr">417 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span id="L418" class="LineNr">418 </span> <span class="Identifier">return</span> is_mu_container<span class="Delimiter">(</span>get_base_type<span class="Delimiter">(</span>type<span class="Delimiter">));</span> <span id="L419" class="LineNr">419 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L420" class="LineNr">420 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> -<span id="L421" class="LineNr">421 </span> type_info& info = get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> +<span id="L420" class="LineNr">420 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> +<span id="L421" class="LineNr">421 </span> type_info& info = get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> <span id="L422" class="LineNr">422 </span> <span class="Identifier">return</span> info<span class="Delimiter">.</span>kind == <a href='010vm.cc.html#L180'>CONTAINER</a><span class="Delimiter">;</span> <span id="L423" class="LineNr">423 </span><span class="Delimiter">}</span> <span id="L424" class="LineNr">424 </span> @@ -493,8 +495,8 @@ if ('onhashchange' in window) { <span id="L430" class="LineNr">430 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span id="L431" class="LineNr">431 </span> <span class="Identifier">return</span> is_mu_exclusive_container<span class="Delimiter">(</span>get_base_type<span class="Delimiter">(</span>type<span class="Delimiter">));</span> <span id="L432" class="LineNr">432 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type<span class="Delimiter">-></span>value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L433" class="LineNr">433 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> -<span id="L434" class="LineNr">434 </span> type_info& info = get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> +<span id="L433" class="LineNr">433 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// error raised elsewhere</span> +<span id="L434" class="LineNr">434 </span> type_info& info = get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> <span id="L435" class="LineNr">435 </span> <span class="Identifier">return</span> info<span class="Delimiter">.</span>kind == <a href='010vm.cc.html#L181'>EXCLUSIVE_CONTAINER</a><span class="Delimiter">;</span> <span id="L436" class="LineNr">436 </span><span class="Delimiter">}</span> <span id="L437" class="LineNr">437 </span> @@ -545,9 +547,9 @@ if ('onhashchange' in window) { <span id="L482" class="LineNr">482 </span> && current_ingredient_and_aliases<span class="Delimiter">.</span>find<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> != current_ingredient_and_aliases<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L483" class="LineNr">483 </span> string current_product_name = inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">;</span> <span id="L484" class="LineNr">484 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>current_product_name == original_ingredient_name<span class="Delimiter">)</span> -<span id="L485" class="LineNr">485 </span> <a href='003trace.cc.html#L196'>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">"cannot modify '"</span> << current_product_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because it's an ingredient of recipe "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L485" class="LineNr">485 </span> <a href='003trace.cc.html#L196'>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">"cannot modify '"</span> << current_product_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because it's an ingredient of recipe "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product\n"</span> << end<span class="Delimiter">();</span> <span id="L486" class="LineNr">486 </span> <span class="Normal">else</span> -<span id="L487" class="LineNr">487 </span> <a href='003trace.cc.html#L196'>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">"cannot modify '"</span> << current_product_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because that would modify "</span> << original_ingredient_name << <span class="Constant">" which is an ingredient of <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L487" class="LineNr">487 </span> <a href='003trace.cc.html#L196'>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">"cannot modify '"</span> << current_product_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because that would modify "</span> << original_ingredient_name << <span class="Constant">" which is an ingredient of <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L488" class="LineNr">488 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L489" class="LineNr">489 </span> <span class="Delimiter">}</span> <span id="L490" class="LineNr">490 </span> <span class="Delimiter">}</span> @@ -559,7 +561,7 @@ if ('onhashchange' in window) { <span id="L496" class="LineNr">496 </span> reagent current_ingredient = inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>current_ingredient_index<span class="Delimiter">);</span> <span id="L497" class="LineNr">497 </span> canonize_type<span class="Delimiter">(</span>current_ingredient<span class="Delimiter">);</span> <span id="L498" class="LineNr">498 </span> <span class="Normal">const</span> string& current_ingredient_name = current_ingredient<span class="Delimiter">.</span>name<span class="Delimiter">;</span> -<span id="L499" class="LineNr">499 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L499" class="LineNr">499 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L500" class="LineNr">500 </span> <span class="Comment">// primitive recipe</span> <span id="L501" class="LineNr">501 </span> <span class="Comment">// we got here only because we got an instruction with an implicit product, and the instruction didn't explicitly spell it out</span> <span id="L502" class="LineNr">502 </span> <span class="Comment">// put x, y:offset, z</span> @@ -568,9 +570,9 @@ if ('onhashchange' in window) { <span id="L505" class="LineNr">505 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation == PUT || inst<span class="Delimiter">.</span>operation == PUT_INDEX<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L506" class="LineNr">506 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>current_ingredient_index == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L507" class="LineNr">507 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>current_ingredient_name == original_ingredient_name<span class="Delimiter">)</span> -<span id="L508" class="LineNr">508 </span> <a href='003trace.cc.html#L196'>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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because it's an ingredient of recipe "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L508" class="LineNr">508 </span> <a href='003trace.cc.html#L196'>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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because it's an ingredient of recipe "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product\n"</span> << end<span class="Delimiter">();</span> <span id="L509" class="LineNr">509 </span> <span class="Normal">else</span> -<span id="L510" class="LineNr">510 </span> <a href='003trace.cc.html#L196'>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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because that would modify '"</span> << original_ingredient_name << <span class="Constant">"' which is an ingredient of <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L510" class="LineNr">510 </span> <a href='003trace.cc.html#L196'>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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because that would modify '"</span> << original_ingredient_name << <span class="Constant">"' which is an ingredient of <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L511" class="LineNr">511 </span> <span class="Delimiter">}</span> <span id="L512" class="LineNr">512 </span> <span class="Delimiter">}</span> <span id="L513" class="LineNr">513 </span> <span class="Delimiter">}</span> @@ -578,18 +580,18 @@ if ('onhashchange' in window) { <span id="L515" class="LineNr">515 </span> <span class="Comment">// defined recipe</span> <span id="L516" class="LineNr">516 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='057immutable.cc.html#L526'>is_modified_in_recipe</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">,</span> current_ingredient_index<span class="Delimiter">,</span> caller<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L517" class="LineNr">517 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>current_ingredient_name == original_ingredient_name<span class="Delimiter">)</span> -<span id="L518" class="LineNr">518 </span> <a href='003trace.cc.html#L196'>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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because it's an ingredient of recipe "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L518" class="LineNr">518 </span> <a href='003trace.cc.html#L196'>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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because it's an ingredient of recipe "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product\n"</span> << end<span class="Delimiter">();</span> <span id="L519" class="LineNr">519 </span> <span class="Normal">else</span> -<span id="L520" class="LineNr">520 </span> <a href='003trace.cc.html#L196'>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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because that would modify '"</span> << original_ingredient_name << <span class="Constant">"' which is an ingredient of <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L520" class="LineNr">520 </span> <a href='003trace.cc.html#L196'>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">"cannot modify '"</span> << current_ingredient_name << <span class="Constant">"' in <a href='010vm.cc.html#L33'>instruction</a> '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' because that would modify '"</span> << original_ingredient_name << <span class="Constant">"' which is an ingredient of <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" but not also a product\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L521" class="LineNr">521 </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">}</span> <span id="L524" class="LineNr">524 </span><span class="Delimiter">}</span> <span id="L525" class="LineNr">525 </span> <span id="L526" class="LineNr">526 </span><span class="Normal">bool</span> <a href='057immutable.cc.html#L526'>is_modified_in_recipe</a><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="Normal">const</span> <span class="Normal">int</span> ingredient_index<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& caller<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L527" class="LineNr">527 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L527" class="LineNr">527 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L528" class="LineNr">528 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!callee<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L529" class="LineNr">529 </span> <a href='003trace.cc.html#L196'>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">"can't check mutability of ingredients in recipe "</span> << callee<span class="Delimiter">.</span>name << <span class="Constant">" because it uses 'next-ingredient' directly, rather than a recipe header.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L529" class="LineNr">529 </span> <a href='003trace.cc.html#L196'>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">"can't check mutability of ingredients in recipe "</span> << callee<span class="Delimiter">.</span>name << <span class="Constant">" because it uses 'next-ingredient' directly, rather than a recipe header.\n"</span> << end<span class="Delimiter">();</span> <span id="L530" class="LineNr">530 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L531" class="LineNr">531 </span> <span class="Delimiter">}</span> <span id="L532" class="LineNr">532 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>ingredient_index >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>callee<span class="Delimiter">.</span>ingredients<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span class="Comment">// optional immutable ingredient</span> @@ -660,7 +662,7 @@ if ('onhashchange' in window) { <span id="L597" class="LineNr">597 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!tmp<span class="Delimiter">-></span>atom <span id="L598" class="LineNr">598 </span> || <span class="Delimiter">(</span>!is_present_in_ingredients<span class="Delimiter">(</span>caller<span class="Delimiter">,</span> tmp<span class="Delimiter">-></span>value<span class="Delimiter">)</span> <span id="L599" class="LineNr">599 </span> && !is_present_in_products<span class="Delimiter">(</span>caller<span class="Delimiter">,</span> tmp<span class="Delimiter">-></span>value<span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L600" class="LineNr">600 </span> <a href='003trace.cc.html#L196'>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">"/contained-in can only point to another ingredient or product, but got '"</span> << to_string<span class="Delimiter">(</span>property<span class="Delimiter">(</span>current_ingredient<span class="Delimiter">,</span> <span class="Constant">"contained-in"</span><span class="Delimiter">))</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L600" class="LineNr">600 </span> <a href='003trace.cc.html#L196'>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">"/contained-in can only point to another ingredient or product, but got '"</span> << to_string<span class="Delimiter">(</span>property<span class="Delimiter">(</span>current_ingredient<span class="Delimiter">,</span> <span class="Constant">"contained-in"</span><span class="Delimiter">))</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L601" class="LineNr">601 </span> <span class="Delimiter">}</span> <span id="L602" class="LineNr">602 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L603" class="LineNr">603 </span><span class="Delimiter">}</span> diff --git a/html/058to_text.cc.html b/html/058to_text.cc.html index 87eac399..7e8ee807 100644 --- a/html/058to_text.cc.html +++ b/html/058to_text.cc.html @@ -11,18 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Identifier { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.cSpecial { color: #008000; } +.Comment { color: #8080ff; } --> </style> @@ -56,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/058to_text.cc'>https://github.com/akkartik/mu/blob/master/058to_text.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Primitive to convert any type to text (array of characters).</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: Later layers will allow us to override this to do something smarter for</span> @@ -64,11 +67,11 @@ if ('onhashchange' in window) { <span id="L5" class="LineNr"> 5 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L6" class="LineNr"> 6 </span>TO_TEXT<span class="Delimiter">,</span> <span id="L7" class="LineNr"> 7 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L8" class="LineNr"> 8 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"to-text"</span><span class="Delimiter">,</span> TO_TEXT<span class="Delimiter">);</span> +<span id="L8" class="LineNr"> 8 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"to-text"</span><span class="Delimiter">,</span> TO_TEXT<span class="Delimiter">);</span> <span id="L9" class="LineNr"> 9 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L10" class="LineNr">10 </span><span class="Normal">case</span> TO_TEXT: <span class="Delimiter">{</span> <span id="L11" class="LineNr">11 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L12" class="LineNr">12 </span> <a href='003trace.cc.html#L196'>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">"'to-text' requires a single ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L12" class="LineNr">12 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'to-text' requires a single ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L13" class="LineNr">13 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L14" class="LineNr">14 </span> <span class="Delimiter">}</span> <span id="L15" class="LineNr">15 </span> <span class="Comment">// can handle any type</span> diff --git a/html/059to_text.mu.html b/html/059to_text.mu.html index 55d9846c..d67beef2 100644 --- a/html/059to_text.mu.html +++ b/html/059to_text.mu.html @@ -11,17 +11,19 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muRecipe { color: #ff8700; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -55,6 +57,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/059to_text.mu'>https://github.com/akkartik/mu/blob/master/059to_text.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># A couple of variants of 'to-text' that we'll use implicitly in stashes (see</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># later layers).</span> diff --git a/html/060rewrite_literal_string.cc.html b/html/060rewrite_literal_string.cc.html index 13e41d74..5f9adcea 100644 --- a/html/060rewrite_literal_string.cc.html +++ b/html/060rewrite_literal_string.cc.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -58,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/060rewrite_literal_string.cc'>https://github.com/akkartik/mu/blob/master/060rewrite_literal_string.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: allow using literal strings anywhere that will accept immutable strings</span> <span id="L2" class="LineNr"> 2 </span> @@ -74,7 +77,7 @@ if ('onhashchange' in window) { <span id="L13" class="LineNr">13 </span> <span id="L14" class="LineNr">14 </span><span class="Delimiter">:(before "End Instruction Inserting/Deleting Transforms")</span> <span id="L15" class="LineNr">15 </span><a href='060rewrite_literal_string.cc.html#L21'>initialize_transform_rewrite_literal_string_to_text</a><span class="Delimiter">();</span> -<span id="L16" class="LineNr">16 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='060rewrite_literal_string.cc.html#L39'>rewrite_literal_string_to_text</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L16" class="LineNr">16 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='060rewrite_literal_string.cc.html#L39'>rewrite_literal_string_to_text</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L17" class="LineNr">17 </span> <span id="L18" class="LineNr">18 </span><span class="Delimiter">:(before "End Globals")</span> <span id="L19" class="LineNr">19 </span>set<string> recipes_taking_literal_strings<span class="Delimiter">;</span> @@ -98,7 +101,7 @@ if ('onhashchange' in window) { <span id="L37" class="LineNr">37 </span><span class="Delimiter">}</span> <span id="L38" class="LineNr">38 </span> <span id="L39" class="LineNr">39 </span><span class="Normal">void</span> <a href='060rewrite_literal_string.cc.html#L39'>rewrite_literal_string_to_text</a><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="L40" class="LineNr">40 </span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L40" class="LineNr">40 </span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L41" class="LineNr">41 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- rewrite literal strings in <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L42" class="LineNr">42 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='060rewrite_literal_string.cc.html#L65'>contains_numeric_locations</a><span class="Delimiter">(</span>caller<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L43" class="LineNr">43 </span> vector<instruction> new_instructions<span class="Delimiter">;</span> diff --git a/html/061text.mu.html b/html/061text.mu.html index 0cb40eab..5446ae1d 100644 --- a/html/061text.mu.html +++ b/html/061text.mu.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -58,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/061text.mu'>https://github.com/akkartik/mu/blob/master/061text.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Some useful helpers for dealing with text (arrays of characters)</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/062convert_ingredients_to_text.cc.html b/html/062convert_ingredients_to_text.cc.html index 81c5bf70..520a7688 100644 --- a/html/062convert_ingredients_to_text.cc.html +++ b/html/062convert_ingredients_to_text.cc.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -59,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/062convert_ingredients_to_text.cc'>https://github.com/akkartik/mu/blob/master/062convert_ingredients_to_text.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: make some recipes more friendly by trying to auto-convert their ingredients to text</span> <span id="L2" class="LineNr"> 2 </span> @@ -116,11 +119,11 @@ if ('onhashchange' in window) { <span id="L54" class="LineNr"> 54 </span><span class="Comment">//: misplaced; should be in instruction inserting/deleting transforms, but has</span> <span id="L55" class="LineNr"> 55 </span><span class="Comment">//: prerequisites: deduce_types_from_header and check_or_set_types_by_name</span> <span id="L56" class="LineNr"> 56 </span><span class="Delimiter">:(after "Transform.push_back(deduce_types_from_header)")</span> -<span id="L57" class="LineNr"> 57 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>convert_ingredients_to_text<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L57" class="LineNr"> 57 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>convert_ingredients_to_text<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L58" class="LineNr"> 58 </span> <span id="L59" class="LineNr"> 59 </span><span class="Delimiter">:(code)</span> <span id="L60" class="LineNr"> 60 </span><span class="Normal">void</span> convert_ingredients_to_text<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="L61" class="LineNr"> 61 </span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L61" class="LineNr"> 61 </span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L62" class="LineNr"> 62 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- convert some ingredients to text in <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L63" class="LineNr"> 63 </span> <span class="Comment">// in recipes without named locations, 'stash' is still not extensible</span> <span id="L64" class="LineNr"> 64 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='060rewrite_literal_string.cc.html#L65'>contains_numeric_locations</a><span class="Delimiter">(</span>caller<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> diff --git a/html/063array.mu.html b/html/063array.mu.html index 4506b04a..fcd6e922 100644 --- a/html/063array.mu.html +++ b/html/063array.mu.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -57,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/063array.mu'>https://github.com/akkartik/mu/blob/master/063array.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="muScenario">scenario</span> array-from-args [ <span id="L2" class="LineNr"> 2 </span> run [ diff --git a/html/064list.mu.html b/html/064list.mu.html index ea49476e..b8ec8d6b 100644 --- a/html/064list.mu.html +++ b/html/064list.mu.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -58,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/064list.mu'>https://github.com/akkartik/mu/blob/master/064list.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># A list links up multiple objects together to make them easier to manage.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">#</span> diff --git a/html/065duplex_list.mu.html b/html/065duplex_list.mu.html index f57d9588..b1512e4b 100644 --- a/html/065duplex_list.mu.html +++ b/html/065duplex_list.mu.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -58,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/065duplex_list.mu'>https://github.com/akkartik/mu/blob/master/065duplex_list.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># A doubly linked list permits bidirectional traversal.</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/066stream.mu.html b/html/066stream.mu.html index 198737c7..d24bb97e 100644 --- a/html/066stream.mu.html +++ b/html/066stream.mu.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -57,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/066stream.mu'>https://github.com/akkartik/mu/blob/master/066stream.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># new type to help incrementally scan arrays</span> <span id="L2" class="LineNr"> 2 </span><span class="muData">container</span> <a href='066stream.mu.html#L2'>stream</a>:_elem [ diff --git a/html/067random.cc.html b/html/067random.cc.html index eec8e30a..c91fbaaa 100644 --- a/html/067random.cc.html +++ b/html/067random.cc.html @@ -11,17 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Identifier { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } --> </style> @@ -55,11 +58,12 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/067random.cc'>https://github.com/akkartik/mu/blob/master/067random.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L2" class="LineNr"> 2 </span>REAL_RANDOM<span class="Delimiter">,</span> <span id="L3" class="LineNr"> 3 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L4" class="LineNr"> 4 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"real-random"</span><span class="Delimiter">,</span> REAL_RANDOM<span class="Delimiter">);</span> +<span id="L4" class="LineNr"> 4 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"real-random"</span><span class="Delimiter">,</span> REAL_RANDOM<span class="Delimiter">);</span> <span id="L5" class="LineNr"> 5 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L6" class="LineNr"> 6 </span><span class="Normal">case</span> REAL_RANDOM: <span class="Delimiter">{</span> <span id="L7" class="LineNr"> 7 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -76,7 +80,7 @@ if ('onhashchange' in window) { <span id="L18" class="LineNr">18 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L19" class="LineNr">19 </span>MAKE_RANDOM_NONDETERMINISTIC<span class="Delimiter">,</span> <span id="L20" class="LineNr">20 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L21" class="LineNr">21 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"make-random-nondeterministic"</span><span class="Delimiter">,</span> MAKE_RANDOM_NONDETERMINISTIC<span class="Delimiter">);</span> +<span id="L21" class="LineNr">21 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"make-random-nondeterministic"</span><span class="Delimiter">,</span> MAKE_RANDOM_NONDETERMINISTIC<span class="Delimiter">);</span> <span id="L22" class="LineNr">22 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L23" class="LineNr">23 </span><span class="Normal">case</span> MAKE_RANDOM_NONDETERMINISTIC: <span class="Delimiter">{</span> <span id="L24" class="LineNr">24 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> diff --git a/html/068random.mu.html b/html/068random.mu.html index a2faf51a..c42e1085 100644 --- a/html/068random.mu.html +++ b/html/068random.mu.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -57,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/068random.mu'>https://github.com/akkartik/mu/blob/master/068random.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="muRecipe">def</span> <a href='068random.mu.html#L1'>random</a> generator:&:<a href='066stream.mu.html#L2'>stream</a>:num<span class="muRecipe"> -> </span>result:num, fail?:bool, generator:&:<a href='066stream.mu.html#L2'>stream</a>:num [ <span id="L2" class="LineNr"> 2 </span> <span class="Constant">local-scope</span> diff --git a/html/069hash.cc.html b/html/069hash.cc.html index 1d90a537..e58c2b13 100644 --- a/html/069hash.cc.html +++ b/html/069hash.cc.html @@ -11,23 +11,24 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } -.traceContains { color: #008000; } -.LineNr { color: #444444; } -.muData { color: #ffff00; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } .muRecipe { color: #ff8700; } -.Identifier { color: #c0a020; } +.LineNr { color:#444444; } +.muData { color: #ffff00; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.Special { color: #c00000; } -.cSpecial { color: #008000; } +.Comment { color: #8080ff; } +.traceContains { color: #008000; } --> </style> @@ -61,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/069hash.cc'>https://github.com/akkartik/mu/blob/master/069hash.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">// Compute a hash for objects of any type.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//</span> @@ -75,11 +77,11 @@ if ('onhashchange' in window) { <span id="L11" class="LineNr"> 11 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L12" class="LineNr"> 12 </span>HASH<span class="Delimiter">,</span> <span id="L13" class="LineNr"> 13 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L14" class="LineNr"> 14 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"hash"</span><span class="Delimiter">,</span> HASH<span class="Delimiter">);</span> +<span id="L14" class="LineNr"> 14 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"hash"</span><span class="Delimiter">,</span> HASH<span class="Delimiter">);</span> <span id="L15" class="LineNr"> 15 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L16" class="LineNr"> 16 </span><span class="Normal">case</span> HASH: <span class="Delimiter">{</span> <span id="L17" class="LineNr"> 17 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L18" class="LineNr"> 18 </span> <a href='003trace.cc.html#L196'>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">"'hash' takes exactly one ingredient rather than '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L18" class="LineNr"> 18 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'hash' takes exactly one ingredient rather than '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L19" class="LineNr"> 19 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L20" class="LineNr"> 20 </span> <span class="Delimiter">}</span> <span id="L21" class="LineNr"> 21 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -113,20 +115,20 @@ if ('onhashchange' in window) { <span id="L49" class="LineNr"> 49 </span><span class="Delimiter">}</span> <span id="L50" class="LineNr"> 50 </span> <span id="L51" class="LineNr"> 51 </span><span class="Normal">size_t</span> <a href='069hash.cc.html#L51'>hash_mu_scalar</a><span class="Delimiter">(</span><span class="Normal">size_t</span> h<span class="Delimiter">,</span> <span class="Normal">const</span> reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L52" class="LineNr"> 52 </span> <span class="Normal">double</span> input = is_literal<span class="Delimiter">(</span>r<span class="Delimiter">)</span> ? r<span class="Delimiter">.</span>value : <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">);</span> +<span id="L52" class="LineNr"> 52 </span> <span class="Normal">double</span> input = is_literal<span class="Delimiter">(</span>r<span class="Delimiter">)</span> ? r<span class="Delimiter">.</span>value : <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">);</span> <span id="L53" class="LineNr"> 53 </span> <span class="Identifier">return</span> <a href='069hash.cc.html#L115'>hash_iter</a><span class="Delimiter">(</span>h<span class="Delimiter">,</span> <span class="Normal">static_cast</span><<span class="Normal">size_t</span>><span class="Delimiter">(</span>input<span class="Delimiter">));</span> <span id="L54" class="LineNr"> 54 </span><span class="Delimiter">}</span> <span id="L55" class="LineNr"> 55 </span> <span id="L56" class="LineNr"> 56 </span><span class="Normal">size_t</span> <a href='069hash.cc.html#L56'>hash_mu_address</a><span class="Delimiter">(</span><span class="Normal">size_t</span> h<span class="Delimiter">,</span> reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L57" class="LineNr"> 57 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>r<span class="Delimiter">.</span>value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L58" class="LineNr"> 58 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"location "</span> << r<span class="Delimiter">.</span>value << <span class="Constant">" is "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">))</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L59" class="LineNr"> 59 </span> r<span class="Delimiter">.</span><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">));</span> +<span id="L58" class="LineNr"> 58 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"location "</span> << r<span class="Delimiter">.</span>value << <span class="Constant">" is "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">))</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L59" class="LineNr"> 59 </span> r<span class="Delimiter">.</span><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">));</span> <span id="L60" class="LineNr"> 60 </span> drop_from_type<span class="Delimiter">(</span>r<span class="Delimiter">,</span> <span class="Constant">"address"</span><span class="Delimiter">);</span> <span id="L61" class="LineNr"> 61 </span> <span class="Identifier">return</span> <a href='069hash.cc.html#L34'>hash</a><span class="Delimiter">(</span>h<span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L62" class="LineNr"> 62 </span><span class="Delimiter">}</span> <span id="L63" class="LineNr"> 63 </span> <span id="L64" class="LineNr"> 64 </span><span class="Normal">size_t</span> <a href='069hash.cc.html#L64'>hash_mu_text</a><span class="Delimiter">(</span><span class="Normal">size_t</span> h<span class="Delimiter">,</span> <span class="Normal">const</span> reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L65" class="LineNr"> 65 </span> string input = <a href='038new_text.cc.html#L142'>read_mu_text</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">));</span> +<span id="L65" class="LineNr"> 65 </span> string input = <a href='038new_text.cc.html#L142'>read_mu_text</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> r<span class="Delimiter">.</span>value+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">));</span> <span id="L66" class="LineNr"> 66 </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#L141'>SIZE</a><span class="Delimiter">(</span>input<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L67" class="LineNr"> 67 </span> h = <a href='069hash.cc.html#L115'>hash_iter</a><span class="Delimiter">(</span>h<span class="Delimiter">,</span> <span class="Normal">static_cast</span><<span class="Normal">size_t</span>><span class="Delimiter">(</span>input<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)));</span> <span id="L68" class="LineNr"> 68 </span><span class="CommentedCode">//? cerr << i << ": " << h << '\n';</span> @@ -135,7 +137,7 @@ if ('onhashchange' in window) { <span id="L71" class="LineNr"> 71 </span><span class="Delimiter">}</span> <span id="L72" class="LineNr"> 72 </span> <span id="L73" class="LineNr"> 73 </span><span class="Normal">size_t</span> <a href='069hash.cc.html#L73'>hash_mu_array</a><span class="Delimiter">(</span><span class="Normal">size_t</span> h<span class="Delimiter">,</span> <span class="Normal">const</span> reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L74" class="LineNr"> 74 </span> <span class="Normal">int</span> size = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">);</span> +<span id="L74" class="LineNr"> 74 </span> <span class="Normal">int</span> size = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">);</span> <span id="L75" class="LineNr"> 75 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> elem = r<span class="Delimiter">;</span> <span id="L76" class="LineNr"> 76 </span> <span class="Normal">delete</span> elem<span class="Delimiter">.</span>type<span class="Delimiter">;</span> <span id="L77" class="LineNr"> 77 </span> elem<span class="Delimiter">.</span>type = <a href='032array.cc.html#L299'>copy_array_element</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">);</span> @@ -149,7 +151,7 @@ if ('onhashchange' in window) { <span id="L85" class="LineNr"> 85 </span><span class="Delimiter">}</span> <span id="L86" class="LineNr"> 86 </span> <span id="L87" class="LineNr"> 87 </span><span class="Normal">size_t</span> <a href='069hash.cc.html#L87'>hash_mu_container</a><span class="Delimiter">(</span><span class="Normal">size_t</span> h<span class="Delimiter">,</span> <span class="Normal">const</span> reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L88" class="LineNr"> 88 </span> type_info& info = get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> get_base_type<span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">)-></span>value<span class="Delimiter">);</span> +<span id="L88" class="LineNr"> 88 </span> type_info& info = get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> get_base_type<span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">)-></span>value<span class="Delimiter">);</span> <span id="L89" class="LineNr"> 89 </span> <span class="Normal">int</span> <a href='043space.cc.html#L101'>address</a> = r<span class="Delimiter">.</span>value<span class="Delimiter">;</span> <span id="L90" class="LineNr"> 90 </span> <span class="Normal">int</span> offset = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L91" class="LineNr"> 91 </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#L141'>SIZE</a><span class="Delimiter">(</span>info<span class="Delimiter">.</span>elements<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -166,11 +168,11 @@ if ('onhashchange' in window) { <span id="L102" class="LineNr">102 </span><span class="Normal">size_t</span> <a href='069hash.cc.html#L102'>hash_mu_exclusive_container</a><span class="Delimiter">(</span><span class="Normal">size_t</span> h<span class="Delimiter">,</span> <span class="Normal">const</span> reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L103" class="LineNr">103 </span> <span class="Normal">const</span> type_tree* type = get_base_type<span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">);</span> <span id="L104" class="LineNr">104 </span> assert<span class="Delimiter">(</span>type<span class="Delimiter">-></span>value<span class="Delimiter">);</span> -<span id="L105" class="LineNr">105 </span> <span class="Normal">int</span> tag = get<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">);</span> +<span id="L105" class="LineNr">105 </span> <span class="Normal">int</span> tag = get<span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> r<span class="Delimiter">.</span>value<span class="Delimiter">);</span> <span id="L106" class="LineNr">106 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> variant = variant_type<span class="Delimiter">(</span>r<span class="Delimiter">,</span> tag<span class="Delimiter">);</span> <span id="L107" class="LineNr">107 </span> <span class="Comment">// todo: move this error to container definition time</span> <span id="L108" class="LineNr">108 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>has_property<span class="Delimiter">(</span>variant<span class="Delimiter">,</span> <span class="Constant">"ignore-for-hash"</span><span class="Delimiter">))</span> -<span id="L109" class="LineNr">109 </span> <a href='003trace.cc.html#L196'>raise</a> << get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>name << <span class="Constant">": /ignore-for-hash won't work in exclusive containers</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L109" class="LineNr">109 </span> <a href='003trace.cc.html#L196'>raise</a> << get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>name << <span class="Constant">": /ignore-for-hash won't work in exclusive containers\n"</span> << end<span class="Delimiter">();</span> <span id="L110" class="LineNr">110 </span> variant<span class="Delimiter">.</span><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>value + <span class="Comment">/*</span><span class="Comment">skip tag</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L111" class="LineNr">111 </span> h = <a href='069hash.cc.html#L34'>hash</a><span class="Delimiter">(</span>h<span class="Delimiter">,</span> variant<span class="Delimiter">);</span> <span id="L112" class="LineNr">112 </span> <span class="Identifier">return</span> h<span class="Delimiter">;</span> @@ -392,15 +394,15 @@ if ('onhashchange' in window) { <span id="L328" class="LineNr">328 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L329" class="LineNr">329 </span>HASH_OLD<span class="Delimiter">,</span> <span id="L330" class="LineNr">330 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L331" class="LineNr">331 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"hash_old"</span><span class="Delimiter">,</span> HASH_OLD<span class="Delimiter">);</span> +<span id="L331" class="LineNr">331 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"hash_old"</span><span class="Delimiter">,</span> HASH_OLD<span class="Delimiter">);</span> <span id="L332" class="LineNr">332 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L333" class="LineNr">333 </span><span class="Normal">case</span> HASH_OLD: <span class="Delimiter">{</span> <span id="L334" class="LineNr">334 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L335" class="LineNr">335 </span> <a href='003trace.cc.html#L196'>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">"'hash_old' takes exactly one ingredient rather than '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L335" class="LineNr">335 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'hash_old' takes exactly one ingredient rather than '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L336" class="LineNr">336 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L337" class="LineNr">337 </span> <span class="Delimiter">}</span> <span id="L338" class="LineNr">338 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_text<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="L339" class="LineNr">339 </span> <a href='003trace.cc.html#L196'>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">"'hash_old' currently only supports texts (address array character), 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L339" class="LineNr">339 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'hash_old' currently only supports texts (address array character), 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L340" class="LineNr">340 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L341" class="LineNr">341 </span> <span class="Delimiter">}</span> <span id="L342" class="LineNr">342 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> diff --git a/html/070table.mu.html b/html/070table.mu.html index 0333b19a..89382920 100644 --- a/html/070table.mu.html +++ b/html/070table.mu.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -58,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/070table.mu'>https://github.com/akkartik/mu/blob/master/070table.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># A table is like an array, except that you can index it with arbitrary types</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># and not just non-negative whole numbers.</span> diff --git a/html/072recipe.cc.html b/html/072recipe.cc.html index 0ad12422..4521995f 100644 --- a/html/072recipe.cc.html +++ b/html/072recipe.cc.html @@ -11,21 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.SalientComment { color: #00ffff; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.cSpecial { color: #008000; } +.Comment { color: #8080ff; } +.SalientComment { color: #00ffff; } .traceContains { color: #008000; } --> </style> @@ -60,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/072recipe.cc'>https://github.com/akkartik/mu/blob/master/072recipe.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: So far we've been calling a fixed recipe in each instruction, but we'd</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: also like to make the recipe a variable, pass recipes to "higher-order"</span> @@ -77,10 +79,10 @@ if ('onhashchange' in window) { <span id="L14" class="LineNr"> 14 </span><span class="traceContains">+mem: storing 34 in location 1</span> <span id="L15" class="LineNr"> 15 </span> <span id="L16" class="LineNr"> 16 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> -<span id="L17" class="LineNr"> 17 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"recipe-literal"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L17" class="LineNr"> 17 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"recipe-literal"</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L18" class="LineNr"> 18 </span><span class="Comment">// 'recipe' variables can store recipe-literal</span> -<span id="L19" class="LineNr"> 19 </span><a href='010vm.cc.html#L125'>type_ordinal</a> <a href='010vm.cc.html#L19'>recipe</a> = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"recipe"</span><span class="Delimiter">,</span> Next_type_ordinal++<span class="Delimiter">);</span> -<span id="L20" class="LineNr"> 20 </span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Type<span class="Delimiter">,</span> <a href='010vm.cc.html#L19'>recipe</a><span class="Delimiter">).</span>name = <span class="Constant">"recipe"</span><span class="Delimiter">;</span> +<span id="L19" class="LineNr"> 19 </span><a href='010vm.cc.html#L125'>type_ordinal</a> <a href='010vm.cc.html#L19'>recipe</a> = <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"recipe"</span><span class="Delimiter">,</span> <span class="Special">Next_type_ordinal</span>++<span class="Delimiter">);</span> +<span id="L20" class="LineNr"> 20 </span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> <a href='010vm.cc.html#L19'>recipe</a><span class="Delimiter">).</span>name = <span class="Constant">"recipe"</span><span class="Delimiter">;</span> <span id="L21" class="LineNr"> 21 </span> <span id="L22" class="LineNr"> 22 </span><span class="Delimiter">:(after "Deduce Missing Type(x, caller)")</span> <span id="L23" class="LineNr"> 23 </span><span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> @@ -91,10 +93,10 @@ if ('onhashchange' in window) { <span id="L28" class="LineNr"> 28 </span><span class="Delimiter">:(code)</span> <span id="L29" class="LineNr"> 29 </span><span class="Normal">void</span> <a href='072recipe.cc.html#L29'>try_initialize_recipe_literal</a><span class="Delimiter">(</span>reagent& x<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& caller<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L30" class="LineNr"> 30 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L31" class="LineNr"> 31 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe_ordinal<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="L31" class="LineNr"> 31 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><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="L32" class="LineNr"> 32 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='072recipe.cc.html#L36'>contains_reagent_with_non_recipe_literal_type</a><span class="Delimiter">(</span>caller<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="L33" class="LineNr"> 33 </span> x<span class="Delimiter">.</span>type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span><span class="Constant">"recipe-literal"</span><span class="Delimiter">);</span> -<span id="L34" class="LineNr"> 34 </span> x<span class="Delimiter">.</span><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> x<span class="Delimiter">.</span>name<span class="Delimiter">));</span> +<span id="L34" class="LineNr"> 34 </span> x<span class="Delimiter">.</span><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> x<span class="Delimiter">.</span>name<span class="Delimiter">));</span> <span id="L35" class="LineNr"> 35 </span><span class="Delimiter">}</span> <span id="L36" class="LineNr"> 36 </span><span class="Normal">bool</span> <a href='072recipe.cc.html#L36'>contains_reagent_with_non_recipe_literal_type</a><span class="Delimiter">(</span><span class="Normal">const</span> recipe& caller<span class="Delimiter">,</span> <span class="Normal">const</span> string& name<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L37" class="LineNr"> 37 </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#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -126,15 +128,15 @@ if ('onhashchange' in window) { <span id="L63" class="LineNr"> 63 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L64" class="LineNr"> 64 </span>CALL<span class="Delimiter">,</span> <span id="L65" class="LineNr"> 65 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L66" class="LineNr"> 66 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"call"</span><span class="Delimiter">,</span> CALL<span class="Delimiter">);</span> +<span id="L66" class="LineNr"> 66 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"call"</span><span class="Delimiter">,</span> CALL<span class="Delimiter">);</span> <span id="L67" class="LineNr"> 67 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L68" class="LineNr"> 68 </span><span class="Normal">case</span> CALL: <span class="Delimiter">{</span> <span id="L69" class="LineNr"> 69 </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="L70" class="LineNr"> 70 </span> <a href='003trace.cc.html#L196'>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">"'call' requires at least one ingredient (the <a href='010vm.cc.html#L19'>recipe</a> to call)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L70" class="LineNr"> 70 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'call' requires at least one ingredient (the <a href='010vm.cc.html#L19'>recipe</a> to call)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L71" class="LineNr"> 71 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L72" class="LineNr"> 72 </span> <span class="Delimiter">}</span> <span id="L73" class="LineNr"> 73 </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="L74" class="LineNr"> 74 </span> <a href='003trace.cc.html#L196'>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 'call' should be a <a href='010vm.cc.html#L19'>recipe</a>, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L74" class="LineNr"> 74 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'call' should be a <a href='010vm.cc.html#L19'>recipe</a>, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L75" class="LineNr"> 75 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L76" class="LineNr"> 76 </span> <span class="Delimiter">}</span> <span id="L77" class="LineNr"> 77 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -142,10 +144,10 @@ if ('onhashchange' in window) { <span id="L79" class="LineNr"> 79 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L80" class="LineNr"> 80 </span><span class="Normal">case</span> CALL: <span class="Delimiter">{</span> <span id="L81" class="LineNr"> 81 </span> <span class="Comment">// Begin Call</span> -<span id="L82" class="LineNr"> 82 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L83" class="LineNr"> 83 </span> ++Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> -<span id="L84" class="LineNr"> 84 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"indirect 'call': incrementing callstack depth to "</span> << Trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L85" class="LineNr"> 85 </span> assert<span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> +<span id="L82" class="LineNr"> 82 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L83" class="LineNr"> 83 </span> ++<span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> +<span id="L84" class="LineNr"> 84 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"indirect 'call': incrementing callstack depth to "</span> << <span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L85" class="LineNr"> 85 </span> assert<span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> <span id="L86" class="LineNr"> 86 </span> <span class="Delimiter">}</span> <span id="L87" class="LineNr"> 87 </span> <span class="Normal">if</span> <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 class="Delimiter">{</span> <span id="L88" class="LineNr"> 88 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to call empty <a href='010vm.cc.html#L19'>recipe</a> in '"</span> << to_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> @@ -155,7 +157,7 @@ if ('onhashchange' in window) { <span id="L92" class="LineNr"> 92 </span> <a href='010vm.cc.html#L33'>instruction</a><span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> call_instruction = <a href='026call.cc.html#L88'>to_instruction</a><span class="Delimiter">(</span>caller_frame<span class="Delimiter">);</span> <span id="L93" class="LineNr"> 93 </span> call_instruction<span class="Delimiter">.</span>operation = 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="L94" class="LineNr"> 94 </span> call_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>call_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">());</span> -<span id="L95" class="LineNr"> 95 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>call<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="L95" class="LineNr"> 95 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>call<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="L96" class="LineNr"> 96 </span> ingredients<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">());</span> <span class="Comment">// drop the callee</span> <span id="L97" class="LineNr"> 97 </span> finish_call_housekeeping<span class="Delimiter">(</span>call_instruction<span class="Delimiter">,</span> ingredients<span class="Delimiter">);</span> <span id="L98" class="LineNr"> 98 </span> <span class="Comment">// not done with caller</span> @@ -280,34 +282,34 @@ if ('onhashchange' in window) { <span id="L217" class="LineNr">217 </span> inst2<span class="Delimiter">.</span>products<span class="Delimiter">.</span>push_back<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 id="L218" class="LineNr">218 </span> <a href='054static_dispatch.cc.html#L173'>resolve_ambiguous_call</a><span class="Delimiter">(</span>r<span class="Delimiter">,</span> index<span class="Delimiter">,</span> inst2<span class="Delimiter">,</span> caller_recipe<span class="Delimiter">);</span> <span id="L219" class="LineNr">219 </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>name = inst2<span class="Delimiter">.</span>name<span class="Delimiter">;</span> -<span id="L220" class="LineNr">220 </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><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> inst2<span class="Delimiter">.</span>name<span class="Delimiter">));</span> +<span id="L220" class="LineNr">220 </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><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> inst2<span class="Delimiter">.</span>name<span class="Delimiter">));</span> <span id="L221" class="LineNr">221 </span><span class="Delimiter">}</span> <span id="L222" class="LineNr">222 </span> <span id="L223" class="LineNr">223 </span><span class="Delimiter">:(after "Transform.push_back(check_instruction)")</span> -<span id="L224" class="LineNr">224 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='072recipe.cc.html#L226'>check_indirect_calls_against_header</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> +<span id="L224" class="LineNr">224 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='072recipe.cc.html#L226'>check_indirect_calls_against_header</a><span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span id="L225" class="LineNr">225 </span><span class="Delimiter">:(code)</span> <span id="L226" class="LineNr">226 </span><span class="Normal">void</span> <a href='072recipe.cc.html#L226'>check_indirect_calls_against_header</a><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="L227" class="LineNr">227 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- type-check 'call' instructions inside <a href='010vm.cc.html#L19'>recipe</a> "</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L228" class="LineNr">228 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L227" class="LineNr">227 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- type-check 'call' instructions inside <a href='010vm.cc.html#L19'>recipe</a> "</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L228" class="LineNr">228 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L229" class="LineNr">229 </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#L141'>SIZE</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L230" class="LineNr">230 </span> <span class="Normal">const</span> instruction& inst = caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L231" class="LineNr">231 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_indirect_call<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L232" class="LineNr">232 </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="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// error raised above</span> <span id="L233" class="LineNr">233 </span> <span class="Normal">const</span> reagent& callee = 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 id="L234" class="LineNr">234 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_recipe<span class="Delimiter">(</span>callee<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// error raised above</span> -<span id="L235" class="LineNr">235 </span> <span class="Normal">const</span> <a href='010vm.cc.html#L19'>recipe</a> callee_header = is_literal<span class="Delimiter">(</span>callee<span class="Delimiter">)</span> ? get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> callee<span class="Delimiter">.</span>value<span class="Delimiter">)</span> : <a href='072recipe.cc.html#L268'>from_reagent</a><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 id="L235" class="LineNr">235 </span> <span class="Normal">const</span> <a href='010vm.cc.html#L19'>recipe</a> callee_header = is_literal<span class="Delimiter">(</span>callee<span class="Delimiter">)</span> ? get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> callee<span class="Delimiter">.</span>value<span class="Delimiter">)</span> : <a href='072recipe.cc.html#L268'>from_reagent</a><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 id="L236" class="LineNr">236 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!callee_header<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L237" class="LineNr">237 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='072recipe.cc.html#L257'>is_indirect_call_with_ingredients</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L238" class="LineNr">238 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">long</span> <span class="Normal">int</span> i = <span class="Comment">/*</span><span class="Comment">skip callee</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> i < min<span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">),</span> <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>callee_header<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span>+<span class="Comment">/*</span><span class="Comment">skip callee</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L239" class="LineNr">239 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>callee_header<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i-<span class="Comment">/*</span><span class="Comment">skip callee</span><span class="Comment">*/</span><span class="Constant">1</span><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 id="L240" class="LineNr">240 </span> <a href='003trace.cc.html#L196'>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">"ingredient "</span> << i-<span class="Comment">/*</span><span class="Comment">skip callee</span><span class="Comment">*/</span><span class="Constant">1</span> << <span class="Constant">" has the wrong type at '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L240" class="LineNr">240 </span> <a href='003trace.cc.html#L196'>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">"ingredient "</span> << i-<span class="Comment">/*</span><span class="Comment">skip callee</span><span class="Comment">*/</span><span class="Constant">1</span> << <span class="Constant">" has the wrong type at '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L241" class="LineNr">241 </span> <span class="Delimiter">}</span> <span id="L242" class="LineNr">242 </span> <span class="Delimiter">}</span> <span id="L243" class="LineNr">243 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='072recipe.cc.html#L262'>is_indirect_call_with_products</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L244" class="LineNr">244 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">long</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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">),</span> <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>callee_header<span class="Delimiter">.</span>products<span class="Delimiter">));</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L245" class="LineNr">245 </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="L246" class="LineNr">246 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>callee_header<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 id="L247" class="LineNr">247 </span> <a href='003trace.cc.html#L196'>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">"product "</span> << i << <span class="Constant">" has the wrong type at '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L247" class="LineNr">247 </span> <a href='003trace.cc.html#L196'>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">"product "</span> << i << <span class="Constant">" has the wrong type at '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L248" class="LineNr">248 </span> <span class="Delimiter">}</span> <span id="L249" class="LineNr">249 </span> <span class="Delimiter">}</span> <span id="L250" class="LineNr">250 </span> <span class="Delimiter">}</span> @@ -432,11 +434,11 @@ if ('onhashchange' in window) { <span id="L369" class="LineNr">369 </span> <span id="L370" class="LineNr">370 </span><span class="Delimiter">:(before "End Matching Types For Literal(to)")</span> <span id="L371" class="LineNr">371 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='072recipe.cc.html#L335'>is_mu_recipe</a><span class="Delimiter">(</span>to<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L372" class="LineNr">372 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> from<span class="Delimiter">.</span>value<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L373" class="LineNr">373 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"trying to store <a href='010vm.cc.html#L19'>recipe</a> "</span> << from<span class="Delimiter">.</span>name << <span class="Constant">" into "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>to<span class="Delimiter">)</span> << <span class="Constant">" but there's no such recipe</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L372" class="LineNr">372 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> from<span class="Delimiter">.</span>value<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L373" class="LineNr">373 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"trying to store <a href='010vm.cc.html#L19'>recipe</a> "</span> << from<span class="Delimiter">.</span>name << <span class="Constant">" into "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>to<span class="Delimiter">)</span> << <span class="Constant">" but there's no such recipe\n"</span> << end<span class="Delimiter">();</span> <span id="L374" class="LineNr">374 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L375" class="LineNr">375 </span> <span class="Delimiter">}</span> -<span id="L376" class="LineNr">376 </span> <span class="Normal">const</span> recipe& rrhs = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> from<span class="Delimiter">.</span>value<span class="Delimiter">);</span> +<span id="L376" class="LineNr">376 </span> <span class="Normal">const</span> recipe& rrhs = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> from<span class="Delimiter">.</span>value<span class="Delimiter">);</span> <span id="L377" class="LineNr">377 </span> <span class="Normal">const</span> recipe& rlhs = <a href='072recipe.cc.html#L268'>from_reagent</a><span class="Delimiter">(</span>to<span class="Delimiter">);</span> <span id="L378" class="LineNr">378 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">long</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#L141'>SIZE</a><span class="Delimiter">(</span>rlhs<span class="Delimiter">.</span>ingredients<span class="Delimiter">),</span> <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>rrhs<span class="Delimiter">.</span>ingredients<span class="Delimiter">));</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L379" class="LineNr">379 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!types_match<span class="Delimiter">(</span>rlhs<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> rrhs<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> @@ -478,16 +480,16 @@ if ('onhashchange' in window) { <span id="L415" class="LineNr">415 </span><span class="traceContains">+error: <a href='000organization.cc.html#L113'>main</a>: missing type for 'foo' in 'break-if foo'</span> <span id="L416" class="LineNr">416 </span> <span id="L417" class="LineNr">417 </span><span class="Delimiter">:(before "End JUMP_IF Checks")</span> -<span id="L418" class="LineNr">418 </span><a href='072recipe.cc.html#L422'>check_for_recipe_literals</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">));</span> +<span id="L418" class="LineNr">418 </span><a href='072recipe.cc.html#L422'>check_for_recipe_literals</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">));</span> <span id="L419" class="LineNr">419 </span><span class="Delimiter">:(before "End JUMP_UNLESS Checks")</span> -<span id="L420" class="LineNr">420 </span><a href='072recipe.cc.html#L422'>check_for_recipe_literals</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">));</span> +<span id="L420" class="LineNr">420 </span><a href='072recipe.cc.html#L422'>check_for_recipe_literals</a><span class="Delimiter">(</span>inst<span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">));</span> <span id="L421" class="LineNr">421 </span><span class="Delimiter">:(code)</span> <span id="L422" class="LineNr">422 </span><span class="Normal">void</span> <a href='072recipe.cc.html#L422'>check_for_recipe_literals</a><span class="Delimiter">(</span><span class="Normal">const</span> instruction& inst<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& caller<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L423" class="LineNr">423 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L424" class="LineNr">424 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='072recipe.cc.html#L335'>is_mu_recipe</a><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="L425" class="LineNr">425 </span> <a href='003trace.cc.html#L196'>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">"missing type for '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"' in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L425" class="LineNr">425 </span> <a href='003trace.cc.html#L196'>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">"missing type for '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>original_string << <span class="Constant">"' in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L426" class="LineNr">426 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_present_in_ingredients<span class="Delimiter">(</span>caller<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">))</span> -<span id="L427" class="LineNr">427 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" did you forget 'load-ingredients'?</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L427" class="LineNr">427 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" did you forget 'load-ingredients'?\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L428" class="LineNr">428 </span> <span class="Delimiter">}</span> <span id="L429" class="LineNr">429 </span> <span class="Delimiter">}</span> <span id="L430" class="LineNr">430 </span><span class="Delimiter">}</span> @@ -502,8 +504,8 @@ if ('onhashchange' in window) { <span id="L439" class="LineNr">439 </span><span class="traceContains">+error: did you forget 'load-ingredients'?</span> <span id="L440" class="LineNr">440 </span> <span id="L441" class="LineNr">441 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> -<span id="L442" class="LineNr">442 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> <span class="Constant">"function"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"recipe"</span><span class="Delimiter">));</span> -<span id="L443" class="LineNr">443 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Type_abbreviations<span class="Delimiter">,</span> <span class="Constant">"fn"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"recipe"</span><span class="Delimiter">));</span> +<span id="L442" class="LineNr">442 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> <span class="Constant">"function"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"recipe"</span><span class="Delimiter">));</span> +<span id="L443" class="LineNr">443 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Type_abbreviations</span><span class="Delimiter">,</span> <span class="Constant">"fn"</span><span class="Delimiter">,</span> <a href='019type_abbreviations.cc.html#L58'>new_type_tree</a><span class="Delimiter">(</span><span class="Constant">"recipe"</span><span class="Delimiter">));</span> <span id="L444" class="LineNr">444 </span> <span id="L445" class="LineNr">445 </span><span class="Comment">//: copying functions to variables</span> <span id="L446" class="LineNr">446 </span> @@ -544,12 +546,12 @@ if ('onhashchange' in window) { <span id="L481" class="LineNr">481 </span><span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name == <span class="Constant">"copy"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L482" class="LineNr">482 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L483" class="LineNr">483 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_recipe_literal<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="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L484" class="LineNr">484 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L326'>non_ghost_size</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">))</span> < <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L484" class="LineNr">484 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L326'>non_ghost_size</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Recipe_variants</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">))</span> < <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L485" class="LineNr">485 </span> <span class="Comment">// potentially overloaded recipe</span> <span id="L486" class="LineNr">486 </span> string new_name = <a href='054static_dispatch.cc.html#L173'>resolve_ambiguous_call</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> r<span class="Delimiter">,</span> index<span class="Delimiter">,</span> caller_recipe<span class="Delimiter">);</span> <span id="L487" class="LineNr">487 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>new_name == <span class="Constant">""</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L488" class="LineNr">488 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name = new_name<span class="Delimiter">;</span> -<span id="L489" class="LineNr">489 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>value = get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> new_name<span class="Delimiter">);</span> +<span id="L489" class="LineNr">489 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>value = get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> new_name<span class="Delimiter">);</span> <span id="L490" class="LineNr">490 </span> <span class="Delimiter">}</span> <span id="L491" class="LineNr">491 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L492" class="LineNr">492 </span><span class="Delimiter">}</span> @@ -617,21 +619,21 @@ if ('onhashchange' in window) { <span id="L554" class="LineNr">554 </span><span class="Delimiter">:(after "End resolve_ambiguous_call(r, index, inst, caller_recipe) Special-cases")</span> <span id="L555" class="LineNr">555 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L556" class="LineNr">556 </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>i<span class="Delimiter">)))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L557" class="LineNr">557 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L326'>non_ghost_size</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">))</span> < <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L558" class="LineNr">558 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">)</span> < <a href='010vm.cc.html#L198'>MAX_PRIMITIVE_RECIPES</a><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L559" class="LineNr">559 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L326'>non_ghost_size</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">))</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L560" class="LineNr">560 </span> <a href='003trace.cc.html#L196'>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">"sorry, we're not yet smart enough to simultaneously guess which overloads you want for '"</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">"' and '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L557" class="LineNr">557 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L326'>non_ghost_size</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Recipe_variants</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">))</span> < <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L558" class="LineNr">558 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">)</span> < <a href='010vm.cc.html#L198'>MAX_PRIMITIVE_RECIPES</a><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L559" class="LineNr">559 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L326'>non_ghost_size</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Recipe_variants</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">))</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L560" class="LineNr">560 </span> <a href='003trace.cc.html#L196'>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">"sorry, we're not yet smart enough to simultaneously guess which overloads you want for '"</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">"' and '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L561" class="LineNr">561 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L562" class="LineNr">562 </span> <span class="Delimiter">}</span> -<span id="L563" class="LineNr">563 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">));</span> +<span id="L563" class="LineNr">563 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>name<span class="Delimiter">));</span> <span id="L564" class="LineNr">564 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!callee<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L565" class="LineNr">565 </span> <a href='003trace.cc.html#L196'>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">"sorry, we're not yet smart enough to guess which variant of '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name << <span class="Constant">"' you want, when the caller '"</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">"' doesn't have a header</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L565" class="LineNr">565 </span> <a href='003trace.cc.html#L196'>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">"sorry, we're not yet smart enough to guess which variant of '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name << <span class="Constant">"' you want, when the caller '"</span> << inst<span class="Delimiter">.</span>name << <span class="Constant">"' doesn't have a header\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L566" class="LineNr">566 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L567" class="LineNr">567 </span> <span class="Delimiter">}</span> <span id="L568" class="LineNr">568 </span> string new_name = <a href='054static_dispatch.cc.html#L173'>resolve_ambiguous_call</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">,</span> callee<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> r<span class="Delimiter">,</span> index<span class="Delimiter">,</span> caller_recipe<span class="Delimiter">);</span> <span id="L569" class="LineNr">569 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>new_name != <span class="Constant">""</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L570" class="LineNr">570 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name = new_name<span class="Delimiter">;</span> -<span id="L571" class="LineNr">571 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>value = get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> new_name<span class="Delimiter">);</span> +<span id="L571" class="LineNr">571 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>value = get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> new_name<span class="Delimiter">);</span> <span id="L572" class="LineNr">572 </span> <span class="Delimiter">}</span> <span id="L573" class="LineNr">573 </span><span class="Delimiter">}</span> <span id="L574" class="LineNr">574 </span> @@ -664,16 +666,16 @@ if ('onhashchange' in window) { <span id="L601" class="LineNr">601 </span><span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name == <span class="Constant">"return"</span> || inst<span class="Delimiter">.</span>name == <span class="Constant">"reply"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L602" class="LineNr">602 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L603" class="LineNr">603 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_recipe_literal<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="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L604" class="LineNr">604 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L326'>non_ghost_size</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Recipe_variants<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">))</span> < <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L604" class="LineNr">604 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='054static_dispatch.cc.html#L326'>non_ghost_size</a><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Recipe_variants</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">))</span> < <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L605" class="LineNr">605 </span> <span class="Comment">// potentially overloaded recipe</span> <span id="L606" class="LineNr">606 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!caller_recipe<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L607" class="LineNr">607 </span> <a href='003trace.cc.html#L196'>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">"sorry, we're not yet smart enough to guess which variant of '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name << <span class="Constant">"' you want, without a recipe header</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L607" class="LineNr">607 </span> <a href='003trace.cc.html#L196'>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">"sorry, we're not yet smart enough to guess which variant of '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name << <span class="Constant">"' you want, without a recipe header\n"</span> << end<span class="Delimiter">();</span> <span id="L608" class="LineNr">608 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L609" class="LineNr">609 </span> <span class="Delimiter">}</span> <span id="L610" class="LineNr">610 </span> string new_name = <a href='054static_dispatch.cc.html#L173'>resolve_ambiguous_call</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name<span class="Delimiter">,</span> caller_recipe<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> r<span class="Delimiter">,</span> index<span class="Delimiter">,</span> caller_recipe<span class="Delimiter">);</span> <span id="L611" class="LineNr">611 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>new_name == <span class="Constant">""</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L612" class="LineNr">612 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>name = new_name<span class="Delimiter">;</span> -<span id="L613" class="LineNr">613 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>value = get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> new_name<span class="Delimiter">);</span> +<span id="L613" class="LineNr">613 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>value = get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> new_name<span class="Delimiter">);</span> <span id="L614" class="LineNr">614 </span> <span class="Delimiter">}</span> <span id="L615" class="LineNr">615 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L616" class="LineNr">616 </span><span class="Delimiter">}</span> diff --git a/html/073scheduler.cc.html b/html/073scheduler.cc.html index a7505f6a..2f53f0bb 100644 --- a/html/073scheduler.cc.html +++ b/html/073scheduler.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.cSpecial { color: #008000; } -.LineNr { color: #444444; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .traceAbsent { color: #c00000; } -.Constant { color: #00a0a0; } +.cSpecial { color: #008000; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } .traceContains { color: #008000; } --> @@ -61,6 +63,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/073scheduler.cc'>https://github.com/akkartik/mu/blob/master/073scheduler.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Run a second routine concurrently using 'start-running', without any</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: guarantees on how the operations in each are interleaved with each other.</span> @@ -81,22 +84,22 @@ if ('onhashchange' in window) { <span id="L17" class="LineNr"> 17 </span> <span id="L18" class="LineNr"> 18 </span><span class="Comment">//: first, add a deadline to run(routine)</span> <span id="L19" class="LineNr"> 19 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L20" class="LineNr"> 20 </span><span class="Normal">int</span> Scheduling_interval = <span class="Constant">500</span><span class="Delimiter">;</span> +<span id="L20" class="LineNr"> 20 </span><span class="Normal">int</span> <span class="Special">Scheduling_interval</span> = <span class="Constant">500</span><span class="Delimiter">;</span> <span id="L21" class="LineNr"> 21 </span><span class="Delimiter">:(before "End routine Fields")</span> <span id="L22" class="LineNr"> 22 </span><span class="Normal">int</span> instructions_run_this_scheduling_slice<span class="Delimiter">;</span> <span id="L23" class="LineNr"> 23 </span><span class="Delimiter">:(before "End routine Constructor")</span> <span id="L24" class="LineNr"> 24 </span>instructions_run_this_scheduling_slice = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L25" class="LineNr"> 25 </span><span class="Delimiter">:(after "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="L26" class="LineNr"> 26 </span> ++<span class="Special">Current_routine</span><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> <a href='073scheduler.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 == <a href='073scheduler.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="L29" class="LineNr"> 29 </span> assert<span class="Delimiter">(</span>current_routine == <span class="Special">Current_routine</span><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> <span class="Special">Current_routine</span><span class="Delimiter">-></span>state == <a href='073scheduler.cc.html#L41'>RUNNING</a> +<span id="L31" class="LineNr"> 31 </span> && <span class="Special">Current_routine</span><span class="Delimiter">-></span>instructions_run_this_scheduling_slice < <span class="Special">Scheduling_interval</span><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> <span id="L34" class="LineNr"> 34 </span><span class="Comment">// Reset instructions_run_this_scheduling_slice</span> -<span id="L35" class="LineNr"> 35 </span>Current_routine<span class="Delimiter">-></span>instructions_run_this_scheduling_slice = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L35" class="LineNr"> 35 </span><span class="Special">Current_routine</span><span class="Delimiter">-></span>instructions_run_this_scheduling_slice = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L36" class="LineNr"> 36 </span> <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> @@ -112,14 +115,14 @@ if ('onhashchange' in window) { <span id="L48" class="LineNr"> 48 </span>state = <a href='073scheduler.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="L51" class="LineNr"> 51 </span>vector<routine*> <span class="Special">Routines</span><span class="Delimiter">;</span> +<span id="L52" class="LineNr"> 52 </span><span class="Normal">int</span> <span class="Special">Current_routine_index</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L53" class="LineNr"> 53 </span><span class="Delimiter">:(before "End Reset")</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><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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> -<span id="L56" class="LineNr"> 56 </span> <span class="Normal">delete</span> Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L57" class="LineNr"> 57 </span>Routines<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L58" class="LineNr"> 58 </span>Current_routine = <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L54" class="LineNr"> 54 </span><span class="Special">Scheduling_interval</span> = <span class="Constant">500</span><span class="Delimiter">;</span> +<span id="L55" class="LineNr"> 55 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> +<span id="L56" class="LineNr"> 56 </span> <span class="Normal">delete</span> <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L57" class="LineNr"> 57 </span><span class="Special">Routines</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L58" class="LineNr"> 58 </span><span class="Special">Current_routine</span> = <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L59" class="LineNr"> 59 </span><span class="Delimiter">:(replace{} "void run(const <a href='010vm.cc.html#L14'>recipe_ordinal</a> r)")</span> <span id="L60" class="LineNr"> 60 </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="L61" class="LineNr"> 61 </span> run<span class="Delimiter">(</span><span class="Normal">new</span> routine<span class="Delimiter">(</span>r<span class="Delimiter">));</span> @@ -127,17 +130,17 @@ if ('onhashchange' in window) { <span id="L63" class="LineNr"> 63 </span> <span id="L64" class="LineNr"> 64 </span><span class="Delimiter">:(code)</span> <span id="L65" class="LineNr"> 65 </span><span class="Normal">void</span> run<span class="Delimiter">(</span>routine* rr<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L66" class="LineNr"> 66 </span> Routines<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>rr<span class="Delimiter">);</span> -<span id="L67" class="LineNr"> 67 </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="L66" class="LineNr"> 66 </span> <span class="Special">Routines</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>rr<span class="Delimiter">);</span> +<span id="L67" class="LineNr"> 67 </span> <span class="Special">Current_routine_index</span> = <span class="Constant">0</span><span class="Delimiter">,</span> <span class="Special">Current_routine</span> = <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L68" class="LineNr"> 68 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>!all_routines_done<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L69" class="LineNr"> 69 </span> <a href='073scheduler.cc.html#L94'>skip_to_next_routine</a><span class="Delimiter">();</span> -<span id="L70" class="LineNr"> 70 </span> assert<span class="Delimiter">(</span>Current_routine<span class="Delimiter">);</span> -<span id="L71" class="LineNr"> 71 </span> assert<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>state == <a href='073scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">);</span> +<span id="L70" class="LineNr"> 70 </span> assert<span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">);</span> +<span id="L71" class="LineNr"> 71 </span> assert<span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>state == <a href='073scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">);</span> <span id="L72" class="LineNr"> 72 </span> <a href='003trace.cc.html#L189'>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='073scheduler.cc.html#L106'>current_routine_label</a><span class="Delimiter">()</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L73" class="LineNr"> 73 </span> run_current_routine<span class="Delimiter">();</span> <span id="L74" class="LineNr"> 74 </span> <span class="Comment">// Scheduler State Transitions</span> -<span id="L75" class="LineNr"> 75 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>completed<span class="Delimiter">())</span> -<span id="L76" class="LineNr"> 76 </span> Current_routine<span class="Delimiter">-></span>state = <a href='073scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">;</span> +<span id="L75" class="LineNr"> 75 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>completed<span class="Delimiter">())</span> +<span id="L76" class="LineNr"> 76 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>state = <a href='073scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">;</span> <span id="L77" class="LineNr"> 77 </span> <span class="Comment">// End Scheduler State Transitions</span> <span id="L78" class="LineNr"> 78 </span> <span id="L79" class="LineNr"> 79 </span> <span class="Comment">// Scheduler Cleanup</span> @@ -147,8 +150,8 @@ if ('onhashchange' in window) { <span id="L83" class="LineNr"> 83 </span><span class="Delimiter">}</span> <span id="L84" class="LineNr"> 84 </span> <span id="L85" class="LineNr"> 85 </span><span class="Normal">bool</span> <a href='073scheduler.cc.html#L85'>all_routines_done</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L86" class="LineNr"> 86 </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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L87" class="LineNr"> 87 </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='073scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">)</span> +<span id="L86" class="LineNr"> 86 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L87" class="LineNr"> 87 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state == <a href='073scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">)</span> <span id="L88" class="LineNr"> 88 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L89" class="LineNr"> 89 </span> <span class="Delimiter">}</span> <span id="L90" class="LineNr"> 90 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> @@ -156,19 +159,19 @@ if ('onhashchange' in window) { <span id="L92" class="LineNr"> 92 </span> <span id="L93" class="LineNr"> 93 </span><span class="Comment">// skip Current_routine_index past non-RUNNING routines</span> <span id="L94" class="LineNr"> 94 </span><span class="Normal">void</span> <a href='073scheduler.cc.html#L94'>skip_to_next_routine</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L95" class="LineNr"> 95 </span> assert<span class="Delimiter">(</span>!Routines<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L96" class="LineNr"> 96 </span> assert<span class="Delimiter">(</span>Current_routine_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">));</span> -<span id="L97" class="LineNr"> 97 </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="L98" class="LineNr"> 98 </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='073scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L99" class="LineNr"> 99 </span> Current_routine_index = i<span class="Delimiter">;</span> -<span id="L100" class="LineNr">100 </span> Current_routine = Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L95" class="LineNr"> 95 </span> assert<span class="Delimiter">(</span>!<span class="Special">Routines</span><span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L96" class="LineNr"> 96 </span> assert<span class="Delimiter">(</span><span class="Special">Current_routine_index</span> < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">));</span> +<span id="L97" class="LineNr"> 97 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Delimiter">(</span><span class="Special">Current_routine_index</span>+<span class="Constant">1</span><span class="Delimiter">)</span>%SIZE<span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> i != <span class="Special">Current_routine_index</span><span class="Delimiter">;</span> i = <span class="Delimiter">(</span>i+<span class="Constant">1</span><span class="Delimiter">)</span>%SIZE<span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L98" class="LineNr"> 98 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state == <a href='073scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L99" class="LineNr"> 99 </span> <span class="Special">Current_routine_index</span> = i<span class="Delimiter">;</span> +<span id="L100" class="LineNr">100 </span> <span class="Special">Current_routine</span> = <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L101" class="LineNr">101 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L102" class="LineNr">102 </span> <span class="Delimiter">}</span> <span id="L103" class="LineNr">103 </span> <span class="Delimiter">}</span> <span id="L104" class="LineNr">104 </span><span class="Delimiter">}</span> <span id="L105" class="LineNr">105 </span> <span id="L106" class="LineNr">106 </span>string <a href='073scheduler.cc.html#L106'>current_routine_label</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L107" class="LineNr">107 </span> <span class="Identifier">return</span> <a href='073scheduler.cc.html#L110'>routine_label</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">);</span> +<span id="L107" class="LineNr">107 </span> <span class="Identifier">return</span> <a href='073scheduler.cc.html#L110'>routine_label</a><span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">);</span> <span id="L108" class="LineNr">108 </span><span class="Delimiter">}</span> <span id="L109" class="LineNr">109 </span> <span id="L110" class="LineNr">110 </span>string <a href='073scheduler.cc.html#L110'>routine_label</a><span class="Delimiter">(</span>routine* r<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -176,7 +179,7 @@ if ('onhashchange' in window) { <span id="L112" class="LineNr">112 </span> <span class="Normal">const</span> call_stack& calls = r<span class="Delimiter">-></span>calls<span class="Delimiter">;</span> <span id="L113" class="LineNr">113 </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#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L114" class="LineNr">114 </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="L115" class="LineNr">115 </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="L115" class="LineNr">115 </span> result << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name<span class="Delimiter">;</span> <span id="L116" class="LineNr">116 </span> <span class="Delimiter">}</span> <span id="L117" class="LineNr">117 </span> <span class="Identifier">return</span> result<span class="Delimiter">.</span>str<span class="Delimiter">();</span> <span id="L118" class="LineNr">118 </span><span class="Delimiter">}</span> @@ -184,16 +187,16 @@ if ('onhashchange' in window) { <span id="L120" class="LineNr">120 </span><span class="Comment">//: special case for the very first routine</span> <span id="L121" class="LineNr">121 </span><span class="Delimiter">:(replace{} "void run_main(int argc, char* argv[])")</span> <span id="L122" class="LineNr">122 </span><span class="Normal">void</span> <a href='073scheduler.cc.html#L122'>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="L123" class="LineNr">123 </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="L123" class="LineNr">123 </span> <a href='010vm.cc.html#L14'>recipe_ordinal</a> r = get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"main"</span><span class="Delimiter">);</span> <span id="L124" class="LineNr">124 </span> assert<span class="Delimiter">(</span>r<span class="Delimiter">);</span> <span id="L125" class="LineNr">125 </span> routine* main_routine = <span class="Normal">new</span> routine<span class="Delimiter">(</span>r<span class="Delimiter">);</span> <span id="L126" class="LineNr">126 </span> <span class="Comment">// pass in commandline args as ingredients to main</span> <span id="L127" class="LineNr">127 </span> <span class="Comment">// todo: test this</span> -<span id="L128" class="LineNr">128 </span> Current_routine = main_routine<span class="Delimiter">;</span> +<span id="L128" class="LineNr">128 </span> <span class="Special">Current_routine</span> = main_routine<span class="Delimiter">;</span> <span id="L129" class="LineNr">129 </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="L130" class="LineNr">130 </span> vector<<span class="Normal">double</span>> arg<span class="Delimiter">;</span> <span id="L131" class="LineNr">131 </span> arg<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='038new_text.cc.html#L39'>new_mu_text</a><span class="Delimiter">(</span>argv[i]<span class="Delimiter">));</span> -<span id="L132" class="LineNr">132 </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="L132" class="LineNr">132 </span> assert<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Memory</span><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="L133" class="LineNr">133 </span> <a href='026call.cc.html#L83'>current_call</a><span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>arg<span class="Delimiter">);</span> <span id="L134" class="LineNr">134 </span> <span class="Delimiter">}</span> <span id="L135" class="LineNr">135 </span> run<span class="Delimiter">(</span>main_routine<span class="Delimiter">);</span> @@ -206,11 +209,11 @@ if ('onhashchange' in window) { <span id="L142" class="LineNr">142 </span><span class="Delimiter">:(before "End routine Fields")</span> <span id="L143" class="LineNr">143 </span><span class="Normal">int</span> id<span class="Delimiter">;</span> <span id="L144" class="LineNr">144 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L145" class="LineNr">145 </span><span class="Normal">int</span> Next_routine_id = <span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L145" class="LineNr">145 </span><span class="Normal">int</span> <span class="Special">Next_routine_id</span> = <span class="Constant">1</span><span class="Delimiter">;</span> <span id="L146" class="LineNr">146 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L147" class="LineNr">147 </span>Next_routine_id = <span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L147" class="LineNr">147 </span><span class="Special">Next_routine_id</span> = <span class="Constant">1</span><span class="Delimiter">;</span> <span id="L148" class="LineNr">148 </span><span class="Delimiter">:(before "End routine Constructor")</span> -<span id="L149" class="LineNr">149 </span>id = Next_routine_id<span class="Delimiter">;</span> +<span id="L149" class="LineNr">149 </span>id = <span class="Special">Next_routine_id</span><span class="Delimiter">;</span> <span id="L150" class="LineNr">150 </span><span class="traceContains">++Next_routine_id;</span> <span id="L151" class="LineNr">151 </span> <span id="L152" class="LineNr">152 </span><span class="Comment">//: routines save the routine that spawned them</span> @@ -223,15 +226,15 @@ if ('onhashchange' in window) { <span id="L159" class="LineNr">159 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L160" class="LineNr">160 </span>START_RUNNING<span class="Delimiter">,</span> <span id="L161" class="LineNr">161 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L162" class="LineNr">162 </span><a href='001help.cc.html#L221'>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="L162" class="LineNr">162 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"start-running"</span><span class="Delimiter">,</span> START_RUNNING<span class="Delimiter">);</span> <span id="L163" class="LineNr">163 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L164" class="LineNr">164 </span><span class="Normal">case</span> START_RUNNING: <span class="Delimiter">{</span> <span id="L165" class="LineNr">165 </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="L166" class="LineNr">166 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L166" class="LineNr">166 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><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\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L167" class="LineNr">167 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L168" class="LineNr">168 </span> <span class="Delimiter">}</span> <span id="L169" class="LineNr">169 </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="L170" class="LineNr">170 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L170" class="LineNr">170 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><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">"'\n"</span> << <a href='003trace.cc.html#L225'>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="Identifier">break</span><span class="Delimiter">;</span> @@ -239,7 +242,7 @@ if ('onhashchange' in window) { <span id="L175" class="LineNr">175 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L176" class="LineNr">176 </span><span class="Normal">case</span> START_RUNNING: <span class="Delimiter">{</span> <span id="L177" class="LineNr">177 </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="L178" class="LineNr">178 </span> new_routine<span class="Delimiter">-></span>parent_index = Current_routine_index<span class="Delimiter">;</span> +<span id="L178" class="LineNr">178 </span> new_routine<span class="Delimiter">-></span>parent_index = <span class="Special">Current_routine_index</span><span class="Delimiter">;</span> <span id="L179" class="LineNr">179 </span> <span class="Comment">// populate ingredients</span> <span id="L180" class="LineNr">180 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Comment">/*</span><span class="Comment">skip callee</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> i < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L181" class="LineNr">181 </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> @@ -247,7 +250,7 @@ if ('onhashchange' in window) { <span id="L183" class="LineNr">183 </span> new_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>ingredient<span class="Delimiter">);</span> <span id="L184" class="LineNr">184 </span> <span class="Comment">// End Populate start-running Ingredient</span> <span id="L185" class="LineNr">185 </span> <span class="Delimiter">}</span> -<span id="L186" class="LineNr">186 </span> Routines<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>new_routine<span class="Delimiter">);</span> +<span id="L186" class="LineNr">186 </span> <span class="Special">Routines</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>new_routine<span class="Delimiter">);</span> <span id="L187" class="LineNr">187 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L188" class="LineNr">188 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>new_routine<span class="Delimiter">-></span>id<span class="Delimiter">);</span> <span id="L189" class="LineNr">189 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -376,8 +379,8 @@ if ('onhashchange' in window) { <span id="L312" class="LineNr">312 </span><span class="traceAbsent">-error: f2: divide by zero in '4:num <- divide-with-remainder 4, 0'</span> <span id="L313" class="LineNr">313 </span> <span id="L314" class="LineNr">314 </span><span class="Delimiter">:(after "operator<<(ostream& os, <a href='003trace.cc.html#L225'>end</a> /*unused*/)")</span> -<span id="L315" class="LineNr">315 </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="L316" class="LineNr">316 </span> Current_routine<span class="Delimiter">-></span>state = <a href='073scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">;</span> +<span id="L315" class="LineNr">315 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_stream</span> && <span class="Special">Trace_stream</span><span class="Delimiter">-></span>curr_label == <span class="Constant">"error"</span> && <span class="Special">Current_routine</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L316" class="LineNr">316 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>state = <a href='073scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">;</span> <span id="L317" class="LineNr">317 </span> <span class="Delimiter">}</span> <span id="L318" class="LineNr">318 </span> <span id="L319" class="LineNr">319 </span><span class="SalientComment">//:: Routines are marked completed when their parent completes.</span> @@ -393,19 +396,19 @@ if ('onhashchange' in window) { <span id="L329" class="LineNr">329 </span><span class="traceAbsent">-schedule: f1</span> <span id="L330" class="LineNr">330 </span> <span id="L331" class="LineNr">331 </span><span class="Delimiter">:(before "End Scheduler Cleanup")</span> -<span id="L332" class="LineNr">332 </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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L333" class="LineNr">333 </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='073scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L334" class="LineNr">334 </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="L332" class="LineNr">332 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L333" class="LineNr">333 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state == <a href='073scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L334" class="LineNr">334 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><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="L335" class="LineNr">335 </span> <span class="Comment">// structured concurrency: <a href="http://250bpm.com/blog:71">http://250bpm.com/blog:71</a></span> <span id="L336" class="LineNr">336 </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="L337" class="LineNr">337 </span> Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state = <a href='073scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">;</span> +<span id="L337" class="LineNr">337 </span> <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state = <a href='073scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">;</span> <span id="L338" class="LineNr">338 </span> <span class="Delimiter">}</span> <span id="L339" class="LineNr">339 </span><span class="Delimiter">}</span> <span id="L340" class="LineNr">340 </span> <span id="L341" class="LineNr">341 </span><span class="Delimiter">:(code)</span> <span id="L342" class="LineNr">342 </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="L343" class="LineNr">343 </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="L344" class="LineNr">344 </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='073scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">)</span> +<span id="L343" class="LineNr">343 </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 = <span class="Special">Routines</span><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="L344" class="LineNr">344 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">)-></span>state == <a href='073scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">)</span> <span id="L345" class="LineNr">345 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L346" class="LineNr">346 </span> <span class="Delimiter">}</span> <span id="L347" class="LineNr">347 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> @@ -431,15 +434,15 @@ if ('onhashchange' in window) { <span id="L367" class="LineNr">367 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L368" class="LineNr">368 </span>ROUTINE_STATE<span class="Delimiter">,</span> <span id="L369" class="LineNr">369 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L370" class="LineNr">370 </span><a href='001help.cc.html#L221'>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="L370" class="LineNr">370 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"routine-state"</span><span class="Delimiter">,</span> ROUTINE_STATE<span class="Delimiter">);</span> <span id="L371" class="LineNr">371 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L372" class="LineNr">372 </span><span class="Normal">case</span> ROUTINE_STATE: <span class="Delimiter">{</span> <span id="L373" class="LineNr">373 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L374" class="LineNr">374 </span> <a href='003trace.cc.html#L196'>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> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L374" class="LineNr">374 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><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> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L375" class="LineNr">375 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L376" class="LineNr">376 </span> <span class="Delimiter">}</span> <span id="L377" class="LineNr">377 </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="L378" class="LineNr">378 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L378" class="LineNr">378 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L379" class="LineNr">379 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L380" class="LineNr">380 </span> <span class="Delimiter">}</span> <span id="L381" class="LineNr">381 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -448,9 +451,9 @@ if ('onhashchange' in window) { <span id="L384" class="LineNr">384 </span><span class="Normal">case</span> ROUTINE_STATE: <span class="Delimiter">{</span> <span id="L385" class="LineNr">385 </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="L386" class="LineNr">386 </span> <span class="Normal">int</span> result = -<span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L387" class="LineNr">387 </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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L388" class="LineNr">388 </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="L389" class="LineNr">389 </span> result = Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state<span class="Delimiter">;</span> +<span id="L387" class="LineNr">387 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L388" class="LineNr">388 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><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="L389" class="LineNr">389 </span> result = <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state<span class="Delimiter">;</span> <span id="L390" class="LineNr">390 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L391" class="LineNr">391 </span> <span class="Delimiter">}</span> <span id="L392" class="LineNr">392 </span> <span class="Delimiter">}</span> @@ -464,15 +467,15 @@ if ('onhashchange' in window) { <span id="L400" class="LineNr">400 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L401" class="LineNr">401 </span>STOP<span class="Delimiter">,</span> <span id="L402" class="LineNr">402 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L403" class="LineNr">403 </span><a href='001help.cc.html#L221'>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="L403" class="LineNr">403 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"stop"</span><span class="Delimiter">,</span> STOP<span class="Delimiter">);</span> <span id="L404" class="LineNr">404 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L405" class="LineNr">405 </span><span class="Normal">case</span> STOP: <span class="Delimiter">{</span> <span id="L406" class="LineNr">406 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L407" class="LineNr">407 </span> <a href='003trace.cc.html#L196'>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> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L407" class="LineNr">407 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><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> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L408" class="LineNr">408 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L409" class="LineNr">409 </span> <span class="Delimiter">}</span> <span id="L410" class="LineNr">410 </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="L411" class="LineNr">411 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L411" class="LineNr">411 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L412" class="LineNr">412 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L413" class="LineNr">413 </span> <span class="Delimiter">}</span> <span id="L414" class="LineNr">414 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -480,9 +483,9 @@ if ('onhashchange' in window) { <span id="L416" class="LineNr">416 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L417" class="LineNr">417 </span><span class="Normal">case</span> STOP: <span class="Delimiter">{</span> <span id="L418" class="LineNr">418 </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="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#L141'>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>id == id<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L421" class="LineNr">421 </span> Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state = <a href='073scheduler.cc.html#L42'>COMPLETED</a><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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><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><span class="Special">Routines</span><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="L421" class="LineNr">421 </span> <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state = <a href='073scheduler.cc.html#L42'>COMPLETED</a><span class="Delimiter">;</span> <span id="L422" class="LineNr">422 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L423" class="LineNr">423 </span> <span class="Delimiter">}</span> <span id="L424" class="LineNr">424 </span> <span class="Delimiter">}</span> @@ -492,15 +495,15 @@ if ('onhashchange' in window) { <span id="L428" class="LineNr">428 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L429" class="LineNr">429 </span>_DUMP_ROUTINES<span class="Delimiter">,</span> <span id="L430" class="LineNr">430 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L431" class="LineNr">431 </span><a href='001help.cc.html#L221'>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="L431" class="LineNr">431 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$dump-routines"</span><span class="Delimiter">,</span> _DUMP_ROUTINES<span class="Delimiter">);</span> <span id="L432" class="LineNr">432 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L433" class="LineNr">433 </span><span class="Normal">case</span> _DUMP_ROUTINES: <span class="Delimiter">{</span> <span id="L434" class="LineNr">434 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L435" class="LineNr">435 </span><span class="Delimiter">}</span> <span id="L436" class="LineNr">436 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L437" class="LineNr">437 </span><span class="Normal">case</span> _DUMP_ROUTINES: <span class="Delimiter">{</span> -<span id="L438" class="LineNr">438 </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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L439" class="LineNr">439 </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="L438" class="LineNr">438 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L439" class="LineNr">439 </span> cerr << i << <span class="Constant">": "</span> << <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>id << <span class="Constant">' '</span> << <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state << <span class="Constant">' '</span> << <span class="Special">Routines</span><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="L440" class="LineNr">440 </span> <span class="Delimiter">}</span> <span id="L441" class="LineNr">441 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L442" class="LineNr">442 </span><span class="Delimiter">}</span> @@ -527,28 +530,28 @@ if ('onhashchange' in window) { <span id="L463" class="LineNr">463 </span><span class="Delimiter">:(before "End routine States")</span> <span id="L464" class="LineNr">464 </span>DISCONTINUED<span class="Delimiter">,</span> <span id="L465" class="LineNr">465 </span><span class="Delimiter">:(before "End Scheduler State Transitions")</span> -<span id="L466" class="LineNr">466 </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="L467" class="LineNr">467 </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="L468" class="LineNr">468 </span> <a href='003trace.cc.html#L189'>trace</a><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#L225'>end</a><span class="Delimiter">();</span> -<span id="L469" class="LineNr">469 </span> Current_routine<span class="Delimiter">-></span>state = DISCONTINUED<span class="Delimiter">;</span> -<span id="L470" class="LineNr">470 </span> Current_routine<span class="Delimiter">-></span>limit = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L466" class="LineNr">466 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>limit >= <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L467" class="LineNr">467 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>limit <= <span class="Special">Scheduling_interval</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L468" class="LineNr">468 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"schedule"</span><span class="Delimiter">)</span> << <span class="Constant">"discontinuing routine "</span> << <span class="Special">Current_routine</span><span class="Delimiter">-></span>id << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L469" class="LineNr">469 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>state = DISCONTINUED<span class="Delimiter">;</span> +<span id="L470" class="LineNr">470 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>limit = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L471" class="LineNr">471 </span> <span class="Delimiter">}</span> <span id="L472" class="LineNr">472 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> -<span id="L473" class="LineNr">473 </span> Current_routine<span class="Delimiter">-></span>limit -= Scheduling_interval<span class="Delimiter">;</span> +<span id="L473" class="LineNr">473 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>limit -= <span class="Special">Scheduling_interval</span><span class="Delimiter">;</span> <span id="L474" class="LineNr">474 </span> <span class="Delimiter">}</span> <span id="L475" class="LineNr">475 </span><span class="Delimiter">}</span> <span id="L476" class="LineNr">476 </span> <span id="L477" class="LineNr">477 </span><span class="Delimiter">:(before "End Test Teardown")</span> -<span id="L478" class="LineNr">478 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Passed && any_routines_with_error<span class="Delimiter">())</span> -<span id="L479" class="LineNr">479 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L478" class="LineNr">478 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Passed</span> && any_routines_with_error<span class="Delimiter">())</span> +<span id="L479" class="LineNr">479 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"some routines died with errors\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L480" class="LineNr">480 </span><span class="Delimiter">:(before "End Mu Test Teardown")</span> -<span id="L481" class="LineNr">481 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Passed && any_routines_with_error<span class="Delimiter">())</span> -<span id="L482" class="LineNr">482 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L481" class="LineNr">481 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Passed</span> && any_routines_with_error<span class="Delimiter">())</span> +<span id="L482" class="LineNr">482 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Special">Current_scenario</span><span class="Delimiter">-></span>name << <span class="Constant">": some routines died with errors\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L483" class="LineNr">483 </span> <span id="L484" class="LineNr">484 </span><span class="Delimiter">:(code)</span> <span id="L485" class="LineNr">485 </span><span class="Normal">bool</span> any_routines_with_error<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L486" class="LineNr">486 </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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L487" class="LineNr">487 </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="L486" class="LineNr">486 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L487" class="LineNr">487 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state == DISCONTINUED<span class="Delimiter">)</span> <span id="L488" class="LineNr">488 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L489" class="LineNr">489 </span> <span class="Delimiter">}</span> <span id="L490" class="LineNr">490 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> @@ -562,19 +565,19 @@ if ('onhashchange' in window) { <span id="L498" class="LineNr">498 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L499" class="LineNr">499 </span>LIMIT_TIME<span class="Delimiter">,</span> <span id="L500" class="LineNr">500 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L501" class="LineNr">501 </span><a href='001help.cc.html#L221'>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="L501" class="LineNr">501 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"limit-time"</span><span class="Delimiter">,</span> LIMIT_TIME<span class="Delimiter">);</span> <span id="L502" class="LineNr">502 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L503" class="LineNr">503 </span><span class="Normal">case</span> LIMIT_TIME: <span class="Delimiter">{</span> <span id="L504" class="LineNr">504 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L505" class="LineNr">505 </span> <a href='003trace.cc.html#L196'>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> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L505" class="LineNr">505 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><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> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L506" class="LineNr">506 </span> <span class="Identifier">break</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="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="L509" class="LineNr">509 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L509" class="LineNr">509 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L510" class="LineNr">510 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L511" class="LineNr">511 </span> <span class="Delimiter">}</span> <span id="L512" class="LineNr">512 </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="L513" class="LineNr">513 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L513" class="LineNr">513 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L514" class="LineNr">514 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L515" class="LineNr">515 </span> <span class="Delimiter">}</span> <span id="L516" class="LineNr">516 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -582,9 +585,9 @@ if ('onhashchange' in window) { <span id="L518" class="LineNr">518 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L519" class="LineNr">519 </span><span class="Normal">case</span> LIMIT_TIME: <span class="Delimiter">{</span> <span id="L520" class="LineNr">520 </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="L521" class="LineNr">521 </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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L522" class="LineNr">522 </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="L523" class="LineNr">523 </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="L521" class="LineNr">521 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L522" class="LineNr">522 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><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="L523" class="LineNr">523 </span> <span class="Special">Routines</span><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="L524" class="LineNr">524 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L525" class="LineNr">525 </span> <span class="Delimiter">}</span> <span id="L526" class="LineNr">526 </span> <span class="Delimiter">}</span> @@ -596,19 +599,19 @@ if ('onhashchange' in window) { <span id="L532" class="LineNr">532 </span><span class="Delimiter">:(before "End routine Constructor")</span> <span id="L533" class="LineNr">533 </span>instructions_run = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L534" class="LineNr">534 </span><span class="Delimiter">:(before "Reset instructions_run_this_scheduling_slice")</span> -<span id="L535" class="LineNr">535 </span>Current_routine<span class="Delimiter">-></span>instructions_run += Current_routine<span class="Delimiter">-></span>instructions_run_this_scheduling_slice<span class="Delimiter">;</span> +<span id="L535" class="LineNr">535 </span><span class="Special">Current_routine</span><span class="Delimiter">-></span>instructions_run += <span class="Special">Current_routine</span><span class="Delimiter">-></span>instructions_run_this_scheduling_slice<span class="Delimiter">;</span> <span id="L536" class="LineNr">536 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L537" class="LineNr">537 </span>NUMBER_OF_INSTRUCTIONS<span class="Delimiter">,</span> <span id="L538" class="LineNr">538 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L539" class="LineNr">539 </span><a href='001help.cc.html#L221'>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="L539" class="LineNr">539 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"number-of-instructions"</span><span class="Delimiter">,</span> NUMBER_OF_INSTRUCTIONS<span class="Delimiter">);</span> <span id="L540" class="LineNr">540 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L541" class="LineNr">541 </span><span class="Normal">case</span> NUMBER_OF_INSTRUCTIONS: <span class="Delimiter">{</span> <span id="L542" class="LineNr">542 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L543" class="LineNr">543 </span> <a href='003trace.cc.html#L196'>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> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L543" class="LineNr">543 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><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> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L544" class="LineNr">544 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L545" class="LineNr">545 </span> <span class="Delimiter">}</span> <span id="L546" class="LineNr">546 </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="L547" class="LineNr">547 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L547" class="LineNr">547 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L548" class="LineNr">548 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L549" class="LineNr">549 </span> <span class="Delimiter">}</span> <span id="L550" class="LineNr">550 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -617,9 +620,9 @@ if ('onhashchange' in window) { <span id="L553" class="LineNr">553 </span><span class="Normal">case</span> NUMBER_OF_INSTRUCTIONS: <span class="Delimiter">{</span> <span id="L554" class="LineNr">554 </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="L555" class="LineNr">555 </span> <span class="Normal">int</span> result = -<span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L556" class="LineNr">556 </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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L557" class="LineNr">557 </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="L558" class="LineNr">558 </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="L556" class="LineNr">556 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L557" class="LineNr">557 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><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="L558" class="LineNr">558 </span> result = <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>instructions_run<span class="Delimiter">;</span> <span id="L559" class="LineNr">559 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L560" class="LineNr">560 </span> <span class="Delimiter">}</span> <span id="L561" class="LineNr">561 </span> <span class="Delimiter">}</span> diff --git a/html/074wait.cc.html b/html/074wait.cc.html index caf08263..96938e74 100644 --- a/html/074wait.cc.html +++ b/html/074wait.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } .traceContains { color: #008000; } --> @@ -61,6 +63,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/074wait.cc'>https://github.com/akkartik/mu/blob/master/074wait.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Routines can be put in a 'waiting' state, from which it will be ready to</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: run again when a specific memory location changes its value. This is Mu's</span> @@ -97,28 +100,28 @@ if ('onhashchange' in window) { <span id="L33" class="LineNr"> 33 </span>waiting_on_location = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L34" class="LineNr"> 34 </span> <span id="L35" class="LineNr"> 35 </span><span class="Delimiter">:(before "End Mu Test Teardown")</span> -<span id="L36" class="LineNr"> 36 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Passed && <a href='074wait.cc.html#L47'>any_routines_waiting</a><span class="Delimiter">())</span> -<span id="L37" class="LineNr"> 37 </span> <a href='003trace.cc.html#L196'>raise</a> << Current_scenario<span class="Delimiter">-></span>name << <span class="Constant">": deadlock!</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L36" class="LineNr"> 36 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Passed</span> && <a href='074wait.cc.html#L47'>any_routines_waiting</a><span class="Delimiter">())</span> +<span id="L37" class="LineNr"> 37 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Special">Current_scenario</span><span class="Delimiter">-></span>name << <span class="Constant">": deadlock!\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L38" class="LineNr"> 38 </span><span class="Delimiter">:(before "End Run Routine")</span> <span id="L39" class="LineNr"> 39 </span><span class="Normal">if</span> <span class="Delimiter">(</span><a href='074wait.cc.html#L47'>any_routines_waiting</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L40" class="LineNr"> 40 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"deadlock!</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L40" class="LineNr"> 40 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"deadlock!\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L41" class="LineNr"> 41 </span> <a href='074wait.cc.html#L54'>dump_waiting_routines</a><span class="Delimiter">();</span> <span id="L42" class="LineNr"> 42 </span><span class="Delimiter">}</span> <span id="L43" class="LineNr"> 43 </span><span class="Delimiter">:(before "End Test Teardown")</span> -<span id="L44" class="LineNr"> 44 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Passed && any_routines_with_error<span class="Delimiter">())</span> -<span id="L45" class="LineNr"> 45 </span> <a href='003trace.cc.html#L196'>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#L225'>end</a><span class="Delimiter">();</span> +<span id="L44" class="LineNr"> 44 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Passed</span> && any_routines_with_error<span class="Delimiter">())</span> +<span id="L45" class="LineNr"> 45 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"some routines died with errors\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L46" class="LineNr"> 46 </span><span class="Delimiter">:(code)</span> <span id="L47" class="LineNr"> 47 </span><span class="Normal">bool</span> <a href='074wait.cc.html#L47'>any_routines_waiting</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L48" class="LineNr"> 48 </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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L49" class="LineNr"> 49 </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 == WAITING<span class="Delimiter">)</span> +<span id="L48" class="LineNr"> 48 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L49" class="LineNr"> 49 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state == WAITING<span class="Delimiter">)</span> <span id="L50" class="LineNr"> 50 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L51" class="LineNr"> 51 </span> <span class="Delimiter">}</span> <span id="L52" class="LineNr"> 52 </span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L53" class="LineNr"> 53 </span><span class="Delimiter">}</span> <span id="L54" class="LineNr"> 54 </span><span class="Normal">void</span> <a href='074wait.cc.html#L54'>dump_waiting_routines</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L55" class="LineNr"> 55 </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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L56" class="LineNr"> 56 </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 == WAITING<span class="Delimiter">)</span> -<span id="L57" class="LineNr"> 57 </span> cerr << i << <span class="Constant">": "</span> << <a href='073scheduler.cc.html#L110'>routine_label</a><span class="Delimiter">(</span>Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L55" class="LineNr"> 55 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L56" class="LineNr"> 56 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state == WAITING<span class="Delimiter">)</span> +<span id="L57" class="LineNr"> 57 </span> cerr << i << <span class="Constant">": "</span> << <a href='073scheduler.cc.html#L110'>routine_label</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">))</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L58" class="LineNr"> 58 </span> <span class="Delimiter">}</span> <span id="L59" class="LineNr"> 59 </span><span class="Delimiter">}</span> <span id="L60" class="LineNr"> 60 </span> @@ -138,30 +141,30 @@ if ('onhashchange' in window) { <span id="L74" class="LineNr"> 74 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L75" class="LineNr"> 75 </span>WAIT_FOR_RESET_THEN_SET<span class="Delimiter">,</span> <span id="L76" class="LineNr"> 76 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L77" class="LineNr"> 77 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"wait-for-reset-then-set"</span><span class="Delimiter">,</span> WAIT_FOR_RESET_THEN_SET<span class="Delimiter">);</span> +<span id="L77" class="LineNr"> 77 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"wait-for-reset-then-set"</span><span class="Delimiter">,</span> WAIT_FOR_RESET_THEN_SET<span class="Delimiter">);</span> <span id="L78" class="LineNr"> 78 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L79" class="LineNr"> 79 </span><span class="Normal">case</span> WAIT_FOR_RESET_THEN_SET: <span class="Delimiter">{</span> <span id="L80" class="LineNr"> 80 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L81" class="LineNr"> 81 </span> <a href='003trace.cc.html#L196'>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">"'wait-for-reset-then-set' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L81" class="LineNr"> 81 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'wait-for-reset-then-set' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L82" class="LineNr"> 82 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L83" class="LineNr"> 83 </span> <span class="Delimiter">}</span> <span id="L84" class="LineNr"> 84 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_location<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="L85" class="LineNr"> 85 </span> <a href='003trace.cc.html#L196'>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">"'wait-for-reset-then-set' requires a location ingredient, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L85" class="LineNr"> 85 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'wait-for-reset-then-set' requires a location ingredient, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><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">break</span><span class="Delimiter">;</span> <span id="L88" class="LineNr"> 88 </span><span class="Delimiter">}</span> <span id="L89" class="LineNr"> 89 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L90" class="LineNr"> 90 </span><span class="Normal">case</span> WAIT_FOR_RESET_THEN_SET: <span class="Delimiter">{</span> <span id="L91" class="LineNr"> 91 </span> <span class="Normal">int</span> loc = <span class="Normal">static_cast</span><<span class="Normal">int</span>><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="L92" class="LineNr"> 92 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"wait: *"</span> << loc << <span class="Constant">" = "</span> << <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L93" class="LineNr"> 93 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L92" class="LineNr"> 92 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"wait: *"</span> << loc << <span class="Constant">" = "</span> << <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> loc<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L93" class="LineNr"> 93 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> loc<span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L94" class="LineNr"> 94 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"location "</span> << loc << <span class="Constant">" is already 0; setting"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L95" class="LineNr"> 95 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L95" class="LineNr"> 95 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> loc<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> <span id="L96" class="LineNr"> 96 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L97" class="LineNr"> 97 </span> <span class="Delimiter">}</span> <span id="L98" class="LineNr"> 98 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"waiting for location "</span> << loc << <span class="Constant">" to reset"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L99" class="LineNr"> 99 </span> Current_routine<span class="Delimiter">-></span>state = WAITING<span class="Delimiter">;</span> -<span id="L100" class="LineNr">100 </span> Current_routine<span class="Delimiter">-></span>waiting_on_location = loc<span class="Delimiter">;</span> +<span id="L99" class="LineNr"> 99 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>state = WAITING<span class="Delimiter">;</span> +<span id="L100" class="LineNr">100 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>waiting_on_location = loc<span class="Delimiter">;</span> <span id="L101" class="LineNr">101 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L102" class="LineNr">102 </span><span class="Delimiter">}</span> <span id="L103" class="LineNr">103 </span> @@ -169,37 +172,37 @@ if ('onhashchange' in window) { <span id="L105" class="LineNr">105 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L106" class="LineNr">106 </span>RESET<span class="Delimiter">,</span> <span id="L107" class="LineNr">107 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L108" class="LineNr">108 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"reset"</span><span class="Delimiter">,</span> RESET<span class="Delimiter">);</span> +<span id="L108" class="LineNr">108 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"reset"</span><span class="Delimiter">,</span> RESET<span class="Delimiter">);</span> <span id="L109" class="LineNr">109 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L110" class="LineNr">110 </span><span class="Normal">case</span> RESET: <span class="Delimiter">{</span> <span id="L111" class="LineNr">111 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L112" class="LineNr">112 </span> <a href='003trace.cc.html#L196'>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">"'reset' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L112" class="LineNr">112 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'reset' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L113" class="LineNr">113 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L114" class="LineNr">114 </span> <span class="Delimiter">}</span> <span id="L115" class="LineNr">115 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_location<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="L116" class="LineNr">116 </span> <a href='003trace.cc.html#L196'>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">"'reset' requires a location ingredient, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L116" class="LineNr">116 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'reset' requires a location ingredient, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L117" class="LineNr">117 </span> <span class="Delimiter">}</span> <span id="L118" class="LineNr">118 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L119" class="LineNr">119 </span><span class="Delimiter">}</span> <span id="L120" class="LineNr">120 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L121" class="LineNr">121 </span><span class="Normal">case</span> RESET: <span class="Delimiter">{</span> <span id="L122" class="LineNr">122 </span> <span class="Normal">int</span> loc = <span class="Normal">static_cast</span><<span class="Normal">int</span>><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="L123" class="LineNr">123 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L124" class="LineNr">124 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"reset: *"</span> << loc << <span class="Constant">" = "</span> << <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L123" class="LineNr">123 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> loc<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L124" class="LineNr">124 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"reset: *"</span> << loc << <span class="Constant">" = "</span> << <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> loc<span class="Delimiter">)</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L125" class="LineNr">125 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L126" class="LineNr">126 </span><span class="Delimiter">}</span> <span id="L127" class="LineNr">127 </span> <span id="L128" class="LineNr">128 </span><span class="Comment">//: scheduler tweak to get routines out of that state</span> <span id="L129" class="LineNr">129 </span> <span id="L130" class="LineNr">130 </span><span class="Delimiter">:(before "End Scheduler State Transitions")</span> -<span id="L131" class="LineNr">131 </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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L132" class="LineNr">132 </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 != WAITING<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L133" class="LineNr">133 </span> <span class="Normal">int</span> loc = Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>waiting_on_location<span class="Delimiter">;</span> -<span id="L134" class="LineNr">134 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>loc && <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L135" class="LineNr">135 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"schedule"</span><span class="Delimiter">)</span> << <span class="Constant">"waking up routine "</span> << Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>id << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L136" class="LineNr">136 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> loc<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L137" class="LineNr">137 </span> Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state = <a href='073scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">;</span> -<span id="L138" class="LineNr">138 </span> Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>waiting_on_location = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L131" class="LineNr">131 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L132" class="LineNr">132 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state != WAITING<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L133" class="LineNr">133 </span> <span class="Normal">int</span> loc = <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>waiting_on_location<span class="Delimiter">;</span> +<span id="L134" class="LineNr">134 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>loc && <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> loc<span class="Delimiter">)</span> == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L135" class="LineNr">135 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"schedule"</span><span class="Delimiter">)</span> << <span class="Constant">"waking up routine "</span> << <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>id << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L136" class="LineNr">136 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> loc<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L137" class="LineNr">137 </span> <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state = <a href='073scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">;</span> +<span id="L138" class="LineNr">138 </span> <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>waiting_on_location = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L139" class="LineNr">139 </span> <span class="Delimiter">}</span> <span id="L140" class="LineNr">140 </span><span class="Delimiter">}</span> <span id="L141" class="LineNr">141 </span> @@ -218,36 +221,36 @@ if ('onhashchange' in window) { <span id="L154" class="LineNr">154 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L155" class="LineNr">155 </span>GET_LOCATION<span class="Delimiter">,</span> <span id="L156" class="LineNr">156 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L157" class="LineNr">157 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"get-location"</span><span class="Delimiter">,</span> GET_LOCATION<span class="Delimiter">);</span> +<span id="L157" class="LineNr">157 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"get-location"</span><span class="Delimiter">,</span> GET_LOCATION<span class="Delimiter">);</span> <span id="L158" class="LineNr">158 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L159" class="LineNr">159 </span><span class="Normal">case</span> GET_LOCATION: <span class="Delimiter">{</span> <span id="L160" class="LineNr">160 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L161" class="LineNr">161 </span> <a href='003trace.cc.html#L196'>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">"'get-location' expects exactly 2 ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L161" class="LineNr">161 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'get-location' expects exactly 2 ingredients in '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L162" class="LineNr">162 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L163" class="LineNr">163 </span> <span class="Delimiter">}</span> <span id="L164" class="LineNr">164 </span> reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> base = 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 id="L165" class="LineNr">165 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!canonize_type<span class="Delimiter">(</span>base<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L166" class="LineNr">166 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!base<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L167" class="LineNr">167 </span> <a href='003trace.cc.html#L196'>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 'get-location' should be a container, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L167" class="LineNr">167 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'get-location' should be a container, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L168" class="LineNr">168 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L169" class="LineNr">169 </span> <span class="Delimiter">}</span> <span id="L170" class="LineNr">170 </span> <span class="Normal">const</span> type_tree* base_root_type = base<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom ? base<span class="Delimiter">.</span>type : base<span class="Delimiter">.</span>type<span class="Delimiter">-></span>left<span class="Delimiter">;</span> -<span id="L171" class="LineNr">171 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!base_root_type<span class="Delimiter">-></span>atom || base_root_type<span class="Delimiter">-></span>value == <span class="Constant">0</span> || !contains_key<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_root_type<span class="Delimiter">-></span>value<span class="Delimiter">)</span> || get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_root_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>kind != <a href='010vm.cc.html#L180'>CONTAINER</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L172" class="LineNr">172 </span> <a href='003trace.cc.html#L196'>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 'get-location' should be a container, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L171" class="LineNr">171 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!base_root_type<span class="Delimiter">-></span>atom || base_root_type<span class="Delimiter">-></span>value == <span class="Constant">0</span> || !contains_key<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_root_type<span class="Delimiter">-></span>value<span class="Delimiter">)</span> || get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_root_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>kind != <a href='010vm.cc.html#L180'>CONTAINER</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L172" class="LineNr">172 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'get-location' should be a container, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L173" class="LineNr">173 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L174" class="LineNr">174 </span> <span class="Delimiter">}</span> <span id="L175" class="LineNr">175 </span> <a href='010vm.cc.html#L125'>type_ordinal</a> base_type = base<span class="Delimiter">.</span>type<span class="Delimiter">-></span>value<span class="Delimiter">;</span> <span id="L176" class="LineNr">176 </span> <span class="Normal">const</span> reagent& offset = 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 id="L177" class="LineNr">177 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<span class="Delimiter">(</span>offset<span class="Delimiter">)</span> || !is_mu_scalar<span class="Delimiter">(</span>offset<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L178" class="LineNr">178 </span> <a href='003trace.cc.html#L196'>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 'get-location' should have type 'offset', 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L178" class="LineNr">178 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second ingredient of 'get-location' should have type 'offset', 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L179" class="LineNr">179 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L180" class="LineNr">180 </span> <span class="Delimiter">}</span> <span id="L181" class="LineNr">181 </span> <span class="Normal">int</span> offset_value = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L182" class="LineNr">182 </span> <span class="Comment">//: later layers will permit non-integer offsets</span> <span id="L183" class="LineNr">183 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_integer<span class="Delimiter">(</span>offset<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L184" class="LineNr">184 </span> offset_value = to_integer<span class="Delimiter">(</span>offset<span class="Delimiter">.</span>name<span class="Delimiter">);</span> -<span id="L185" class="LineNr">185 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset_value < <span class="Constant">0</span> || offset_value >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L186" class="LineNr">186 </span> <a href='003trace.cc.html#L196'>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">"invalid offset "</span> << offset_value << <span class="Constant">" for '"</span> << get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">).</span>name << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L185" class="LineNr">185 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset_value < <span class="Constant">0</span> || offset_value >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L186" class="LineNr">186 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"invalid offset "</span> << offset_value << <span class="Constant">" for '"</span> << get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">).</span>name << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L187" class="LineNr">187 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L188" class="LineNr">188 </span> <span class="Delimiter">}</span> <span id="L189" class="LineNr">189 </span> <span class="Delimiter">}</span> @@ -256,7 +259,7 @@ if ('onhashchange' in window) { <span id="L192" class="LineNr">192 </span> <span class="Delimiter">}</span> <span id="L193" class="LineNr">193 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L194" class="LineNr">194 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_location<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="Delimiter">{</span> -<span id="L195" class="LineNr">195 </span> <a href='003trace.cc.html#L196'>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">"'get-location "</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">", "</span> << offset<span class="Delimiter">.</span>original_string << <span class="Constant">"' should write to type location but '"</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>name << <span class="Constant">"' has type '"</span> << names_to_string_without_quotes<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>type<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L195" class="LineNr">195 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'get-location "</span> << base<span class="Delimiter">.</span>original_string << <span class="Constant">", "</span> << offset<span class="Delimiter">.</span>original_string << <span class="Constant">"' should write to type location but '"</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>name << <span class="Constant">"' has type '"</span> << names_to_string_without_quotes<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>type<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L196" class="LineNr">196 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L197" class="LineNr">197 </span> <span class="Delimiter">}</span> <span id="L198" class="LineNr">198 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -267,12 +270,12 @@ if ('onhashchange' in window) { <span id="L203" class="LineNr">203 </span> <a href='035lookup.cc.html#L66'>canonize</a><span class="Delimiter">(</span>base<span class="Delimiter">);</span> <span id="L204" class="LineNr">204 </span> <span class="Normal">int</span> base_address = base<span class="Delimiter">.</span>value<span class="Delimiter">;</span> <span id="L205" class="LineNr">205 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base_address == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L206" class="LineNr">206 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L206" class="LineNr">206 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to access location 0 in '"</span> << to_original_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L207" class="LineNr">207 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L208" class="LineNr">208 </span> <span class="Delimiter">}</span> <span id="L209" class="LineNr">209 </span> <span class="Normal">const</span> type_tree* base_type = get_base_type<span class="Delimiter">(</span>base<span class="Delimiter">.</span>type<span class="Delimiter">);</span> <span id="L210" class="LineNr">210 </span> <span class="Normal">int</span> offset = 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="L211" class="LineNr">211 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset < <span class="Constant">0</span> || offset >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// copied from Check above</span> +<span id="L211" class="LineNr">211 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>offset < <span class="Constant">0</span> || offset >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Type</span><span class="Delimiter">,</span> base_type<span class="Delimiter">-></span>value<span class="Delimiter">).</span>elements<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// copied from Check above</span> <span id="L212" class="LineNr">212 </span> <span class="Normal">int</span> result = base_address<span class="Delimiter">;</span> <span id="L213" class="LineNr">213 </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 < offset<span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> <span id="L214" class="LineNr">214 </span> result += size_of<span class="Delimiter">(</span><a href='030container.cc.html#L212'>element_type</a><span class="Delimiter">(</span>base<span class="Delimiter">.</span>type<span class="Delimiter">,</span> i<span class="Delimiter">));</span> @@ -287,7 +290,7 @@ if ('onhashchange' in window) { <span id="L223" class="LineNr">223 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!canonize_type<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L224" class="LineNr">224 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L225" class="LineNr">225 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<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="L226" class="LineNr">226 </span> <span class="Identifier">return</span> x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"location"</span><span class="Delimiter">);</span> +<span id="L226" class="LineNr">226 </span> <span class="Identifier">return</span> x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"location"</span><span class="Delimiter">);</span> <span id="L227" class="LineNr">227 </span><span class="Delimiter">}</span> <span id="L228" class="LineNr">228 </span> <span id="L229" class="LineNr">229 </span><span class="Delimiter">:(scenario get_location_out_of_bounds)</span> @@ -381,27 +384,27 @@ if ('onhashchange' in window) { <span id="L317" class="LineNr">317 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L318" class="LineNr">318 </span>WAIT_FOR_ROUTINE<span class="Delimiter">,</span> <span id="L319" class="LineNr">319 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L320" class="LineNr">320 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"wait-for-routine"</span><span class="Delimiter">,</span> WAIT_FOR_ROUTINE<span class="Delimiter">);</span> +<span id="L320" class="LineNr">320 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"wait-for-routine"</span><span class="Delimiter">,</span> WAIT_FOR_ROUTINE<span class="Delimiter">);</span> <span id="L321" class="LineNr">321 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L322" class="LineNr">322 </span><span class="Normal">case</span> WAIT_FOR_ROUTINE: <span class="Delimiter">{</span> <span id="L323" class="LineNr">323 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L324" class="LineNr">324 </span> <a href='003trace.cc.html#L196'>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">"'wait-for-routine' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L324" class="LineNr">324 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'wait-for-routine' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L325" class="LineNr">325 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L326" class="LineNr">326 </span> <span class="Delimiter">}</span> <span id="L327" class="LineNr">327 </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="L328" class="LineNr">328 </span> <a href='003trace.cc.html#L196'>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 'wait-for-routine' 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L328" class="LineNr">328 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'wait-for-routine' 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L329" class="LineNr">329 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L330" class="LineNr">330 </span> <span class="Delimiter">}</span> <span id="L331" class="LineNr">331 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L332" class="LineNr">332 </span><span class="Delimiter">}</span> <span id="L333" class="LineNr">333 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L334" class="LineNr">334 </span><span class="Normal">case</span> WAIT_FOR_ROUTINE: <span class="Delimiter">{</span> -<span id="L335" class="LineNr">335 </span> <span class="Normal">if</span> <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> == Current_routine<span class="Delimiter">-></span>id<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L336" class="LineNr">336 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"routine can't wait for itself! '"</span> << to_original_string<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L335" class="LineNr">335 </span> <span class="Normal">if</span> <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 class="Special">Current_routine</span><span class="Delimiter">-></span>id<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L336" class="LineNr">336 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"routine can't wait for itself! '"</span> << to_original_string<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L337" class="LineNr">337 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L338" class="LineNr">338 </span> <span class="Delimiter">}</span> -<span id="L339" class="LineNr">339 </span> Current_routine<span class="Delimiter">-></span>state = WAITING<span class="Delimiter">;</span> -<span id="L340" class="LineNr">340 </span> Current_routine<span class="Delimiter">-></span>waiting_on_routine = 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="L339" class="LineNr">339 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>state = WAITING<span class="Delimiter">;</span> +<span id="L340" class="LineNr">340 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>waiting_on_routine = 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="L341" class="LineNr">341 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"waiting for routine "</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> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L342" class="LineNr">342 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L343" class="LineNr">343 </span><span class="Delimiter">}</span> @@ -410,14 +413,14 @@ if ('onhashchange' in window) { <span id="L346" class="LineNr">346 </span><span class="Comment">// Wake up any routines waiting for other routines to complete.</span> <span id="L347" class="LineNr">347 </span><span class="Comment">// Important: this must come after the scheduler loop above giving routines</span> <span id="L348" class="LineNr">348 </span><span class="Comment">// waiting for locations to change a chance to wake up.</span> -<span id="L349" class="LineNr">349 </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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L350" class="LineNr">350 </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 != WAITING<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L351" class="LineNr">351 </span> routine* waiter = Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L349" class="LineNr">349 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L350" class="LineNr">350 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state != WAITING<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L351" class="LineNr">351 </span> routine* waiter = <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L352" class="LineNr">352 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!waiter<span class="Delimiter">-></span>waiting_on_routine<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L353" class="LineNr">353 </span> <span class="Normal">int</span> id = waiter<span class="Delimiter">-></span>waiting_on_routine<span class="Delimiter">;</span> <span id="L354" class="LineNr">354 </span> assert<span class="Delimiter">(</span>id != waiter<span class="Delimiter">-></span>id<span class="Delimiter">);</span> <span class="Comment">// routine can't wait on itself</span> -<span id="L355" class="LineNr">355 </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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++j<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L356" class="LineNr">356 </span> <span class="Normal">const</span> routine* waitee = Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">);</span> +<span id="L355" class="LineNr">355 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++j<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L356" class="LineNr">356 </span> <span class="Normal">const</span> routine* waitee = <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">);</span> <span id="L357" class="LineNr">357 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>waitee<span class="Delimiter">-></span>id == id && waitee<span class="Delimiter">-></span>state != <a href='073scheduler.cc.html#L41'>RUNNING</a> && waitee<span class="Delimiter">-></span>state != WAITING<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L358" class="LineNr">358 </span> <span class="Comment">// routine is COMPLETED or DISCONTINUED</span> <span id="L359" class="LineNr">359 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"schedule"</span><span class="Delimiter">)</span> << <span class="Constant">"waking up routine "</span> << waiter<span class="Delimiter">-></span>id << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> @@ -432,7 +435,7 @@ if ('onhashchange' in window) { <span id="L368" class="LineNr">368 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L369" class="LineNr">369 </span>SWITCH<span class="Delimiter">,</span> <span id="L370" class="LineNr">370 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L371" class="LineNr">371 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"switch"</span><span class="Delimiter">,</span> SWITCH<span class="Delimiter">);</span> +<span id="L371" class="LineNr">371 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"switch"</span><span class="Delimiter">,</span> SWITCH<span class="Delimiter">);</span> <span id="L372" class="LineNr">372 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L373" class="LineNr">373 </span><span class="Normal">case</span> SWITCH: <span class="Delimiter">{</span> <span id="L374" class="LineNr">374 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -480,36 +483,36 @@ if ('onhashchange' in window) { <span id="L416" class="LineNr">416 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L417" class="LineNr">417 </span>CURRENT_ROUTINE_IS_BLOCKED<span class="Delimiter">,</span> <span id="L418" class="LineNr">418 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L419" class="LineNr">419 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"current-routine-is-blocked"</span><span class="Delimiter">,</span> CURRENT_ROUTINE_IS_BLOCKED<span class="Delimiter">);</span> +<span id="L419" class="LineNr">419 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"current-routine-is-blocked"</span><span class="Delimiter">,</span> CURRENT_ROUTINE_IS_BLOCKED<span class="Delimiter">);</span> <span id="L420" class="LineNr">420 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L421" class="LineNr">421 </span><span class="Normal">case</span> CURRENT_ROUTINE_IS_BLOCKED: <span class="Delimiter">{</span> <span id="L422" class="LineNr">422 </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="L423" class="LineNr">423 </span> <a href='003trace.cc.html#L196'>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">"'current-routine-is-blocked' should have no ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L423" class="LineNr">423 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'current-routine-is-blocked' should have no ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L424" class="LineNr">424 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L425" class="LineNr">425 </span> <span class="Delimiter">}</span> <span id="L426" class="LineNr">426 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L427" class="LineNr">427 </span><span class="Delimiter">}</span> <span id="L428" class="LineNr">428 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L429" class="LineNr">429 </span><span class="Normal">case</span> CURRENT_ROUTINE_IS_BLOCKED: <span class="Delimiter">{</span> -<span id="L430" class="LineNr">430 </span> Current_routine<span class="Delimiter">-></span>blocked =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L430" class="LineNr">430 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>blocked =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L431" class="LineNr">431 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L432" class="LineNr">432 </span><span class="Delimiter">}</span> <span id="L433" class="LineNr">433 </span> <span id="L434" class="LineNr">434 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L435" class="LineNr">435 </span>CURRENT_ROUTINE_IS_UNBLOCKED<span class="Delimiter">,</span> <span id="L436" class="LineNr">436 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L437" class="LineNr">437 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"current-routine-is-unblocked"</span><span class="Delimiter">,</span> CURRENT_ROUTINE_IS_UNBLOCKED<span class="Delimiter">);</span> +<span id="L437" class="LineNr">437 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"current-routine-is-unblocked"</span><span class="Delimiter">,</span> CURRENT_ROUTINE_IS_UNBLOCKED<span class="Delimiter">);</span> <span id="L438" class="LineNr">438 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L439" class="LineNr">439 </span><span class="Normal">case</span> CURRENT_ROUTINE_IS_UNBLOCKED: <span class="Delimiter">{</span> <span id="L440" class="LineNr">440 </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="L441" class="LineNr">441 </span> <a href='003trace.cc.html#L196'>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">"'current-routine-is-unblocked' should have no ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L441" class="LineNr">441 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'current-routine-is-unblocked' should have no ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L442" class="LineNr">442 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L443" class="LineNr">443 </span> <span class="Delimiter">}</span> <span id="L444" class="LineNr">444 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L445" class="LineNr">445 </span><span class="Delimiter">}</span> <span id="L446" class="LineNr">446 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L447" class="LineNr">447 </span><span class="Normal">case</span> CURRENT_ROUTINE_IS_UNBLOCKED: <span class="Delimiter">{</span> -<span id="L448" class="LineNr">448 </span> Current_routine<span class="Delimiter">-></span>blocked =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L448" class="LineNr">448 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>blocked =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L449" class="LineNr">449 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L450" class="LineNr">450 </span><span class="Delimiter">}</span> <span id="L451" class="LineNr">451 </span> @@ -543,41 +546,41 @@ if ('onhashchange' in window) { <span id="L479" class="LineNr">479 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L480" class="LineNr">480 </span>WAIT_FOR_ROUTINE_TO_BLOCK<span class="Delimiter">,</span> <span id="L481" class="LineNr">481 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L482" class="LineNr">482 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"wait-for-routine-to-block"</span><span class="Delimiter">,</span> WAIT_FOR_ROUTINE_TO_BLOCK<span class="Delimiter">);</span> +<span id="L482" class="LineNr">482 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"wait-for-routine-to-block"</span><span class="Delimiter">,</span> WAIT_FOR_ROUTINE_TO_BLOCK<span class="Delimiter">);</span> <span id="L483" class="LineNr">483 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L484" class="LineNr">484 </span><span class="Normal">case</span> WAIT_FOR_ROUTINE_TO_BLOCK: <span class="Delimiter">{</span> <span id="L485" class="LineNr">485 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L486" class="LineNr">486 </span> <a href='003trace.cc.html#L196'>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">"'wait-for-routine-to-block' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L486" class="LineNr">486 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'wait-for-routine-to-block' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L487" class="LineNr">487 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L488" class="LineNr">488 </span> <span class="Delimiter">}</span> <span id="L489" class="LineNr">489 </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="L490" class="LineNr">490 </span> <a href='003trace.cc.html#L196'>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 'wait-for-routine-to-block' 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L490" class="LineNr">490 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'wait-for-routine-to-block' 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L491" class="LineNr">491 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L492" class="LineNr">492 </span> <span class="Delimiter">}</span> <span id="L493" class="LineNr">493 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L494" class="LineNr">494 </span><span class="Delimiter">}</span> <span id="L495" class="LineNr">495 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L496" class="LineNr">496 </span><span class="Normal">case</span> WAIT_FOR_ROUTINE_TO_BLOCK: <span class="Delimiter">{</span> -<span id="L497" class="LineNr">497 </span> <span class="Normal">if</span> <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> == Current_routine<span class="Delimiter">-></span>id<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L498" class="LineNr">498 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"routine can't wait for itself! '"</span> << to_original_string<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L497" class="LineNr">497 </span> <span class="Normal">if</span> <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 class="Special">Current_routine</span><span class="Delimiter">-></span>id<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L498" class="LineNr">498 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"routine can't wait for itself! '"</span> << to_original_string<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << end<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> Current_routine<span class="Delimiter">-></span>state = WAITING<span class="Delimiter">;</span> -<span id="L502" class="LineNr">502 </span> Current_routine<span class="Delimiter">-></span>waiting_on_routine_to_block = 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="L501" class="LineNr">501 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>state = WAITING<span class="Delimiter">;</span> +<span id="L502" class="LineNr">502 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>waiting_on_routine_to_block = 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="L503" class="LineNr">503 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9998</span><span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"waiting for routine "</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 class="Constant">" to block"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L504" class="LineNr">504 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L505" class="LineNr">505 </span><span class="Delimiter">}</span> <span id="L506" class="LineNr">506 </span> <span id="L507" class="LineNr">507 </span><span class="Delimiter">:(before "End Scheduler State Transitions")</span> <span id="L508" class="LineNr">508 </span><span class="Comment">// Wake up any routines waiting for other routines to stop running.</span> -<span id="L509" class="LineNr">509 </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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L510" class="LineNr">510 </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 != WAITING<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L511" class="LineNr">511 </span> routine* waiter = Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L509" class="LineNr">509 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L510" class="LineNr">510 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state != WAITING<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L511" class="LineNr">511 </span> routine* waiter = <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L512" class="LineNr">512 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!waiter<span class="Delimiter">-></span>waiting_on_routine_to_block<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L513" class="LineNr">513 </span> <span class="Normal">int</span> id = waiter<span class="Delimiter">-></span>waiting_on_routine_to_block<span class="Delimiter">;</span> <span id="L514" class="LineNr">514 </span> assert<span class="Delimiter">(</span>id != waiter<span class="Delimiter">-></span>id<span class="Delimiter">);</span> <span class="Comment">// routine can't wait on itself</span> -<span id="L515" class="LineNr">515 </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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++j<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L516" class="LineNr">516 </span> <span class="Normal">const</span> routine* waitee = Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">);</span> +<span id="L515" class="LineNr">515 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++j<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L516" class="LineNr">516 </span> <span class="Normal">const</span> routine* waitee = <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">);</span> <span id="L517" class="LineNr">517 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>waitee<span class="Delimiter">-></span>id != id<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L518" class="LineNr">518 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>waitee<span class="Delimiter">-></span>state != <a href='073scheduler.cc.html#L41'>RUNNING</a> || waitee<span class="Delimiter">-></span>blocked<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L519" class="LineNr">519 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"schedule"</span><span class="Delimiter">)</span> << <span class="Constant">"waking up routine "</span> << waiter<span class="Delimiter">-></span>id << <span class="Constant">" because routine "</span> << waitee<span class="Delimiter">-></span>id << <span class="Constant">" is blocked"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> @@ -592,15 +595,15 @@ if ('onhashchange' in window) { <span id="L528" class="LineNr">528 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L529" class="LineNr">529 </span>RESTART<span class="Delimiter">,</span> <span id="L530" class="LineNr">530 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L531" class="LineNr">531 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"restart"</span><span class="Delimiter">,</span> RESTART<span class="Delimiter">);</span> +<span id="L531" class="LineNr">531 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"restart"</span><span class="Delimiter">,</span> RESTART<span class="Delimiter">);</span> <span id="L532" class="LineNr">532 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L533" class="LineNr">533 </span><span class="Normal">case</span> RESTART: <span class="Delimiter">{</span> <span id="L534" class="LineNr">534 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L535" class="LineNr">535 </span> <a href='003trace.cc.html#L196'>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">"'restart' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L535" class="LineNr">535 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'restart' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L536" class="LineNr">536 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L537" class="LineNr">537 </span> <span class="Delimiter">}</span> <span id="L538" class="LineNr">538 </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="L539" class="LineNr">539 </span> <a href='003trace.cc.html#L196'>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 'restart' 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L539" class="LineNr">539 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'restart' 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L540" class="LineNr">540 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L541" class="LineNr">541 </span> <span class="Delimiter">}</span> <span id="L542" class="LineNr">542 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -608,11 +611,11 @@ if ('onhashchange' in window) { <span id="L544" class="LineNr">544 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L545" class="LineNr">545 </span><span class="Normal">case</span> RESTART: <span class="Delimiter">{</span> <span id="L546" class="LineNr">546 </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="L547" class="LineNr">547 </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#L141'>SIZE</a><span class="Delimiter">(</span>Routines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L548" class="LineNr">548 </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="L549" class="LineNr">549 </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 == WAITING<span class="Delimiter">)</span> -<span id="L550" class="LineNr">550 </span> Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state = <a href='073scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">;</span> -<span id="L551" class="LineNr">551 </span> Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>blocked =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L547" class="LineNr">547 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L548" class="LineNr">548 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><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="L549" class="LineNr">549 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state == WAITING<span class="Delimiter">)</span> +<span id="L550" class="LineNr">550 </span> <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>state = <a href='073scheduler.cc.html#L41'>RUNNING</a><span class="Delimiter">;</span> +<span id="L551" class="LineNr">551 </span> <span class="Special">Routines</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)-></span>blocked =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L552" class="LineNr">552 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L553" class="LineNr">553 </span> <span class="Delimiter">}</span> <span id="L554" class="LineNr">554 </span> <span class="Delimiter">}</span> diff --git a/html/075channel.mu.html b/html/075channel.mu.html index 62f342b5..497c51f3 100644 --- a/html/075channel.mu.html +++ b/html/075channel.mu.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } -.muControl { color: #c0a020; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } --> </style> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/075channel.mu'>https://github.com/akkartik/mu/blob/master/075channel.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Mu synchronizes between routines using channels rather than locks, like</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># Erlang and Go.</span> diff --git a/html/076continuation.cc.html b/html/076continuation.cc.html index fb718068..e8bf5be6 100644 --- a/html/076continuation.cc.html +++ b/html/076continuation.cc.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .traceAbsent { color: #c00000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } .traceContains { color: #008000; } --> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/076continuation.cc'>https://github.com/akkartik/mu/blob/master/076continuation.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Continuations are a powerful primitive for constructing advanced kinds of</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: control *policies* like back-tracking.</span> @@ -115,8 +118,8 @@ if ('onhashchange' in window) { <span id="L52" class="LineNr"> 52 </span><span class="Comment">//: There should still be no way to lookup addresses that aren't allocated.</span> <span id="L53" class="LineNr"> 53 </span> <span id="L54" class="LineNr"> 54 </span><span class="Delimiter">:(before "End Mu Types Initialization")</span> -<span id="L55" class="LineNr"> 55 </span><a href='010vm.cc.html#L125'>type_ordinal</a> continuation = Type_ordinal[<span class="Constant">"continuation"</span>] = Next_type_ordinal++<span class="Delimiter">;</span> -<span id="L56" class="LineNr"> 56 </span>Type[continuation]<span class="Delimiter">.</span>name = <span class="Constant">"continuation"</span><span class="Delimiter">;</span> +<span id="L55" class="LineNr"> 55 </span><a href='010vm.cc.html#L125'>type_ordinal</a> continuation = <span class="Special">Type_ordinal</span>[<span class="Constant">"continuation"</span>] = <span class="Special">Next_type_ordinal</span>++<span class="Delimiter">;</span> +<span id="L56" class="LineNr"> 56 </span><span class="Special">Type</span>[continuation]<span class="Delimiter">.</span>name = <span class="Constant">"continuation"</span><span class="Delimiter">;</span> <span id="L57" class="LineNr"> 57 </span> <span id="L58" class="LineNr"> 58 </span><span class="Comment">//: A continuation can be called like a recipe.</span> <span id="L59" class="LineNr"> 59 </span><span class="Delimiter">:(before "End <a href='072recipe.cc.html#L335'>is_mu_recipe</a> Atom Cases(r)")</span> @@ -183,11 +186,11 @@ if ('onhashchange' in window) { <span id="L120" class="LineNr">120 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L121" class="LineNr">121 </span>CALL_WITH_CONTINUATION_MARK<span class="Delimiter">,</span> <span id="L122" class="LineNr">122 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L123" class="LineNr">123 </span>Recipe_ordinal[<span class="Constant">"call-with-continuation-mark"</span>] = CALL_WITH_CONTINUATION_MARK<span class="Delimiter">;</span> +<span id="L123" class="LineNr">123 </span><span class="Special">Recipe_ordinal</span>[<span class="Constant">"call-with-continuation-mark"</span>] = CALL_WITH_CONTINUATION_MARK<span class="Delimiter">;</span> <span id="L124" class="LineNr">124 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L125" class="LineNr">125 </span><span class="Normal">case</span> CALL_WITH_CONTINUATION_MARK: <span class="Delimiter">{</span> <span id="L126" class="LineNr">126 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L127" class="LineNr">127 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' requires at least two ingredients: a mark number and a <a href='010vm.cc.html#L19'>recipe</a> to call</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L127" class="LineNr">127 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' requires at least two ingredients: a mark number and a <a href='010vm.cc.html#L19'>recipe</a> to call\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L128" class="LineNr">128 </span> <span class="Delimiter">}</span> <span id="L129" class="LineNr">129 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L130" class="LineNr">130 </span><span class="Delimiter">}</span> @@ -195,14 +198,14 @@ if ('onhashchange' in window) { <span id="L132" class="LineNr">132 </span><span class="Normal">case</span> CALL_WITH_CONTINUATION_MARK: <span class="Delimiter">{</span> <span id="L133" class="LineNr">133 </span> <span class="Comment">// like call, but mark the current call as a 'base of continuation' call</span> <span id="L134" class="LineNr">134 </span> <span class="Comment">// before pushing the next one on it</span> -<span id="L135" class="LineNr">135 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L136" class="LineNr">136 </span> ++Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> -<span id="L137" class="LineNr">137 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"delimited continuation; incrementing callstack depth to "</span> << Trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L138" class="LineNr">138 </span> assert<span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> +<span id="L135" class="LineNr">135 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L136" class="LineNr">136 </span> ++<span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> +<span id="L137" class="LineNr">137 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"delimited continuation; incrementing callstack depth to "</span> << <span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L138" class="LineNr">138 </span> assert<span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> <span id="L139" class="LineNr">139 </span> <span class="Delimiter">}</span> <span id="L140" class="LineNr">140 </span> <a href='010vm.cc.html#L33'>instruction</a><span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> caller_instruction = <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">();</span> -<span id="L141" class="LineNr">141 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>continuation_mark_tag = <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>value<span class="Delimiter">;</span> -<span id="L142" class="LineNr">142 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>call<span class="Delimiter">(</span>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="L141" class="LineNr">141 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>continuation_mark_tag = <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>value<span class="Delimiter">;</span> +<span id="L142" class="LineNr">142 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>call<span class="Delimiter">(</span>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="L143" class="LineNr">143 </span> <span class="Comment">// drop the mark</span> <span id="L144" class="LineNr">144 </span> caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">());</span> <span id="L145" class="LineNr">145 </span> ingredients<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">());</span> @@ -242,20 +245,20 @@ if ('onhashchange' in window) { <span id="L179" class="LineNr">179 </span> delimited_continuation<span class="Delimiter">(</span>call_stack::iterator begin<span class="Delimiter">,</span> call_stack::iterator <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">)</span> :frames<span class="Delimiter">(</span>call_stack<span class="Delimiter">(</span>begin<span class="Delimiter">,</span> <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">)),</span> nrefs<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{}</span> <span id="L180" class="LineNr">180 </span><span class="Delimiter">};</span> <span id="L181" class="LineNr">181 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L182" class="LineNr">182 </span>map<<span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span><span class="Delimiter">,</span> delimited_continuation> Delimited_continuation<span class="Delimiter">;</span> -<span id="L183" class="LineNr">183 </span><span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> Next_delimited_continuation_id = <span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// 0 is null just like an address</span> +<span id="L182" class="LineNr">182 </span>map<<span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span><span class="Delimiter">,</span> delimited_continuation> <span class="Special">Delimited_continuation</span><span class="Delimiter">;</span> +<span id="L183" class="LineNr">183 </span><span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> <span class="Special">Next_delimited_continuation_id</span> = <span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// 0 is null just like an address</span> <span id="L184" class="LineNr">184 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L185" class="LineNr">185 </span>Delimited_continuation<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L186" class="LineNr">186 </span>Next_delimited_continuation_id = <span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L185" class="LineNr">185 </span><span class="Special">Delimited_continuation</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L186" class="LineNr">186 </span><span class="Special">Next_delimited_continuation_id</span> = <span class="Constant">1</span><span class="Delimiter">;</span> <span id="L187" class="LineNr">187 </span> <span id="L188" class="LineNr">188 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L189" class="LineNr">189 </span>RETURN_CONTINUATION_UNTIL_MARK<span class="Delimiter">,</span> <span id="L190" class="LineNr">190 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L191" class="LineNr">191 </span>Recipe_ordinal[<span class="Constant">"return-continuation-until-mark"</span>] = RETURN_CONTINUATION_UNTIL_MARK<span class="Delimiter">;</span> +<span id="L191" class="LineNr">191 </span><span class="Special">Recipe_ordinal</span>[<span class="Constant">"return-continuation-until-mark"</span>] = RETURN_CONTINUATION_UNTIL_MARK<span class="Delimiter">;</span> <span id="L192" class="LineNr">192 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L193" class="LineNr">193 </span><span class="Normal">case</span> RETURN_CONTINUATION_UNTIL_MARK: <span class="Delimiter">{</span> <span id="L194" class="LineNr">194 </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="L195" class="LineNr">195 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' requires at least one ingredient: a mark tag (number)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L195" class="LineNr">195 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"' requires at least one ingredient: a mark tag (number)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L196" class="LineNr">196 </span> <span class="Delimiter">}</span> <span id="L197" class="LineNr">197 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L198" class="LineNr">198 </span><span class="Delimiter">}</span> @@ -264,33 +267,33 @@ if ('onhashchange' in window) { <span id="L201" class="LineNr">201 </span> <span class="Comment">// I don't know how to think about next-ingredient in combination with</span> <span id="L202" class="LineNr">202 </span> <span class="Comment">// continuations, so seems cleaner to just kill it. Functions have to read</span> <span id="L203" class="LineNr">203 </span> <span class="Comment">// their inputs before ever returning a continuation.</span> -<span id="L204" class="LineNr">204 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L205" class="LineNr">205 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>next_ingredient_to_process = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L204" class="LineNr">204 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>ingredient_atoms<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L205" class="LineNr">205 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>front<span class="Delimiter">().</span>next_ingredient_to_process = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L206" class="LineNr">206 </span> <span class="Comment">// copy the current call stack until the most recent marked call</span> <span id="L207" class="LineNr">207 </span> call_stack::iterator find_base_of_continuation<span class="Delimiter">(</span>call_stack&<span class="Delimiter">,</span> <span class="Normal">int</span><span class="Delimiter">);</span> <span class="Comment">// manual prototype containing '::'</span> -<span id="L208" class="LineNr">208 </span> call_stack::iterator base = find_base_of_continuation<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">mark tag</span><span class="Comment">*/</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>value<span class="Delimiter">);</span> -<span id="L209" class="LineNr">209 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base == Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> +<span id="L208" class="LineNr">208 </span> call_stack::iterator base = find_base_of_continuation<span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">mark tag</span><span class="Comment">*/</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>value<span class="Delimiter">);</span> +<span id="L209" class="LineNr">209 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>base == <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L210" class="LineNr">210 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"couldn't find a 'call-with-continuation-mark' to return to with tag "</span> << current_instruction<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="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> -<span id="L211" class="LineNr">211 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"call stack:</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L212" class="LineNr">212 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::iterator p = Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> -<span id="L213" class="LineNr">213 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">" "</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L211" class="LineNr">211 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"call stack:\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L212" class="LineNr">212 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::iterator p = <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> +<span id="L213" class="LineNr">213 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">" "</span> << get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> p<span class="Delimiter">-></span>running_recipe<span class="Delimiter">).</span>name << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L214" class="LineNr">214 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L215" class="LineNr">215 </span> <span class="Delimiter">}</span> -<span id="L216" class="LineNr">216 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"creating continuation "</span> << Next_delimited_continuation_id << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L217" class="LineNr">217 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Delimited_continuation<span class="Delimiter">,</span> Next_delimited_continuation_id<span class="Delimiter">,</span> delimited_continuation<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> base<span class="Delimiter">));</span> -<span id="L218" class="LineNr">218 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>begin<span class="Delimiter">()</span> != base<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L219" class="LineNr">219 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L220" class="LineNr">220 </span> --Trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> -<span id="L221" class="LineNr">221 </span> assert<span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth >= <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L216" class="LineNr">216 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"creating continuation "</span> << <span class="Special">Next_delimited_continuation_id</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L217" class="LineNr">217 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Delimited_continuation</span><span class="Delimiter">,</span> <span class="Special">Next_delimited_continuation_id</span><span class="Delimiter">,</span> delimited_continuation<span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> base<span class="Delimiter">));</span> +<span id="L218" class="LineNr">218 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>begin<span class="Delimiter">()</span> != base<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L219" class="LineNr">219 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L220" class="LineNr">220 </span> --<span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> +<span id="L221" class="LineNr">221 </span> assert<span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth >= <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L222" class="LineNr">222 </span> <span class="Delimiter">}</span> -<span id="L223" class="LineNr">223 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> +<span id="L223" class="LineNr">223 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> <span id="L224" class="LineNr">224 </span> <span class="Delimiter">}</span> <span id="L225" class="LineNr">225 </span> <span class="Comment">// return it as the result of the marked call</span> <span id="L226" class="LineNr">226 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L227" class="LineNr">227 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>Next_delimited_continuation_id<span class="Delimiter">);</span> +<span id="L227" class="LineNr">227 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Special">Next_delimited_continuation_id</span><span class="Delimiter">);</span> <span id="L228" class="LineNr">228 </span> <span class="Comment">// return any other ingredients passed in</span> <span id="L229" class="LineNr">229 </span> copy<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">skip mark tag</span><span class="Comment">*/</span>++ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> ingredients<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">(),</span> inserter<span class="Delimiter">(</span>products<span class="Delimiter">,</span> products<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">()));</span> -<span id="L230" class="LineNr">230 </span> ++Next_delimited_continuation_id<span class="Delimiter">;</span> +<span id="L230" class="LineNr">230 </span> ++<span class="Special">Next_delimited_continuation_id</span><span class="Delimiter">;</span> <span id="L231" class="LineNr">231 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// continue to process rest of marked call</span> <span id="L232" class="LineNr">232 </span><span class="Delimiter">}</span> <span id="L233" class="LineNr">233 </span> @@ -307,15 +310,15 @@ if ('onhashchange' in window) { <span id="L244" class="LineNr">244 </span> <span class="Comment">// copy multiple calls on to current call stack</span> <span id="L245" class="LineNr">245 </span> assert<span class="Delimiter">(</span>scalar<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)));</span> <span id="L246" class="LineNr">246 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"calling continuation "</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> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L247" class="LineNr">247 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Delimited_continuation<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="L247" class="LineNr">247 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Delimited_continuation</span><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="L248" class="LineNr">248 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"no such delimited continuation "</span> << <a href='026call.cc.html#L89'>current_instruction</a><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="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L249" class="LineNr">249 </span> <span class="Normal">const</span> call_stack& new_frames = get<span class="Delimiter">(</span>Delimited_continuation<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>frames<span class="Delimiter">;</span> +<span id="L249" class="LineNr">249 </span> <span class="Normal">const</span> call_stack& new_frames = get<span class="Delimiter">(</span><span class="Special">Delimited_continuation</span><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>frames<span class="Delimiter">;</span> <span id="L250" class="LineNr">250 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>call_stack::const_reverse_iterator p = new_frames<span class="Delimiter">.</span>rbegin<span class="Delimiter">();</span> p != new_frames<span class="Delimiter">.</span>rend<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> -<span id="L251" class="LineNr">251 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>*p<span class="Delimiter">);</span> -<span id="L252" class="LineNr">252 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L253" class="LineNr">253 </span> Trace_stream<span class="Delimiter">-></span>callstack_depth += <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>new_frames<span class="Delimiter">);</span> -<span id="L254" class="LineNr">254 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"calling delimited continuation; growing callstack depth to "</span> << Trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L255" class="LineNr">255 </span> assert<span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> +<span id="L251" class="LineNr">251 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>*p<span class="Delimiter">);</span> +<span id="L252" class="LineNr">252 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L253" class="LineNr">253 </span> <span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth += <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>new_frames<span class="Delimiter">);</span> +<span id="L254" class="LineNr">254 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"calling delimited continuation; growing callstack depth to "</span> << <span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L255" class="LineNr">255 </span> assert<span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> <span id="L256" class="LineNr">256 </span> <span class="Delimiter">}</span> <span id="L257" class="LineNr">257 </span> <span class="Comment">// no call housekeeping; continuations don't support next-ingredient</span> <span id="L258" class="LineNr">258 </span> copy<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">drop continuation</span><span class="Comment">*/</span>++ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> ingredients<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">(),</span> inserter<span class="Delimiter">(</span>products<span class="Delimiter">,</span> products<span class="Delimiter">.</span>begin<span class="Delimiter">()));</span> @@ -387,7 +390,7 @@ if ('onhashchange' in window) { <span id="L324" class="LineNr">324 </span> inst2<span class="Delimiter">.</span>products<span class="Delimiter">.</span>push_back<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 id="L325" class="LineNr">325 </span> <a href='054static_dispatch.cc.html#L173'>resolve_ambiguous_call</a><span class="Delimiter">(</span>r<span class="Delimiter">,</span> index<span class="Delimiter">,</span> inst2<span class="Delimiter">,</span> caller_recipe<span class="Delimiter">);</span> <span id="L326" class="LineNr">326 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">skip mark</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">).</span>name = inst2<span class="Delimiter">.</span>name<span class="Delimiter">;</span> -<span id="L327" class="LineNr">327 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">skip mark</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">).</span><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> inst2<span class="Delimiter">.</span>name<span class="Delimiter">));</span> +<span id="L327" class="LineNr">327 </span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">skip mark</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">).</span><a href='010vm.cc.html#L67'>set_value</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> inst2<span class="Delimiter">.</span>name<span class="Delimiter">));</span> <span id="L328" class="LineNr">328 </span><span class="Delimiter">}</span> <span id="L329" class="LineNr">329 </span> <span id="L330" class="LineNr">330 </span><span class="Delimiter">:(scenario call_shape_shifting_recipe_with_continuation_mark_and_no_outputs)</span> @@ -419,16 +422,16 @@ if ('onhashchange' in window) { <span id="L356" class="LineNr">356 </span><span class="Delimiter">:(code)</span> <span id="L357" class="LineNr">357 </span><span class="Normal">bool</span> is_mu_continuation<span class="Delimiter">(</span>reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> x<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L358" class="LineNr">358 </span> canonize_type<span class="Delimiter">(</span>x<span class="Delimiter">);</span> -<span id="L359" class="LineNr">359 </span> <span class="Identifier">return</span> x<span class="Delimiter">.</span>type && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"continuation"</span><span class="Delimiter">);</span> +<span id="L359" class="LineNr">359 </span> <span class="Identifier">return</span> x<span class="Delimiter">.</span>type && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom && x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>value == get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"continuation"</span><span class="Delimiter">);</span> <span id="L360" class="LineNr">360 </span><span class="Delimiter">}</span> <span id="L361" class="LineNr">361 </span> <span id="L362" class="LineNr">362 </span><span class="Comment">// helper for debugging</span> <span id="L363" class="LineNr">363 </span><span class="Normal">void</span> dump<span class="Delimiter">(</span><span class="Normal">const</span> <span class="Normal">int</span> continuation_id<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L364" class="LineNr">364 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Delimited_continuation<span class="Delimiter">,</span> continuation_id<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L364" class="LineNr">364 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Delimited_continuation</span><span class="Delimiter">,</span> continuation_id<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L365" class="LineNr">365 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"missing delimited continuation: "</span> << continuation_id << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L366" class="LineNr">366 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L367" class="LineNr">367 </span> <span class="Delimiter">}</span> -<span id="L368" class="LineNr">368 </span> delimited_continuation& curr = get<span class="Delimiter">(</span>Delimited_continuation<span class="Delimiter">,</span> continuation_id<span class="Delimiter">);</span> +<span id="L368" class="LineNr">368 </span> delimited_continuation& curr = get<span class="Delimiter">(</span><span class="Special">Delimited_continuation</span><span class="Delimiter">,</span> continuation_id<span class="Delimiter">);</span> <span id="L369" class="LineNr">369 </span> dump<span class="Delimiter">(</span>curr<span class="Delimiter">.</span>frames<span class="Delimiter">);</span> <span id="L370" class="LineNr">370 </span><span class="Delimiter">}</span> </pre> diff --git a/html/080display.cc.html b/html/080display.cc.html index ef5cf2f3..389f8327 100644 --- a/html/080display.cc.html +++ b/html/080display.cc.html @@ -11,18 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Identifier { color: #c0a020; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } --> </style> @@ -57,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/080display.cc'>https://github.com/akkartik/mu/blob/master/080display.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Take raw control of the text-mode display and console, putting it in</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: 'console' mode rather than the usual automatically-scrolling 'typewriter'</span> @@ -65,31 +69,31 @@ if ('onhashchange' in window) { <span id="L5" class="LineNr"> 5 </span><span class="SalientComment">//:: Display management</span> <span id="L6" class="LineNr"> 6 </span> <span id="L7" class="LineNr"> 7 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L8" class="LineNr"> 8 </span><span class="Normal">int</span> Display_row = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L9" class="LineNr"> 9 </span><span class="Normal">int</span> Display_column = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L8" class="LineNr"> 8 </span><span class="Normal">int</span> <span class="Special">Display_row</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L9" class="LineNr"> 9 </span><span class="Normal">int</span> <span class="Special">Display_column</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L10" class="LineNr"> 10 </span> <span id="L11" class="LineNr"> 11 </span><span class="Delimiter">:(before "End Includes")</span> <span id="L12" class="LineNr"> 12 </span><span class="Comment">#define CHECK_SCREEN \</span> <span id="L13" class="LineNr"> 13 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!tb_is_active<span class="Delimiter">())</span> <span class="Delimiter">{</span> \ -<span id="L14" class="LineNr"> 14 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Run_tests<span class="Delimiter">)</span> \ -<span id="L15" class="LineNr"> 15 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to print to real screen in a test!</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> \ +<span id="L14" class="LineNr"> 14 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Run_tests</span><span class="Delimiter">)</span> \ +<span id="L15" class="LineNr"> 15 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to print to real screen in a test!\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> \ <span id="L16" class="LineNr"> 16 </span> <span class="Normal">else</span> \ -<span id="L17" class="LineNr"> 17 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to print to real screen before 'open-console' or after 'close-console'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> \ +<span id="L17" class="LineNr"> 17 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to print to real screen before 'open-console' or after 'close-console'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> \ <span id="L18" class="LineNr"> 18 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> \ <span id="L19" class="LineNr"> 19 </span> <span class="Delimiter">}</span> <span id="L20" class="LineNr"> 20 </span><span class="Comment">#define CHECK_CONSOLE \</span> <span id="L21" class="LineNr"> 21 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!tb_is_active<span class="Delimiter">())</span> <span class="Delimiter">{</span> \ -<span id="L22" class="LineNr"> 22 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Run_tests<span class="Delimiter">)</span> \ -<span id="L23" class="LineNr"> 23 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to read event from real keyboard/mouse in a test!</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> \ +<span id="L22" class="LineNr"> 22 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Run_tests</span><span class="Delimiter">)</span> \ +<span id="L23" class="LineNr"> 23 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to read event from real keyboard/mouse in a test!\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> \ <span id="L24" class="LineNr"> 24 </span> <span class="Normal">else</span> \ -<span id="L25" class="LineNr"> 25 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to read event from real keyboard/mouse before 'open-console' or after 'close-console'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> \ +<span id="L25" class="LineNr"> 25 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"tried to read event from real keyboard/mouse before 'open-console' or after 'close-console'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> \ <span id="L26" class="LineNr"> 26 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> \ <span id="L27" class="LineNr"> 27 </span> <span class="Delimiter">}</span> <span id="L28" class="LineNr"> 28 </span> <span id="L29" class="LineNr"> 29 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L30" class="LineNr"> 30 </span>OPEN_CONSOLE<span class="Delimiter">,</span> <span id="L31" class="LineNr"> 31 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L32" class="LineNr"> 32 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"open-console"</span><span class="Delimiter">,</span> OPEN_CONSOLE<span class="Delimiter">);</span> +<span id="L32" class="LineNr"> 32 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"open-console"</span><span class="Delimiter">,</span> OPEN_CONSOLE<span class="Delimiter">);</span> <span id="L33" class="LineNr"> 33 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L34" class="LineNr"> 34 </span><span class="Normal">case</span> OPEN_CONSOLE: <span class="Delimiter">{</span> <span id="L35" class="LineNr"> 35 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -98,14 +102,14 @@ if ('onhashchange' in window) { <span id="L38" class="LineNr"> 38 </span><span class="Normal">case</span> OPEN_CONSOLE: <span class="Delimiter">{</span> <span id="L39" class="LineNr"> 39 </span> tb_init<span class="Delimiter">();</span> <span id="L40" class="LineNr"> 40 </span> std::setvbuf<span class="Delimiter">(</span><span class="Constant">stdout</span><span class="Delimiter">,</span> <span class="Constant">NULL</span><span class="Delimiter">,</span> <span class="Constant">_IONBF</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span class="Comment">// disable buffering in cout</span> -<span id="L41" class="LineNr"> 41 </span> Display_row = Display_column = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L41" class="LineNr"> 41 </span> <span class="Special">Display_row</span> = <span class="Special">Display_column</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L42" class="LineNr"> 42 </span> <span class="Normal">int</span> width = tb_width<span class="Delimiter">();</span> <span id="L43" class="LineNr"> 43 </span> <span class="Normal">int</span> height = tb_height<span class="Delimiter">();</span> <span id="L44" class="LineNr"> 44 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>width > <span class="Constant">222</span> || height > <span class="Constant">222</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L45" class="LineNr"> 45 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>width > <span class="Constant">222</span><span class="Delimiter">)</span> -<span id="L46" class="LineNr"> 46 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"sorry, Mu doesn't support windows wider than 222 characters in console mode. Please resize your window.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L46" class="LineNr"> 46 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"sorry, Mu doesn't support windows wider than 222 characters in console mode. Please resize your window.\n"</span> << end<span class="Delimiter">();</span> <span id="L47" class="LineNr"> 47 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>height > <span class="Constant">222</span><span class="Delimiter">)</span> -<span id="L48" class="LineNr"> 48 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"sorry, Mu doesn't support windows taller than 222 characters in console mode. Please resize your window.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L48" class="LineNr"> 48 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"sorry, Mu doesn't support windows taller than 222 characters in console mode. Please resize your window.\n"</span> << end<span class="Delimiter">();</span> <span id="L49" class="LineNr"> 49 </span> exit<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L50" class="LineNr"> 50 </span> <span class="Delimiter">}</span> <span id="L51" class="LineNr"> 51 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -114,7 +118,7 @@ if ('onhashchange' in window) { <span id="L54" class="LineNr"> 54 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L55" class="LineNr"> 55 </span>CLOSE_CONSOLE<span class="Delimiter">,</span> <span id="L56" class="LineNr"> 56 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L57" class="LineNr"> 57 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"close-console"</span><span class="Delimiter">,</span> CLOSE_CONSOLE<span class="Delimiter">);</span> +<span id="L57" class="LineNr"> 57 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"close-console"</span><span class="Delimiter">,</span> CLOSE_CONSOLE<span class="Delimiter">);</span> <span id="L58" class="LineNr"> 58 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L59" class="LineNr"> 59 </span><span class="Normal">case</span> CLOSE_CONSOLE: <span class="Delimiter">{</span> <span id="L60" class="LineNr"> 60 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -128,7 +132,7 @@ if ('onhashchange' in window) { <span id="L68" class="LineNr"> 68 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L69" class="LineNr"> 69 </span>CLEAR_DISPLAY<span class="Delimiter">,</span> <span id="L70" class="LineNr"> 70 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L71" class="LineNr"> 71 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"clear-display"</span><span class="Delimiter">,</span> CLEAR_DISPLAY<span class="Delimiter">);</span> +<span id="L71" class="LineNr"> 71 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"clear-display"</span><span class="Delimiter">,</span> CLEAR_DISPLAY<span class="Delimiter">);</span> <span id="L72" class="LineNr"> 72 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L73" class="LineNr"> 73 </span><span class="Normal">case</span> CLEAR_DISPLAY: <span class="Delimiter">{</span> <span id="L74" class="LineNr"> 74 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -137,33 +141,33 @@ if ('onhashchange' in window) { <span id="L77" class="LineNr"> 77 </span><span class="Normal">case</span> CLEAR_DISPLAY: <span class="Delimiter">{</span> <span id="L78" class="LineNr"> 78 </span> <a href='080display.cc.html#L12'>CHECK_SCREEN</a><span class="Delimiter">;</span> <span id="L79" class="LineNr"> 79 </span> tb_clear<span class="Delimiter">();</span> -<span id="L80" class="LineNr"> 80 </span> Display_row = Display_column = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L80" class="LineNr"> 80 </span> <span class="Special">Display_row</span> = <span class="Special">Display_column</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L81" class="LineNr"> 81 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L82" class="LineNr"> 82 </span><span class="Delimiter">}</span> <span id="L83" class="LineNr"> 83 </span> <span id="L84" class="LineNr"> 84 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L85" class="LineNr"> 85 </span>PRINT_CHARACTER_TO_DISPLAY<span class="Delimiter">,</span> <span id="L86" class="LineNr"> 86 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L87" class="LineNr"> 87 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"print-character-to-display"</span><span class="Delimiter">,</span> PRINT_CHARACTER_TO_DISPLAY<span class="Delimiter">);</span> +<span id="L87" class="LineNr"> 87 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"print-character-to-display"</span><span class="Delimiter">,</span> PRINT_CHARACTER_TO_DISPLAY<span class="Delimiter">);</span> <span id="L88" class="LineNr"> 88 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L89" class="LineNr"> 89 </span><span class="Normal">case</span> PRINT_CHARACTER_TO_DISPLAY: <span class="Delimiter">{</span> <span id="L90" class="LineNr"> 90 </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="L91" class="LineNr"> 91 </span> <a href='003trace.cc.html#L196'>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">"'print-character-to-display' requires at least one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L91" class="LineNr"> 91 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'print-character-to-display' requires at least one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L92" class="LineNr"> 92 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L93" class="LineNr"> 93 </span> <span class="Delimiter">}</span> <span id="L94" class="LineNr"> 94 </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="L95" class="LineNr"> 95 </span> <a href='003trace.cc.html#L196'>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 'print-character-to-display' should be a character, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L95" class="LineNr"> 95 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'print-character-to-display' should be a character, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L96" class="LineNr"> 96 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L97" class="LineNr"> 97 </span> <span class="Delimiter">}</span> <span id="L98" class="LineNr"> 98 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L99" class="LineNr"> 99 </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="L100" class="LineNr">100 </span> <a href='003trace.cc.html#L196'>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 'print-character-to-display' should be a foreground color number, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L100" class="LineNr">100 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second ingredient of 'print-character-to-display' should be a foreground color number, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L101" class="LineNr">101 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L102" class="LineNr">102 </span> <span class="Delimiter">}</span> <span id="L103" class="LineNr">103 </span> <span class="Delimiter">}</span> <span id="L104" class="LineNr">104 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L105" class="LineNr">105 </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">2</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L106" class="LineNr">106 </span> <a href='003trace.cc.html#L196'>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">"third ingredient of 'print-character-to-display' should be a background color number, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">2</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#L225'>end</a><span class="Delimiter">();</span> +<span id="L106" class="LineNr">106 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"third ingredient of 'print-character-to-display' should be a background color number, but got '"</span> << inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">).</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L107" class="LineNr">107 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L108" class="LineNr">108 </span> <span class="Delimiter">}</span> <span id="L109" class="LineNr">109 </span> <span class="Delimiter">}</span> @@ -188,19 +192,19 @@ if ('onhashchange' in window) { <span id="L128" class="LineNr">128 </span> tb_print<span class="Delimiter">(</span>c<span class="Delimiter">,</span> color<span class="Delimiter">,</span> bg_color<span class="Delimiter">);</span> <span id="L129" class="LineNr">129 </span> <span class="Comment">// track row and column, mimicking what happens on screen</span> <span id="L130" class="LineNr">130 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L131" class="LineNr">131 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Display_row < height-<span class="Constant">1</span><span class="Delimiter">)</span> ++Display_row<span class="Delimiter">;</span> <span class="Comment">// otherwise we scroll and Display_row remains unchanged</span> +<span id="L131" class="LineNr">131 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Display_row</span> < height-<span class="Constant">1</span><span class="Delimiter">)</span> ++<span class="Special">Display_row</span><span class="Delimiter">;</span> <span class="Comment">// otherwise we scroll and Display_row remains unchanged</span> <span id="L132" class="LineNr">132 </span> <span class="Delimiter">}</span> <span id="L133" class="LineNr">133 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="cSpecial">'\r'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L134" class="LineNr">134 </span> Display_column = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L134" class="LineNr">134 </span> <span class="Special">Display_column</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L135" class="LineNr">135 </span> <span class="Delimiter">}</span> <span id="L136" class="LineNr">136 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="cSpecial">'\b'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L137" class="LineNr">137 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Display_column > <span class="Constant">0</span><span class="Delimiter">)</span> --Display_column<span class="Delimiter">;</span> +<span id="L137" class="LineNr">137 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Display_column</span> > <span class="Constant">0</span><span class="Delimiter">)</span> --<span class="Special">Display_column</span><span class="Delimiter">;</span> <span id="L138" class="LineNr">138 </span> <span class="Delimiter">}</span> <span id="L139" class="LineNr">139 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> -<span id="L140" class="LineNr">140 </span> ++Display_column<span class="Delimiter">;</span> -<span id="L141" class="LineNr">141 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Display_column >= width<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L142" class="LineNr">142 </span> Display_column = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L143" class="LineNr">143 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Display_row < height-<span class="Constant">1</span><span class="Delimiter">)</span> ++Display_row<span class="Delimiter">;</span> +<span id="L140" class="LineNr">140 </span> ++<span class="Special">Display_column</span><span class="Delimiter">;</span> +<span id="L141" class="LineNr">141 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Display_column</span> >= width<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L142" class="LineNr">142 </span> <span class="Special">Display_column</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L143" class="LineNr">143 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Display_row</span> < height-<span class="Constant">1</span><span class="Delimiter">)</span> ++<span class="Special">Display_row</span><span class="Delimiter">;</span> <span id="L144" class="LineNr">144 </span> <span class="Delimiter">}</span> <span id="L145" class="LineNr">145 </span> <span class="Delimiter">}</span> <span id="L146" class="LineNr">146 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -209,7 +213,7 @@ if ('onhashchange' in window) { <span id="L149" class="LineNr">149 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L150" class="LineNr">150 </span>CURSOR_POSITION_ON_DISPLAY<span class="Delimiter">,</span> <span id="L151" class="LineNr">151 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L152" class="LineNr">152 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"cursor-position-on-display"</span><span class="Delimiter">,</span> CURSOR_POSITION_ON_DISPLAY<span class="Delimiter">);</span> +<span id="L152" class="LineNr">152 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"cursor-position-on-display"</span><span class="Delimiter">,</span> CURSOR_POSITION_ON_DISPLAY<span class="Delimiter">);</span> <span id="L153" class="LineNr">153 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L154" class="LineNr">154 </span><span class="Normal">case</span> CURSOR_POSITION_ON_DISPLAY: <span class="Delimiter">{</span> <span id="L155" class="LineNr">155 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -218,27 +222,27 @@ if ('onhashchange' in window) { <span id="L158" class="LineNr">158 </span><span class="Normal">case</span> CURSOR_POSITION_ON_DISPLAY: <span class="Delimiter">{</span> <span id="L159" class="LineNr">159 </span> <a href='080display.cc.html#L12'>CHECK_SCREEN</a><span class="Delimiter">;</span> <span id="L160" class="LineNr">160 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span> -<span id="L161" class="LineNr">161 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>Display_row<span class="Delimiter">);</span> -<span id="L162" class="LineNr">162 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>Display_column<span class="Delimiter">);</span> +<span id="L161" class="LineNr">161 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Special">Display_row</span><span class="Delimiter">);</span> +<span id="L162" class="LineNr">162 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Special">Display_column</span><span class="Delimiter">);</span> <span id="L163" class="LineNr">163 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L164" class="LineNr">164 </span><span class="Delimiter">}</span> <span id="L165" class="LineNr">165 </span> <span id="L166" class="LineNr">166 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L167" class="LineNr">167 </span>MOVE_CURSOR_ON_DISPLAY<span class="Delimiter">,</span> <span id="L168" class="LineNr">168 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L169" class="LineNr">169 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"move-cursor-on-display"</span><span class="Delimiter">,</span> MOVE_CURSOR_ON_DISPLAY<span class="Delimiter">);</span> +<span id="L169" class="LineNr">169 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"move-cursor-on-display"</span><span class="Delimiter">,</span> MOVE_CURSOR_ON_DISPLAY<span class="Delimiter">);</span> <span id="L170" class="LineNr">170 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L171" class="LineNr">171 </span><span class="Normal">case</span> MOVE_CURSOR_ON_DISPLAY: <span class="Delimiter">{</span> <span id="L172" class="LineNr">172 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L173" class="LineNr">173 </span> <a href='003trace.cc.html#L196'>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">"'move-cursor-on-display' requires two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L173" class="LineNr">173 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'move-cursor-on-display' requires two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L174" class="LineNr">174 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L175" class="LineNr">175 </span> <span class="Delimiter">}</span> <span id="L176" class="LineNr">176 </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="L177" class="LineNr">177 </span> <a href='003trace.cc.html#L196'>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 'move-cursor-on-display' should be a row number, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L177" class="LineNr">177 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'move-cursor-on-display' should be a row number, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L178" class="LineNr">178 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L179" class="LineNr">179 </span> <span class="Delimiter">}</span> <span id="L180" class="LineNr">180 </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="L181" class="LineNr">181 </span> <a href='003trace.cc.html#L196'>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 'move-cursor-on-display' should be a column number, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L181" class="LineNr">181 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second ingredient of 'move-cursor-on-display' should be a column number, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L182" class="LineNr">182 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L183" class="LineNr">183 </span> <span class="Delimiter">}</span> <span id="L184" class="LineNr">184 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -246,16 +250,16 @@ if ('onhashchange' in window) { <span id="L186" class="LineNr">186 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L187" class="LineNr">187 </span><span class="Normal">case</span> MOVE_CURSOR_ON_DISPLAY: <span class="Delimiter">{</span> <span id="L188" class="LineNr">188 </span> <a href='080display.cc.html#L12'>CHECK_SCREEN</a><span class="Delimiter">;</span> -<span id="L189" class="LineNr">189 </span> Display_row = 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="L190" class="LineNr">190 </span> Display_column = 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="L191" class="LineNr">191 </span> tb_set_cursor<span class="Delimiter">(</span>Display_column<span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> +<span id="L189" class="LineNr">189 </span> <span class="Special">Display_row</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="L190" class="LineNr">190 </span> <span class="Special">Display_column</span> = 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="L191" class="LineNr">191 </span> tb_set_cursor<span class="Delimiter">(</span><span class="Special">Display_column</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">);</span> <span id="L192" class="LineNr">192 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L193" class="LineNr">193 </span><span class="Delimiter">}</span> <span id="L194" class="LineNr">194 </span> <span id="L195" class="LineNr">195 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L196" class="LineNr">196 </span>MOVE_CURSOR_DOWN_ON_DISPLAY<span class="Delimiter">,</span> <span id="L197" class="LineNr">197 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L198" class="LineNr">198 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"move-cursor-down-on-display"</span><span class="Delimiter">,</span> MOVE_CURSOR_DOWN_ON_DISPLAY<span class="Delimiter">);</span> +<span id="L198" class="LineNr">198 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"move-cursor-down-on-display"</span><span class="Delimiter">,</span> MOVE_CURSOR_DOWN_ON_DISPLAY<span class="Delimiter">);</span> <span id="L199" class="LineNr">199 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L200" class="LineNr">200 </span><span class="Normal">case</span> MOVE_CURSOR_DOWN_ON_DISPLAY: <span class="Delimiter">{</span> <span id="L201" class="LineNr">201 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -265,9 +269,9 @@ if ('onhashchange' in window) { <span id="L205" class="LineNr">205 </span> <a href='080display.cc.html#L12'>CHECK_SCREEN</a><span class="Delimiter">;</span> <span id="L206" class="LineNr">206 </span> <span class="Normal">int</span> h=tb_height<span class="Delimiter">();</span> <span id="L207" class="LineNr">207 </span> <span class="Normal">int</span> height = <span class="Delimiter">(</span>h >= <span class="Constant">0</span><span class="Delimiter">)</span> ? h : <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L208" class="LineNr">208 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Display_row < height-<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L209" class="LineNr">209 </span> ++Display_row<span class="Delimiter">;</span> -<span id="L210" class="LineNr">210 </span> tb_set_cursor<span class="Delimiter">(</span>Display_column<span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> +<span id="L208" class="LineNr">208 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Display_row</span> < height-<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L209" class="LineNr">209 </span> ++<span class="Special">Display_row</span><span class="Delimiter">;</span> +<span id="L210" class="LineNr">210 </span> tb_set_cursor<span class="Delimiter">(</span><span class="Special">Display_column</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">);</span> <span id="L211" class="LineNr">211 </span> <span class="Delimiter">}</span> <span id="L212" class="LineNr">212 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L213" class="LineNr">213 </span><span class="Delimiter">}</span> @@ -275,7 +279,7 @@ if ('onhashchange' in window) { <span id="L215" class="LineNr">215 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L216" class="LineNr">216 </span>MOVE_CURSOR_UP_ON_DISPLAY<span class="Delimiter">,</span> <span id="L217" class="LineNr">217 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L218" class="LineNr">218 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"move-cursor-up-on-display"</span><span class="Delimiter">,</span> MOVE_CURSOR_UP_ON_DISPLAY<span class="Delimiter">);</span> +<span id="L218" class="LineNr">218 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"move-cursor-up-on-display"</span><span class="Delimiter">,</span> MOVE_CURSOR_UP_ON_DISPLAY<span class="Delimiter">);</span> <span id="L219" class="LineNr">219 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L220" class="LineNr">220 </span><span class="Normal">case</span> MOVE_CURSOR_UP_ON_DISPLAY: <span class="Delimiter">{</span> <span id="L221" class="LineNr">221 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -283,9 +287,9 @@ if ('onhashchange' in window) { <span id="L223" class="LineNr">223 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L224" class="LineNr">224 </span><span class="Normal">case</span> MOVE_CURSOR_UP_ON_DISPLAY: <span class="Delimiter">{</span> <span id="L225" class="LineNr">225 </span> <a href='080display.cc.html#L12'>CHECK_SCREEN</a><span class="Delimiter">;</span> -<span id="L226" class="LineNr">226 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Display_row > <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L227" class="LineNr">227 </span> --Display_row<span class="Delimiter">;</span> -<span id="L228" class="LineNr">228 </span> tb_set_cursor<span class="Delimiter">(</span>Display_column<span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> +<span id="L226" class="LineNr">226 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Display_row</span> > <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L227" class="LineNr">227 </span> --<span class="Special">Display_row</span><span class="Delimiter">;</span> +<span id="L228" class="LineNr">228 </span> tb_set_cursor<span class="Delimiter">(</span><span class="Special">Display_column</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">);</span> <span id="L229" class="LineNr">229 </span> <span class="Delimiter">}</span> <span id="L230" class="LineNr">230 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L231" class="LineNr">231 </span><span class="Delimiter">}</span> @@ -293,7 +297,7 @@ if ('onhashchange' in window) { <span id="L233" class="LineNr">233 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L234" class="LineNr">234 </span>MOVE_CURSOR_RIGHT_ON_DISPLAY<span class="Delimiter">,</span> <span id="L235" class="LineNr">235 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L236" class="LineNr">236 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"move-cursor-right-on-display"</span><span class="Delimiter">,</span> MOVE_CURSOR_RIGHT_ON_DISPLAY<span class="Delimiter">);</span> +<span id="L236" class="LineNr">236 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"move-cursor-right-on-display"</span><span class="Delimiter">,</span> MOVE_CURSOR_RIGHT_ON_DISPLAY<span class="Delimiter">);</span> <span id="L237" class="LineNr">237 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L238" class="LineNr">238 </span><span class="Normal">case</span> MOVE_CURSOR_RIGHT_ON_DISPLAY: <span class="Delimiter">{</span> <span id="L239" class="LineNr">239 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -303,9 +307,9 @@ if ('onhashchange' in window) { <span id="L243" class="LineNr">243 </span> <a href='080display.cc.html#L12'>CHECK_SCREEN</a><span class="Delimiter">;</span> <span id="L244" class="LineNr">244 </span> <span class="Normal">int</span> w=tb_width<span class="Delimiter">();</span> <span id="L245" class="LineNr">245 </span> <span class="Normal">int</span> width = <span class="Delimiter">(</span>w >= <span class="Constant">0</span><span class="Delimiter">)</span> ? w : <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L246" class="LineNr">246 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Display_column < width-<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L247" class="LineNr">247 </span> ++Display_column<span class="Delimiter">;</span> -<span id="L248" class="LineNr">248 </span> tb_set_cursor<span class="Delimiter">(</span>Display_column<span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> +<span id="L246" class="LineNr">246 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Display_column</span> < width-<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L247" class="LineNr">247 </span> ++<span class="Special">Display_column</span><span class="Delimiter">;</span> +<span id="L248" class="LineNr">248 </span> tb_set_cursor<span class="Delimiter">(</span><span class="Special">Display_column</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">);</span> <span id="L249" class="LineNr">249 </span> <span class="Delimiter">}</span> <span id="L250" class="LineNr">250 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L251" class="LineNr">251 </span><span class="Delimiter">}</span> @@ -313,7 +317,7 @@ if ('onhashchange' in window) { <span id="L253" class="LineNr">253 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L254" class="LineNr">254 </span>MOVE_CURSOR_LEFT_ON_DISPLAY<span class="Delimiter">,</span> <span id="L255" class="LineNr">255 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L256" class="LineNr">256 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"move-cursor-left-on-display"</span><span class="Delimiter">,</span> MOVE_CURSOR_LEFT_ON_DISPLAY<span class="Delimiter">);</span> +<span id="L256" class="LineNr">256 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"move-cursor-left-on-display"</span><span class="Delimiter">,</span> MOVE_CURSOR_LEFT_ON_DISPLAY<span class="Delimiter">);</span> <span id="L257" class="LineNr">257 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L258" class="LineNr">258 </span><span class="Normal">case</span> MOVE_CURSOR_LEFT_ON_DISPLAY: <span class="Delimiter">{</span> <span id="L259" class="LineNr">259 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -321,9 +325,9 @@ if ('onhashchange' in window) { <span id="L261" class="LineNr">261 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L262" class="LineNr">262 </span><span class="Normal">case</span> MOVE_CURSOR_LEFT_ON_DISPLAY: <span class="Delimiter">{</span> <span id="L263" class="LineNr">263 </span> <a href='080display.cc.html#L12'>CHECK_SCREEN</a><span class="Delimiter">;</span> -<span id="L264" class="LineNr">264 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Display_column > <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L265" class="LineNr">265 </span> --Display_column<span class="Delimiter">;</span> -<span id="L266" class="LineNr">266 </span> tb_set_cursor<span class="Delimiter">(</span>Display_column<span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> +<span id="L264" class="LineNr">264 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Display_column</span> > <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L265" class="LineNr">265 </span> --<span class="Special">Display_column</span><span class="Delimiter">;</span> +<span id="L266" class="LineNr">266 </span> tb_set_cursor<span class="Delimiter">(</span><span class="Special">Display_column</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">);</span> <span id="L267" class="LineNr">267 </span> <span class="Delimiter">}</span> <span id="L268" class="LineNr">268 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L269" class="LineNr">269 </span><span class="Delimiter">}</span> @@ -335,16 +339,16 @@ if ('onhashchange' in window) { <span id="L275" class="LineNr">275 </span><span class="Delimiter">}</span> <span id="L276" class="LineNr">276 </span><span class="Delimiter">:(code)</span> <span id="L277" class="LineNr">277 </span><span class="Normal">void</span> <a href='080display.cc.html#L277'>move_cursor_to_start_of_next_line_on_display</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L278" class="LineNr">278 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Display_row < tb_height<span class="Delimiter">()</span>-<span class="Constant">1</span><span class="Delimiter">)</span> ++Display_row<span class="Delimiter">;</span> -<span id="L279" class="LineNr">279 </span> <span class="Normal">else</span> Display_row = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L280" class="LineNr">280 </span> Display_column = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L281" class="LineNr">281 </span> tb_set_cursor<span class="Delimiter">(</span>Display_column<span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> +<span id="L278" class="LineNr">278 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Display_row</span> < tb_height<span class="Delimiter">()</span>-<span class="Constant">1</span><span class="Delimiter">)</span> ++<span class="Special">Display_row</span><span class="Delimiter">;</span> +<span id="L279" class="LineNr">279 </span> <span class="Normal">else</span> <span class="Special">Display_row</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L280" class="LineNr">280 </span> <span class="Special">Display_column</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L281" class="LineNr">281 </span> tb_set_cursor<span class="Delimiter">(</span><span class="Special">Display_column</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">);</span> <span id="L282" class="LineNr">282 </span><span class="Delimiter">}</span> <span id="L283" class="LineNr">283 </span> <span id="L284" class="LineNr">284 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L285" class="LineNr">285 </span>DISPLAY_WIDTH<span class="Delimiter">,</span> <span id="L286" class="LineNr">286 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L287" class="LineNr">287 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"display-width"</span><span class="Delimiter">,</span> DISPLAY_WIDTH<span class="Delimiter">);</span> +<span id="L287" class="LineNr">287 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"display-width"</span><span class="Delimiter">,</span> DISPLAY_WIDTH<span class="Delimiter">);</span> <span id="L288" class="LineNr">288 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L289" class="LineNr">289 </span><span class="Normal">case</span> DISPLAY_WIDTH: <span class="Delimiter">{</span> <span id="L290" class="LineNr">290 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -360,7 +364,7 @@ if ('onhashchange' in window) { <span id="L300" class="LineNr">300 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L301" class="LineNr">301 </span>DISPLAY_HEIGHT<span class="Delimiter">,</span> <span id="L302" class="LineNr">302 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L303" class="LineNr">303 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"display-height"</span><span class="Delimiter">,</span> DISPLAY_HEIGHT<span class="Delimiter">);</span> +<span id="L303" class="LineNr">303 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"display-height"</span><span class="Delimiter">,</span> DISPLAY_HEIGHT<span class="Delimiter">);</span> <span id="L304" class="LineNr">304 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L305" class="LineNr">305 </span><span class="Normal">case</span> DISPLAY_HEIGHT: <span class="Delimiter">{</span> <span id="L306" class="LineNr">306 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -378,7 +382,7 @@ if ('onhashchange' in window) { <span id="L318" class="LineNr">318 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L319" class="LineNr">319 </span>WAIT_FOR_SOME_INTERACTION<span class="Delimiter">,</span> <span id="L320" class="LineNr">320 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L321" class="LineNr">321 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"wait-for-some-interaction"</span><span class="Delimiter">,</span> WAIT_FOR_SOME_INTERACTION<span class="Delimiter">);</span> +<span id="L321" class="LineNr">321 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"wait-for-some-interaction"</span><span class="Delimiter">,</span> WAIT_FOR_SOME_INTERACTION<span class="Delimiter">);</span> <span id="L322" class="LineNr">322 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L323" class="LineNr">323 </span><span class="Normal">case</span> WAIT_FOR_SOME_INTERACTION: <span class="Delimiter">{</span> <span id="L324" class="LineNr">324 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -394,7 +398,7 @@ if ('onhashchange' in window) { <span id="L334" class="LineNr">334 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L335" class="LineNr">335 </span>CHECK_FOR_INTERACTION<span class="Delimiter">,</span> <span id="L336" class="LineNr">336 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L337" class="LineNr">337 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"check-for-interaction"</span><span class="Delimiter">,</span> CHECK_FOR_INTERACTION<span class="Delimiter">);</span> +<span id="L337" class="LineNr">337 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"check-for-interaction"</span><span class="Delimiter">,</span> CHECK_FOR_INTERACTION<span class="Delimiter">);</span> <span id="L338" class="LineNr">338 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L339" class="LineNr">339 </span><span class="Normal">case</span> CHECK_FOR_INTERACTION: <span class="Delimiter">{</span> <span id="L340" class="LineNr">340 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -462,7 +466,7 @@ if ('onhashchange' in window) { <span id="L402" class="LineNr">402 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L403" class="LineNr">403 </span>INTERACTIONS_LEFT<span class="Delimiter">,</span> <span id="L404" class="LineNr">404 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L405" class="LineNr">405 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"interactions-left?"</span><span class="Delimiter">,</span> INTERACTIONS_LEFT<span class="Delimiter">);</span> +<span id="L405" class="LineNr">405 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"interactions-left?"</span><span class="Delimiter">,</span> INTERACTIONS_LEFT<span class="Delimiter">);</span> <span id="L406" class="LineNr">406 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L407" class="LineNr">407 </span><span class="Normal">case</span> INTERACTIONS_LEFT: <span class="Delimiter">{</span> <span id="L408" class="LineNr">408 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -480,7 +484,7 @@ if ('onhashchange' in window) { <span id="L420" class="LineNr">420 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L421" class="LineNr">421 </span>CLEAR_LINE_ON_DISPLAY<span class="Delimiter">,</span> <span id="L422" class="LineNr">422 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L423" class="LineNr">423 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"clear-line-on-display"</span><span class="Delimiter">,</span> CLEAR_LINE_ON_DISPLAY<span class="Delimiter">);</span> +<span id="L423" class="LineNr">423 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"clear-line-on-display"</span><span class="Delimiter">,</span> CLEAR_LINE_ON_DISPLAY<span class="Delimiter">);</span> <span id="L424" class="LineNr">424 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L425" class="LineNr">425 </span><span class="Normal">case</span> CLEAR_LINE_ON_DISPLAY: <span class="Delimiter">{</span> <span id="L426" class="LineNr">426 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -489,16 +493,16 @@ if ('onhashchange' in window) { <span id="L429" class="LineNr">429 </span><span class="Normal">case</span> CLEAR_LINE_ON_DISPLAY: <span class="Delimiter">{</span> <span id="L430" class="LineNr">430 </span> <a href='080display.cc.html#L12'>CHECK_SCREEN</a><span class="Delimiter">;</span> <span id="L431" class="LineNr">431 </span> <span class="Normal">int</span> width = tb_width<span class="Delimiter">();</span> -<span id="L432" class="LineNr">432 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> x = Display_column<span class="Delimiter">;</span> x < width<span class="Delimiter">;</span> ++x<span class="Delimiter">)</span> +<span id="L432" class="LineNr">432 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> x = <span class="Special">Display_column</span><span class="Delimiter">;</span> x < width<span class="Delimiter">;</span> ++x<span class="Delimiter">)</span> <span id="L433" class="LineNr">433 </span> tb_print<span class="Delimiter">(</span><span class="Constant">' '</span><span class="Delimiter">,</span> TB_WHITE<span class="Delimiter">,</span> TB_BLACK<span class="Delimiter">);</span> -<span id="L434" class="LineNr">434 </span> tb_set_cursor<span class="Delimiter">(</span>Display_column<span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> +<span id="L434" class="LineNr">434 </span> tb_set_cursor<span class="Delimiter">(</span><span class="Special">Display_column</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">);</span> <span id="L435" class="LineNr">435 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L436" class="LineNr">436 </span><span class="Delimiter">}</span> <span id="L437" class="LineNr">437 </span> <span id="L438" class="LineNr">438 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L439" class="LineNr">439 </span>CLEAR_DISPLAY_FROM<span class="Delimiter">,</span> <span id="L440" class="LineNr">440 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L441" class="LineNr">441 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"clear-display-from"</span><span class="Delimiter">,</span> CLEAR_DISPLAY_FROM<span class="Delimiter">);</span> +<span id="L441" class="LineNr">441 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"clear-display-from"</span><span class="Delimiter">,</span> CLEAR_DISPLAY_FROM<span class="Delimiter">);</span> <span id="L442" class="LineNr">442 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L443" class="LineNr">443 </span><span class="Normal">case</span> CLEAR_DISPLAY_FROM: <span class="Delimiter">{</span> <span id="L444" class="LineNr">444 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -517,7 +521,7 @@ if ('onhashchange' in window) { <span id="L457" class="LineNr">457 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">nada</span><span class="Comment">*/</span><span class="Delimiter">;</span> column <= right<span class="Delimiter">;</span> ++column<span class="Delimiter">)</span> <span id="L458" class="LineNr">458 </span> tb_print<span class="Delimiter">(</span><span class="Constant">' '</span><span class="Delimiter">,</span> TB_WHITE<span class="Delimiter">,</span> TB_BLACK<span class="Delimiter">);</span> <span id="L459" class="LineNr">459 </span> <span class="Delimiter">}</span> -<span id="L460" class="LineNr">460 </span> tb_set_cursor<span class="Delimiter">(</span>Display_column<span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> +<span id="L460" class="LineNr">460 </span> tb_set_cursor<span class="Delimiter">(</span><span class="Special">Display_column</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">);</span> <span id="L461" class="LineNr">461 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L462" class="LineNr">462 </span><span class="Delimiter">}</span> </pre> diff --git a/html/081print.mu.html b/html/081print.mu.html index 9f84a486..05439c1c 100644 --- a/html/081print.mu.html +++ b/html/081print.mu.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } -.muControl { color: #c0a020; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -59,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/081print.mu'>https://github.com/akkartik/mu/blob/master/081print.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Wrappers around print primitives that take a 'screen' object and are thus</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># easier to test.</span> diff --git a/html/082scenario_screen.cc.html b/html/082scenario_screen.cc.html index 68c96f9a..918437cf 100644 --- a/html/082scenario_screen.cc.html +++ b/html/082scenario_screen.cc.html @@ -11,23 +11,25 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } .CommentedCode { color: #6c6c6c; } .traceAbsent { color: #c00000; } .muScenario { color: #00af00; } .muRecipe { color: #ff8700; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .cSpecial { color: #008000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -62,6 +64,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/082scenario_screen.cc'>https://github.com/akkartik/mu/blob/master/082scenario_screen.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Clean syntax to manipulate and check the screen in scenarios.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: Instructions 'assume-screen' and 'screen-should-contain' implicitly create</span> @@ -203,10 +206,10 @@ if ('onhashchange' in window) { <span id="L138" class="LineNr">138 </span><span class="Comment">//: locations.</span> <span id="L139" class="LineNr">139 </span> <span id="L140" class="LineNr">140 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L141" class="LineNr">141 </span><span class="Normal">extern</span> <span class="Normal">const</span> <span class="Normal">int</span> Max_variables_in_scenarios = Reserved_for_tests-<span class="Constant">100</span><span class="Delimiter">;</span> -<span id="L142" class="LineNr">142 </span><span class="Normal">int</span> Next_predefined_global_for_scenarios = Max_variables_in_scenarios<span class="Delimiter">;</span> +<span id="L141" class="LineNr">141 </span><span class="Normal">extern</span> <span class="Normal">const</span> <span class="Normal">int</span> <span class="Special">Max_variables_in_scenarios</span> = <span class="Special">Reserved_for_tests-100</span><span class="Delimiter">;</span> +<span id="L142" class="LineNr">142 </span><span class="Normal">int</span> <span class="Special">Next_predefined_global_for_scenarios</span> = <span class="Special">Max_variables_in_scenarios</span><span class="Delimiter">;</span> <span id="L143" class="LineNr">143 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L144" class="LineNr">144 </span>assert<span class="Delimiter">(</span>Next_predefined_global_for_scenarios < Reserved_for_tests<span class="Delimiter">);</span> +<span id="L144" class="LineNr">144 </span>assert<span class="Delimiter">(</span><span class="Special">Next_predefined_global_for_scenarios</span> < <span class="Special">Reserved_for_tests</span><span class="Delimiter">);</span> <span id="L145" class="LineNr">145 </span> <span id="L146" class="LineNr">146 </span><span class="Delimiter">:(before "End Globals")</span> <span id="L147" class="LineNr">147 </span><span class="Comment">// Scenario Globals.</span> @@ -214,14 +217,14 @@ if ('onhashchange' in window) { <span id="L149" class="LineNr">149 </span><span class="Comment">// End Scenario Globals.</span> <span id="L150" class="LineNr">150 </span><span class="Delimiter">:(code)</span> <span id="L151" class="LineNr">151 </span><span class="Normal">int</span> next_predefined_global_for_scenarios<span class="Delimiter">(</span><span class="Normal">int</span> size<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L152" class="LineNr">152 </span> <span class="Normal">int</span> result = Next_predefined_global_for_scenarios<span class="Delimiter">;</span> -<span id="L153" class="LineNr">153 </span> Next_predefined_global_for_scenarios += size<span class="Delimiter">;</span> +<span id="L152" class="LineNr">152 </span> <span class="Normal">int</span> result = <span class="Special">Next_predefined_global_for_scenarios</span><span class="Delimiter">;</span> +<span id="L153" class="LineNr">153 </span> <span class="Special">Next_predefined_global_for_scenarios</span> += size<span class="Delimiter">;</span> <span id="L154" class="LineNr">154 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L155" class="LineNr">155 </span><span class="Delimiter">}</span> <span id="L156" class="LineNr">156 </span> <span id="L157" class="LineNr">157 </span><span class="Comment">//: give 'screen' a fixed location in scenarios</span> <span id="L158" class="LineNr">158 </span><span class="Delimiter">:(before "End Special Scenario Variable Names(r)")</span> -<span id="L159" class="LineNr">159 </span>Name[r][<span class="Constant">"screen"</span>] = SCREEN<span class="Delimiter">;</span> +<span id="L159" class="LineNr">159 </span><span class="Special">Name</span>[r][<span class="Constant">"screen"</span>] = SCREEN<span class="Delimiter">;</span> <span id="L160" class="LineNr">160 </span><span class="Comment">//: make 'screen' always a raw location in scenarios</span> <span id="L161" class="LineNr">161 </span><span class="Delimiter">:(before "End <a href='042name.cc.html#L172'>is_special_name</a> Special-cases")</span> <span id="L162" class="LineNr">162 </span><span class="Normal">if</span> <span class="Delimiter">(</span>s == <span class="Constant">"screen"</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> @@ -232,10 +235,10 @@ if ('onhashchange' in window) { <span id="L167" class="LineNr">167 </span><span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">.</span>name == <span class="Constant">"assume-screen"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L168" class="LineNr">168 </span> curr<span class="Delimiter">.</span>name = <span class="Constant">"new-fake-screen"</span><span class="Delimiter">;</span> <span id="L169" class="LineNr">169 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!curr<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L170" class="LineNr">170 </span> <a href='003trace.cc.html#L196'>raise</a> << result<span class="Delimiter">.</span>name << <span class="Constant">": 'assume-screen' has no products</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L170" class="LineNr">170 </span> <a href='003trace.cc.html#L196'>raise</a> << result<span class="Delimiter">.</span>name << <span class="Constant">": 'assume-screen' has no products\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L171" class="LineNr">171 </span> <span class="Delimiter">}</span> <span id="L172" class="LineNr">172 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!starts_with<span class="Delimiter">(</span>result<span class="Delimiter">.</span>name<span class="Delimiter">,</span> <span class="Constant">"scenario_"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L173" class="LineNr">173 </span> <a href='003trace.cc.html#L196'>raise</a> << result<span class="Delimiter">.</span>name << <span class="Constant">": 'assume-screen' can't be called here, only in scenarios</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L173" class="LineNr">173 </span> <a href='003trace.cc.html#L196'>raise</a> << result<span class="Delimiter">.</span>name << <span class="Constant">": 'assume-screen' can't be called here, only in scenarios\n"</span> << end<span class="Delimiter">();</span> <span id="L174" class="LineNr">174 </span> <span class="Delimiter">}</span> <span id="L175" class="LineNr">175 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L176" class="LineNr">176 </span> assert<span class="Delimiter">(</span>curr<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> @@ -255,22 +258,22 @@ if ('onhashchange' in window) { <span id="L190" class="LineNr">190 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L191" class="LineNr">191 </span>SCREEN_SHOULD_CONTAIN<span class="Delimiter">,</span> <span id="L192" class="LineNr">192 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L193" class="LineNr">193 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"screen-should-contain"</span><span class="Delimiter">,</span> SCREEN_SHOULD_CONTAIN<span class="Delimiter">);</span> +<span id="L193" class="LineNr">193 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"screen-should-contain"</span><span class="Delimiter">,</span> SCREEN_SHOULD_CONTAIN<span class="Delimiter">);</span> <span id="L194" class="LineNr">194 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L195" class="LineNr">195 </span><span class="Normal">case</span> SCREEN_SHOULD_CONTAIN: <span class="Delimiter">{</span> <span id="L196" class="LineNr">196 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L197" class="LineNr">197 </span> <a href='003trace.cc.html#L196'>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">"'screen-should-contain' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L197" class="LineNr">197 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'screen-should-contain' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L198" class="LineNr">198 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L199" class="LineNr">199 </span> <span class="Delimiter">}</span> <span id="L200" class="LineNr">200 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal_text<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="L201" class="LineNr">201 </span> <a href='003trace.cc.html#L196'>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 'screen-should-contain' should be a literal string, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L201" class="LineNr">201 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'screen-should-contain' should be a literal string, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L202" class="LineNr">202 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L203" class="LineNr">203 </span> <span class="Delimiter">}</span> <span id="L204" class="LineNr">204 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L205" class="LineNr">205 </span><span class="Delimiter">}</span> <span id="L206" class="LineNr">206 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L207" class="LineNr">207 </span><span class="Normal">case</span> SCREEN_SHOULD_CONTAIN: <span class="Delimiter">{</span> -<span id="L208" class="LineNr">208 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Passed<span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L208" class="LineNr">208 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Passed</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L209" class="LineNr">209 </span> assert<span class="Delimiter">(</span>scalar<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)));</span> <span id="L210" class="LineNr">210 </span> check_screen<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name<span class="Delimiter">,</span> -<span class="Constant">1</span><span class="Delimiter">);</span> <span id="L211" class="LineNr">211 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -279,26 +282,26 @@ if ('onhashchange' in window) { <span id="L214" class="LineNr">214 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L215" class="LineNr">215 </span>SCREEN_SHOULD_CONTAIN_IN_COLOR<span class="Delimiter">,</span> <span id="L216" class="LineNr">216 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L217" class="LineNr">217 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"screen-should-contain-in-color"</span><span class="Delimiter">,</span> SCREEN_SHOULD_CONTAIN_IN_COLOR<span class="Delimiter">);</span> +<span id="L217" class="LineNr">217 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"screen-should-contain-in-color"</span><span class="Delimiter">,</span> SCREEN_SHOULD_CONTAIN_IN_COLOR<span class="Delimiter">);</span> <span id="L218" class="LineNr">218 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L219" class="LineNr">219 </span><span class="Normal">case</span> SCREEN_SHOULD_CONTAIN_IN_COLOR: <span class="Delimiter">{</span> <span id="L220" class="LineNr">220 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L221" class="LineNr">221 </span> <a href='003trace.cc.html#L196'>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">"'screen-should-contain-in-color' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L221" class="LineNr">221 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'screen-should-contain-in-color' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L222" class="LineNr">222 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L223" class="LineNr">223 </span> <span class="Delimiter">}</span> <span id="L224" class="LineNr">224 </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="L225" class="LineNr">225 </span> <a href='003trace.cc.html#L196'>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 'screen-should-contain-in-color' should be a number (color code), 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L225" class="LineNr">225 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'screen-should-contain-in-color' should be a number (color code), 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L226" class="LineNr">226 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L227" class="LineNr">227 </span> <span class="Delimiter">}</span> <span id="L228" class="LineNr">228 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal_text<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="L229" class="LineNr">229 </span> <a href='003trace.cc.html#L196'>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 'screen-should-contain-in-color' should be a literal string, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L229" class="LineNr">229 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second ingredient of 'screen-should-contain-in-color' should be a literal string, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L230" class="LineNr">230 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L231" class="LineNr">231 </span> <span class="Delimiter">}</span> <span id="L232" class="LineNr">232 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L233" class="LineNr">233 </span><span class="Delimiter">}</span> <span id="L234" class="LineNr">234 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L235" class="LineNr">235 </span><span class="Normal">case</span> SCREEN_SHOULD_CONTAIN_IN_COLOR: <span class="Delimiter">{</span> -<span id="L236" class="LineNr">236 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Passed<span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L236" class="LineNr">236 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Passed</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L237" class="LineNr">237 </span> assert<span class="Delimiter">(</span>scalar<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)));</span> <span id="L238" class="LineNr">238 </span> assert<span class="Delimiter">(</span>scalar<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">)));</span> <span id="L239" class="LineNr">239 </span> check_screen<span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name<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> @@ -321,24 +324,24 @@ if ('onhashchange' in window) { <span id="L256" class="LineNr">256 </span> <span id="L257" class="LineNr">257 </span><span class="Delimiter">:(code)</span> <span id="L258" class="LineNr">258 </span><span class="Normal">void</span> check_screen<span class="Delimiter">(</span><span class="Normal">const</span> string& expected_contents<span class="Delimiter">,</span> <span class="Normal">const</span> <span class="Normal">int</span> color<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L259" class="LineNr">259 </span> <span class="Normal">int</span> screen_location = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> SCREEN+<span class="Comment">/*</span><span class="Comment">skip <a href='043space.cc.html#L101'>address</a> alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip payload alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L259" class="LineNr">259 </span> <span class="Normal">int</span> screen_location = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> SCREEN+<span class="Comment">/*</span><span class="Comment">skip <a href='043space.cc.html#L101'>address</a> alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip payload alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span id="L260" class="LineNr">260 </span> reagent screen<span class="Delimiter">(</span><span class="Constant">"x:screen"</span><span class="Delimiter">);</span> <span class="Comment">// just to ensure screen.type is reclaimed</span> <span id="L261" class="LineNr">261 </span> <span class="Normal">int</span> screen_data_location = <a href='042name.cc.html#L148'>find_element_location</a><span class="Delimiter">(</span>screen_location<span class="Delimiter">,</span> <span class="Constant">"data"</span><span class="Delimiter">,</span> screen<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">"check_screen"</span><span class="Delimiter">);</span> <span class="Comment">// type: address:array:character</span> <span id="L262" class="LineNr">262 </span> assert<span class="Delimiter">(</span>screen_data_location >= <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L263" class="LineNr">263 </span><span class="CommentedCode">//? cerr << "screen data is at location " << screen_data_location << '\n';</span> -<span id="L264" class="LineNr">264 </span> <span class="Normal">int</span> screen_data_start = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_data_location+<span class="Comment">/*</span><span class="Comment">skip <a href='043space.cc.html#L101'>address</a> alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip payload alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// type: array:character</span> +<span id="L264" class="LineNr">264 </span> <span class="Normal">int</span> screen_data_start = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> screen_data_location+<span class="Comment">/*</span><span class="Comment">skip <a href='043space.cc.html#L101'>address</a> alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip payload alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// type: array:character</span> <span id="L265" class="LineNr">265 </span><span class="CommentedCode">//? cerr << "screen data start is at " << screen_data_start << '\n';</span> <span id="L266" class="LineNr">266 </span> <span class="Normal">int</span> screen_width_location = <a href='042name.cc.html#L148'>find_element_location</a><span class="Delimiter">(</span>screen_location<span class="Delimiter">,</span> <span class="Constant">"num-columns"</span><span class="Delimiter">,</span> screen<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">"check_screen"</span><span class="Delimiter">);</span> <span id="L267" class="LineNr">267 </span><span class="CommentedCode">//? cerr << "screen width is at location " << screen_width_location << '\n';</span> -<span id="L268" class="LineNr">268 </span> <span class="Normal">int</span> screen_width = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_width_location<span class="Delimiter">);</span> +<span id="L268" class="LineNr">268 </span> <span class="Normal">int</span> screen_width = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> screen_width_location<span class="Delimiter">);</span> <span id="L269" class="LineNr">269 </span><span class="CommentedCode">//? cerr << "screen width: " << screen_width << '\n';</span> <span id="L270" class="LineNr">270 </span> <span class="Normal">int</span> screen_height_location = <a href='042name.cc.html#L148'>find_element_location</a><span class="Delimiter">(</span>screen_location<span class="Delimiter">,</span> <span class="Constant">"num-rows"</span><span class="Delimiter">,</span> screen<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">"check_screen"</span><span class="Delimiter">);</span> <span id="L271" class="LineNr">271 </span><span class="CommentedCode">//? cerr << "screen height is at location " << screen_height_location << '\n';</span> -<span id="L272" class="LineNr">272 </span> <span class="Normal">int</span> screen_height = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_height_location<span class="Delimiter">);</span> +<span id="L272" class="LineNr">272 </span> <span class="Normal">int</span> screen_height = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> screen_height_location<span class="Delimiter">);</span> <span id="L273" class="LineNr">273 </span><span class="CommentedCode">//? cerr << "screen height: " << screen_height << '\n';</span> <span id="L274" class="LineNr">274 </span> <span class="Normal">int</span> top_index_location= <a href='042name.cc.html#L148'>find_element_location</a><span class="Delimiter">(</span>screen_location<span class="Delimiter">,</span> <span class="Constant">"top-idx"</span><span class="Delimiter">,</span> screen<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">"check_screen"</span><span class="Delimiter">);</span> <span id="L275" class="LineNr">275 </span><span class="CommentedCode">//? cerr << "top of screen is at location " << top_index_location << '\n';</span> -<span id="L276" class="LineNr">276 </span> <span class="Normal">int</span> top_index = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> top_index_location<span class="Delimiter">);</span> +<span id="L276" class="LineNr">276 </span> <span class="Normal">int</span> top_index = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> top_index_location<span class="Delimiter">);</span> <span id="L277" class="LineNr">277 </span><span class="CommentedCode">//? cerr << "top of screen is index " << top_index << '\n';</span> <span id="L278" class="LineNr">278 </span> raw_string_stream cursor<span class="Delimiter">(</span>expected_contents<span class="Delimiter">);</span> <span id="L279" class="LineNr">279 </span> <span class="Comment">// todo: too-long expected_contents should fail</span> @@ -346,26 +349,26 @@ if ('onhashchange' in window) { <span id="L281" class="LineNr">281 </span> cursor<span class="Delimiter">.</span><a href='011load.cc.html#L211'>skip_whitespace_and_comments</a><span class="Delimiter">();</span> <span id="L282" class="LineNr">282 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>cursor<span class="Delimiter">.</span>at_end<span class="Delimiter">())</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L283" class="LineNr">283 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>cursor<span class="Delimiter">.</span>get<span class="Delimiter">()</span> != <span class="Constant">'.'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L284" class="LineNr">284 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"each row of the expected screen should start with a '.'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L285" class="LineNr">285 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L284" class="LineNr">284 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"each row of the expected screen should start with a '.'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L285" class="LineNr">285 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Scenario_testing_scenario</span><span class="Delimiter">)</span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L286" class="LineNr">286 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L287" class="LineNr">287 </span> <span class="Delimiter">}</span> <span id="L288" class="LineNr">288 </span> <span class="Normal">int</span> addr = screen_data_start+<span class="Comment">/*</span><span class="Comment">length</span><span class="Comment">*/</span><span class="Constant">1</span>+row*screen_width* <span class="Comment">/*</span><span class="Comment">size of screen-cell</span><span class="Comment">*/</span><span class="Constant">2</span><span class="Delimiter">;</span> <span id="L289" class="LineNr">289 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> column = <span class="Constant">0</span><span class="Delimiter">;</span> column < screen_width<span class="Delimiter">;</span> ++column<span class="Delimiter">,</span> addr+= <span class="Comment">/*</span><span class="Comment">size of screen-cell</span><span class="Comment">*/</span><span class="Constant">2</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L290" class="LineNr">290 </span> <span class="Normal">const</span> <span class="Normal">int</span> cell_color_offset = <span class="Constant">1</span><span class="Delimiter">;</span> <span id="L291" class="LineNr">291 </span> <span class="Normal">uint32_t</span> curr = cursor<span class="Delimiter">.</span>get<span class="Delimiter">();</span> -<span id="L292" class="LineNr">292 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)</span> == <span class="Constant">0</span> && isspace<span class="Delimiter">(</span>curr<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L293" class="LineNr">293 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr == <span class="Constant">' '</span> && color != -<span class="Constant">1</span> && color != <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr+cell_color_offset<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L292" class="LineNr">292 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> addr<span class="Delimiter">)</span> == <span class="Constant">0</span> && isspace<span class="Delimiter">(</span>curr<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L293" class="LineNr">293 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr == <span class="Constant">' '</span> && color != -<span class="Constant">1</span> && color != <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> addr+cell_color_offset<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L294" class="LineNr">294 </span> <span class="Comment">// filter out other colors</span> <span id="L295" class="LineNr">295 </span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L296" class="LineNr">296 </span> <span class="Delimiter">}</span> -<span id="L297" class="LineNr">297 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)</span> != <span class="Constant">0</span> && <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)</span> == curr<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L298" class="LineNr">298 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>color == -<span class="Constant">1</span> || color == <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr+cell_color_offset<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L297" class="LineNr">297 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> addr<span class="Delimiter">)</span> != <span class="Constant">0</span> && <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> addr<span class="Delimiter">)</span> == curr<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L298" class="LineNr">298 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>color == -<span class="Constant">1</span> || color == <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> addr+cell_color_offset<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L299" class="LineNr">299 </span> <span class="Comment">// contents match but color is off</span> -<span id="L300" class="LineNr">300 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L301" class="LineNr">301 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected screen location ("</span> << row << <span class="Constant">", "</span> << column << <span class="Constant">") to contain '"</span> << unicode_character_at<span class="Delimiter">(</span>addr<span class="Delimiter">)</span> << <span class="Constant">"' in color "</span> << color << <span class="Constant">" instead of "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr+cell_color_offset<span class="Delimiter">))</span> << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L302" class="LineNr">302 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> dump_screen<span class="Delimiter">();</span> -<span id="L303" class="LineNr">303 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L300" class="LineNr">300 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L301" class="LineNr">301 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected screen location ("</span> << row << <span class="Constant">", "</span> << column << <span class="Constant">") to contain '"</span> << unicode_character_at<span class="Delimiter">(</span>addr<span class="Delimiter">)</span> << <span class="Constant">"' in color "</span> << color << <span class="Constant">" instead of "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> addr+cell_color_offset<span class="Delimiter">))</span> << <span class="Constant">"\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L302" class="LineNr">302 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> dump_screen<span class="Delimiter">();</span> +<span id="L303" class="LineNr">303 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Scenario_testing_scenario</span><span class="Delimiter">)</span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L304" class="LineNr">304 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L305" class="LineNr">305 </span> <span class="Delimiter">}</span> <span id="L306" class="LineNr">306 </span> @@ -377,34 +380,34 @@ if ('onhashchange' in window) { <span id="L312" class="LineNr">312 </span> expected_pretty[<span class="Constant">0</span>] = <span class="Constant">' '</span><span class="Delimiter">,</span> expected_pretty[<span class="Constant">1</span>] = <span class="Constant">'('</span><span class="Delimiter">,</span> expected_pretty[<span class="Constant">2</span>] = <span class="cSpecial">'\''</span><span class="Delimiter">,</span> expected_pretty[<span class="Constant">3</span>] = <span class="Normal">static_cast</span><<span class="Normal">unsigned</span> <span class="Normal">char</span>><span class="Delimiter">(</span>curr<span class="Delimiter">),</span> expected_pretty[<span class="Constant">4</span>] = <span class="cSpecial">'\''</span><span class="Delimiter">,</span> expected_pretty[<span class="Constant">5</span>] = <span class="Constant">')'</span><span class="Delimiter">,</span> expected_pretty[<span class="Constant">6</span>] = <span class="cSpecial">'\0'</span><span class="Delimiter">;</span> <span id="L313" class="LineNr">313 </span> <span class="Delimiter">}</span> <span id="L314" class="LineNr">314 </span> <span class="Normal">char</span> actual_pretty[<span class="Constant">10</span>] = <span class="Delimiter">{</span><span class="Constant">0</span><span class="Delimiter">};</span> -<span id="L315" class="LineNr">315 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)</span> < <span class="Constant">256</span> && !iscntrl<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)))</span> <span class="Delimiter">{</span> +<span id="L315" class="LineNr">315 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> addr<span class="Delimiter">)</span> < <span class="Constant">256</span> && !iscntrl<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> addr<span class="Delimiter">)))</span> <span class="Delimiter">{</span> <span id="L316" class="LineNr">316 </span> <span class="Comment">// " ('<curr>')"</span> -<span id="L317" class="LineNr">317 </span> actual_pretty[<span class="Constant">0</span>] = <span class="Constant">' '</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">1</span>] = <span class="Constant">'('</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">2</span>] = <span class="cSpecial">'\''</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">3</span>] = <span class="Normal">static_cast</span><<span class="Normal">unsigned</span> <span class="Normal">char</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">)),</span> actual_pretty[<span class="Constant">4</span>] = <span class="cSpecial">'\''</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">5</span>] = <span class="Constant">')'</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">6</span>] = <span class="cSpecial">'\0'</span><span class="Delimiter">;</span> +<span id="L317" class="LineNr">317 </span> actual_pretty[<span class="Constant">0</span>] = <span class="Constant">' '</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">1</span>] = <span class="Constant">'('</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">2</span>] = <span class="cSpecial">'\''</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">3</span>] = <span class="Normal">static_cast</span><<span class="Normal">unsigned</span> <span class="Normal">char</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> addr<span class="Delimiter">)),</span> actual_pretty[<span class="Constant">4</span>] = <span class="cSpecial">'\''</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">5</span>] = <span class="Constant">')'</span><span class="Delimiter">,</span> actual_pretty[<span class="Constant">6</span>] = <span class="cSpecial">'\0'</span><span class="Delimiter">;</span> <span id="L318" class="LineNr">318 </span> <span class="Delimiter">}</span> <span id="L319" class="LineNr">319 </span> <span id="L320" class="LineNr">320 </span> ostringstream color_phrase<span class="Delimiter">;</span> <span id="L321" class="LineNr">321 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>color != -<span class="Constant">1</span><span class="Delimiter">)</span> color_phrase << <span class="Constant">" in color "</span> << color<span class="Delimiter">;</span> -<span id="L322" class="LineNr">322 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L323" class="LineNr">323 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected screen location ("</span> << row << <span class="Constant">", "</span> << column << <span class="Constant">") to contain "</span> << curr << expected_pretty << color_phrase<span class="Delimiter">.</span>str<span class="Delimiter">()</span> << <span class="Constant">" instead of "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">))</span> << actual_pretty << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L324" class="LineNr">324 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Hide_errors<span class="Delimiter">)</span> dump_screen<span class="Delimiter">();</span> -<span id="L325" class="LineNr">325 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L322" class="LineNr">322 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> cerr << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L323" class="LineNr">323 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"F - "</span> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected screen location ("</span> << row << <span class="Constant">", "</span> << column << <span class="Constant">") to contain "</span> << curr << expected_pretty << color_phrase<span class="Delimiter">.</span>str<span class="Delimiter">()</span> << <span class="Constant">" instead of "</span> << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> addr<span class="Delimiter">))</span> << actual_pretty << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L324" class="LineNr">324 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Hide_errors</span><span class="Delimiter">)</span> dump_screen<span class="Delimiter">();</span> +<span id="L325" class="LineNr">325 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Scenario_testing_scenario</span><span class="Delimiter">)</span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L326" class="LineNr">326 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L327" class="LineNr">327 </span> <span class="Delimiter">}</span> <span id="L328" class="LineNr">328 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>cursor<span class="Delimiter">.</span>get<span class="Delimiter">()</span> != <span class="Constant">'.'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L329" class="LineNr">329 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"row "</span> << row << <span class="Constant">" of the expected screen is too long</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L330" class="LineNr">330 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Scenario_testing_scenario<span class="Delimiter">)</span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L329" class="LineNr">329 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"row "</span> << row << <span class="Constant">" of the expected screen is too long\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L330" class="LineNr">330 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Scenario_testing_scenario</span><span class="Delimiter">)</span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L331" class="LineNr">331 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L332" class="LineNr">332 </span> <span class="Delimiter">}</span> <span id="L333" class="LineNr">333 </span> <span class="Delimiter">}</span> <span id="L334" class="LineNr">334 </span> cursor<span class="Delimiter">.</span><a href='011load.cc.html#L211'>skip_whitespace_and_comments</a><span class="Delimiter">();</span> <span id="L335" class="LineNr">335 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!cursor<span class="Delimiter">.</span>at_end<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L336" class="LineNr">336 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected screen has too many rows</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L337" class="LineNr">337 </span> Passed =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L336" class="LineNr">336 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"expected screen has too many rows\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L337" class="LineNr">337 </span> <span class="Special">Passed</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L338" class="LineNr">338 </span> <span class="Delimiter">}</span> <span id="L339" class="LineNr">339 </span><span class="Delimiter">}</span> <span id="L340" class="LineNr">340 </span> <span id="L341" class="LineNr">341 </span><span class="Normal">const</span> <span class="Normal">char</span>* unicode_character_at<span class="Delimiter">(</span><span class="Normal">int</span> addr<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L342" class="LineNr">342 </span> <span class="Normal">int</span> unicode_code_point = <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> addr<span class="Delimiter">));</span> +<span id="L342" class="LineNr">342 </span> <span class="Normal">int</span> unicode_code_point = <span class="Normal">static_cast</span><<span class="Normal">int</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> addr<span class="Delimiter">));</span> <span id="L343" class="LineNr">343 </span> <span class="Identifier">return</span> to_unicode<span class="Delimiter">(</span>unicode_code_point<span class="Delimiter">);</span> <span id="L344" class="LineNr">344 </span><span class="Delimiter">}</span> <span id="L345" class="LineNr">345 </span> @@ -451,7 +454,7 @@ if ('onhashchange' in window) { <span id="L386" class="LineNr">386 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L387" class="LineNr">387 </span>_DUMP_SCREEN<span class="Delimiter">,</span> <span id="L388" class="LineNr">388 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L389" class="LineNr">389 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$dump-screen"</span><span class="Delimiter">,</span> _DUMP_SCREEN<span class="Delimiter">);</span> +<span id="L389" class="LineNr">389 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$dump-screen"</span><span class="Delimiter">,</span> _DUMP_SCREEN<span class="Delimiter">);</span> <span id="L390" class="LineNr">390 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L391" class="LineNr">391 </span><span class="Normal">case</span> _DUMP_SCREEN: <span class="Delimiter">{</span> <span id="L392" class="LineNr">392 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -464,36 +467,36 @@ if ('onhashchange' in window) { <span id="L399" class="LineNr">399 </span> <span id="L400" class="LineNr">400 </span><span class="Delimiter">:(code)</span> <span id="L401" class="LineNr">401 </span><span class="Normal">void</span> dump_screen<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L402" class="LineNr">402 </span> <span class="Normal">int</span> screen_location = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> SCREEN+<span class="Comment">/*</span><span class="Comment">skip <a href='043space.cc.html#L101'>address</a> alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip payload alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L402" class="LineNr">402 </span> <span class="Normal">int</span> screen_location = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> SCREEN+<span class="Comment">/*</span><span class="Comment">skip <a href='043space.cc.html#L101'>address</a> alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip payload alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span id="L403" class="LineNr">403 </span> reagent screen<span class="Delimiter">(</span><span class="Constant">"x:screen"</span><span class="Delimiter">);</span> <span class="Comment">// just to ensure screen.type is reclaimed</span> <span id="L404" class="LineNr">404 </span> <span class="Normal">int</span> screen_data_location = <a href='042name.cc.html#L148'>find_element_location</a><span class="Delimiter">(</span>screen_location<span class="Delimiter">,</span> <span class="Constant">"data"</span><span class="Delimiter">,</span> screen<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">"check_screen"</span><span class="Delimiter">);</span> <span class="Comment">// type: address:array:character</span> <span id="L405" class="LineNr">405 </span> assert<span class="Delimiter">(</span>screen_data_location >= <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L406" class="LineNr">406 </span><span class="CommentedCode">//? cerr << "screen data is at location " << screen_data_location << '\n';</span> -<span id="L407" class="LineNr">407 </span> <span class="Normal">int</span> screen_data_start = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_data_location+<span class="Comment">/*</span><span class="Comment">skip <a href='043space.cc.html#L101'>address</a> alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip payload alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// type: array:character</span> +<span id="L407" class="LineNr">407 </span> <span class="Normal">int</span> screen_data_start = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> screen_data_location+<span class="Comment">/*</span><span class="Comment">skip <a href='043space.cc.html#L101'>address</a> alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">)</span> + <span class="Comment">/*</span><span class="Comment">skip payload alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span class="Comment">// type: array:character</span> <span id="L408" class="LineNr">408 </span><span class="CommentedCode">//? cerr << "screen data start is at " << screen_data_start << '\n';</span> <span id="L409" class="LineNr">409 </span> <span class="Normal">int</span> screen_width_location = <a href='042name.cc.html#L148'>find_element_location</a><span class="Delimiter">(</span>screen_location<span class="Delimiter">,</span> <span class="Constant">"num-columns"</span><span class="Delimiter">,</span> screen<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">"check_screen"</span><span class="Delimiter">);</span> <span id="L410" class="LineNr">410 </span><span class="CommentedCode">//? cerr << "screen width is at location " << screen_width_location << '\n';</span> -<span id="L411" class="LineNr">411 </span> <span class="Normal">int</span> screen_width = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_width_location<span class="Delimiter">);</span> +<span id="L411" class="LineNr">411 </span> <span class="Normal">int</span> screen_width = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> screen_width_location<span class="Delimiter">);</span> <span id="L412" class="LineNr">412 </span><span class="CommentedCode">//? cerr << "screen width: " << screen_width << '\n';</span> <span id="L413" class="LineNr">413 </span> <span class="Normal">int</span> screen_height_location = <a href='042name.cc.html#L148'>find_element_location</a><span class="Delimiter">(</span>screen_location<span class="Delimiter">,</span> <span class="Constant">"num-rows"</span><span class="Delimiter">,</span> screen<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">"check_screen"</span><span class="Delimiter">);</span> <span id="L414" class="LineNr">414 </span><span class="CommentedCode">//? cerr << "screen height is at location " << screen_height_location << '\n';</span> -<span id="L415" class="LineNr">415 </span> <span class="Normal">int</span> screen_height = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> screen_height_location<span class="Delimiter">);</span> +<span id="L415" class="LineNr">415 </span> <span class="Normal">int</span> screen_height = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> screen_height_location<span class="Delimiter">);</span> <span id="L416" class="LineNr">416 </span><span class="CommentedCode">//? cerr << "screen height: " << screen_height << '\n';</span> <span id="L417" class="LineNr">417 </span> <span class="Normal">int</span> top_index_location= <a href='042name.cc.html#L148'>find_element_location</a><span class="Delimiter">(</span>screen_location<span class="Delimiter">,</span> <span class="Constant">"top-idx"</span><span class="Delimiter">,</span> screen<span class="Delimiter">.</span>type<span class="Delimiter">,</span> <span class="Constant">"check_screen"</span><span class="Delimiter">);</span> <span id="L418" class="LineNr">418 </span><span class="CommentedCode">//? cerr << "top of screen is at location " << top_index_location << '\n';</span> -<span id="L419" class="LineNr">419 </span> <span class="Normal">int</span> top_index = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> top_index_location<span class="Delimiter">);</span> +<span id="L419" class="LineNr">419 </span> <span class="Normal">int</span> top_index = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> top_index_location<span class="Delimiter">);</span> <span id="L420" class="LineNr">420 </span><span class="CommentedCode">//? cerr << "top of screen is index " << top_index << '\n';</span> <span id="L421" class="LineNr">421 </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> row=top_index/screen_width<span class="Delimiter">;</span> i < screen_height<span class="Delimiter">;</span> ++i<span class="Delimiter">,</span> row=<span class="Delimiter">(</span>row+<span class="Constant">1</span><span class="Delimiter">)</span>%screen_height<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L422" class="LineNr">422 </span> cerr << <span class="Constant">'.'</span><span class="Delimiter">;</span> <span id="L423" class="LineNr">423 </span> <span class="Normal">int</span> curr = screen_data_start+<span class="Comment">/*</span><span class="Comment">length</span><span class="Comment">*/</span><span class="Constant">1</span>+row*screen_width* <span class="Comment">/*</span><span class="Comment">size of screen-cell</span><span class="Comment">*/</span><span class="Constant">2</span><span class="Delimiter">;</span> <span id="L424" class="LineNr">424 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> col = <span class="Constant">0</span><span class="Delimiter">;</span> col < screen_width<span class="Delimiter">;</span> ++col<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L425" class="LineNr">425 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">))</span> -<span id="L426" class="LineNr">426 </span> cerr << to_unicode<span class="Delimiter">(</span><span class="Normal">static_cast</span><<span class="Normal">uint32_t</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)));</span> +<span id="L425" class="LineNr">425 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr<span class="Delimiter">))</span> +<span id="L426" class="LineNr">426 </span> cerr << to_unicode<span class="Delimiter">(</span><span class="Normal">static_cast</span><<span class="Normal">uint32_t</span>><span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr<span class="Delimiter">)));</span> <span id="L427" class="LineNr">427 </span> <span class="Normal">else</span> <span id="L428" class="LineNr">428 </span> cerr << <span class="Constant">' '</span><span class="Delimiter">;</span> <span id="L429" class="LineNr">429 </span> curr += <span class="Comment">/*</span><span class="Comment">size of screen-cell</span><span class="Comment">*/</span><span class="Constant">2</span><span class="Delimiter">;</span> <span id="L430" class="LineNr">430 </span> <span class="Delimiter">}</span> -<span id="L431" class="LineNr">431 </span> cerr << <span class="Constant">".</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L431" class="LineNr">431 </span> cerr << <span class="Constant">".\n"</span><span class="Delimiter">;</span> <span id="L432" class="LineNr">432 </span> <span class="Delimiter">}</span> <span id="L433" class="LineNr">433 </span><span class="Delimiter">}</span> </pre> diff --git a/html/083scenario_screen_test.mu.html b/html/083scenario_screen_test.mu.html index e28c3a8f..086a28e6 100644 --- a/html/083scenario_screen_test.mu.html +++ b/html/083scenario_screen_test.mu.html @@ -11,16 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -54,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/083scenario_screen_test.mu'>https://github.com/akkartik/mu/blob/master/083scenario_screen_test.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># To check our support for screens in scenarios, rewrite tests from print.mu</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/084console.mu.html b/html/084console.mu.html index 1d720076..7ceba3b2 100644 --- a/html/084console.mu.html +++ b/html/084console.mu.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -57,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/084console.mu'>https://github.com/akkartik/mu/blob/master/084console.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Wrappers around interaction primitives that take a potentially fake object</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># and are thus easier to test.</span> diff --git a/html/085scenario_console.cc.html b/html/085scenario_console.cc.html index 43eb7d4b..cb298e77 100644 --- a/html/085scenario_console.cc.html +++ b/html/085scenario_console.cc.html @@ -11,20 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Delimiter { color: #800080; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Delimiter { color:#800080; } .muScenario { color: #00af00; } -.Identifier { color: #c0a020; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.cSpecial { color: #008000; } +.Comment { color: #8080ff; } --> </style> @@ -58,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/085scenario_console.cc'>https://github.com/akkartik/mu/blob/master/085scenario_console.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Clean syntax to manipulate and check the console in scenarios.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: Instruction 'assume-console' implicitly creates a variable called</span> @@ -98,7 +100,7 @@ if ('onhashchange' in window) { <span id="L37" class="LineNr"> 37 </span><span class="Normal">extern</span> <span class="Normal">const</span> <span class="Normal">int</span> CONSOLE = next_predefined_global_for_scenarios<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">size_of(address:console)</span><span class="Comment">*/</span><span class="Constant">2</span><span class="Delimiter">);</span> <span id="L38" class="LineNr"> 38 </span><span class="Comment">//: give 'console' a fixed location in scenarios</span> <span id="L39" class="LineNr"> 39 </span><span class="Delimiter">:(before "End Special Scenario Variable Names(r)")</span> -<span id="L40" class="LineNr"> 40 </span>Name[r][<span class="Constant">"console"</span>] = CONSOLE<span class="Delimiter">;</span> +<span id="L40" class="LineNr"> 40 </span><span class="Special">Name</span>[r][<span class="Constant">"console"</span>] = CONSOLE<span class="Delimiter">;</span> <span id="L41" class="LineNr"> 41 </span><span class="Comment">//: make 'console' always a raw location in scenarios</span> <span id="L42" class="LineNr"> 42 </span><span class="Delimiter">:(before "End <a href='042name.cc.html#L172'>is_special_name</a> Special-cases")</span> <span id="L43" class="LineNr"> 43 </span><span class="Normal">if</span> <span class="Delimiter">(</span>s == <span class="Constant">"console"</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> @@ -106,7 +108,7 @@ if ('onhashchange' in window) { <span id="L45" class="LineNr"> 45 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L46" class="LineNr"> 46 </span>ASSUME_CONSOLE<span class="Delimiter">,</span> <span id="L47" class="LineNr"> 47 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L48" class="LineNr"> 48 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"assume-console"</span><span class="Delimiter">,</span> ASSUME_CONSOLE<span class="Delimiter">);</span> +<span id="L48" class="LineNr"> 48 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"assume-console"</span><span class="Delimiter">,</span> ASSUME_CONSOLE<span class="Delimiter">);</span> <span id="L49" class="LineNr"> 49 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L50" class="LineNr"> 50 </span><span class="Normal">case</span> ASSUME_CONSOLE: <span class="Delimiter">{</span> <span id="L51" class="LineNr"> 51 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -122,33 +124,33 @@ if ('onhashchange' in window) { <span id="L61" class="LineNr"> 61 </span> <span class="Normal">int</span> size = <span class="Comment">/*</span><span class="Comment">length</span><span class="Comment">*/</span><span class="Constant">1</span> + num_events*size_of_event<span class="Delimiter">();</span> <span id="L62" class="LineNr"> 62 </span> <span class="Normal">int</span> event_data_address = allocate<span class="Delimiter">(</span>size<span class="Delimiter">);</span> <span id="L63" class="LineNr"> 63 </span> <span class="Comment">// store length</span> -<span id="L64" class="LineNr"> 64 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> event_data_address+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> num_events<span class="Delimiter">);</span> +<span id="L64" class="LineNr"> 64 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> event_data_address+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> num_events<span class="Delimiter">);</span> <span id="L65" class="LineNr"> 65 </span> <span class="Normal">int</span> curr_address = event_data_address + <span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span> + <span class="Comment">/*</span><span class="Comment">skip length</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span id="L66" class="LineNr"> 66 </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#L141'>SIZE</a><span class="Delimiter">(</span>r<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L67" class="LineNr"> 67 </span> <span class="Normal">const</span> instruction& inst = r<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L68" class="LineNr"> 68 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name == <span class="Constant">"left-click"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L69" class="LineNr"> 69 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing 'left-click' event starting at "</span> << Current_routine<span class="Delimiter">-></span>alloc << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L70" class="LineNr"> 70 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">tag for 'touch-event' variant of 'event' exclusive-container</span><span class="Comment">*/</span><span class="Constant">2</span><span class="Delimiter">);</span> -<span id="L71" class="LineNr"> 71 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address+<span class="Comment">/*</span><span class="Comment">skip tag</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">offset of 'type' in 'mouse-event'</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">,</span> TB_KEY_MOUSE_LEFT<span class="Delimiter">);</span> -<span id="L72" class="LineNr"> 72 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address+<span class="Comment">/*</span><span class="Comment">skip tag</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">offset of 'row' in 'mouse-event'</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> to_integer<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>name<span class="Delimiter">));</span> -<span id="L73" class="LineNr"> 73 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address+<span class="Comment">/*</span><span class="Comment">skip tag</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">offset of 'column' in 'mouse-event'</span><span class="Comment">*/</span><span class="Constant">2</span><span class="Delimiter">,</span> to_integer<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>name<span class="Delimiter">));</span> +<span id="L69" class="LineNr"> 69 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing 'left-click' event starting at "</span> << <span class="Special">Current_routine</span><span class="Delimiter">-></span>alloc << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L70" class="LineNr"> 70 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr_address<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">tag for 'touch-event' variant of 'event' exclusive-container</span><span class="Comment">*/</span><span class="Constant">2</span><span class="Delimiter">);</span> +<span id="L71" class="LineNr"> 71 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr_address+<span class="Comment">/*</span><span class="Comment">skip tag</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">offset of 'type' in 'mouse-event'</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">,</span> TB_KEY_MOUSE_LEFT<span class="Delimiter">);</span> +<span id="L72" class="LineNr"> 72 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr_address+<span class="Comment">/*</span><span class="Comment">skip tag</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">offset of 'row' in 'mouse-event'</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> to_integer<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>name<span class="Delimiter">));</span> +<span id="L73" class="LineNr"> 73 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr_address+<span class="Comment">/*</span><span class="Comment">skip tag</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">offset of 'column' in 'mouse-event'</span><span class="Comment">*/</span><span class="Constant">2</span><span class="Delimiter">,</span> to_integer<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>name<span class="Delimiter">));</span> <span id="L74" class="LineNr"> 74 </span> curr_address += <a href='085scenario_console.cc.html#L292'>size_of_event</a><span class="Delimiter">();</span> <span id="L75" class="LineNr"> 75 </span> <span class="Delimiter">}</span> <span id="L76" class="LineNr"> 76 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name == <span class="Constant">"press"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L77" class="LineNr"> 77 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing 'press' event starting at "</span> << curr_address << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L78" class="LineNr"> 78 </span> string key = inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name<span class="Delimiter">;</span> <span id="L79" class="LineNr"> 79 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_integer<span class="Delimiter">(</span>key<span class="Delimiter">))</span> -<span id="L80" class="LineNr"> 80 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address+<span class="Constant">1</span><span class="Delimiter">,</span> to_integer<span class="Delimiter">(</span>key<span class="Delimiter">));</span> -<span id="L81" class="LineNr"> 81 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Key<span class="Delimiter">,</span> key<span class="Delimiter">))</span> -<span id="L82" class="LineNr"> 82 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address+<span class="Constant">1</span><span class="Delimiter">,</span> Key[key]<span class="Delimiter">);</span> +<span id="L80" class="LineNr"> 80 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr_address+<span class="Constant">1</span><span class="Delimiter">,</span> to_integer<span class="Delimiter">(</span>key<span class="Delimiter">));</span> +<span id="L81" class="LineNr"> 81 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Key</span><span class="Delimiter">,</span> key<span class="Delimiter">))</span> +<span id="L82" class="LineNr"> 82 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr_address+<span class="Constant">1</span><span class="Delimiter">,</span> <span class="Special">Key</span>[key]<span class="Delimiter">);</span> <span id="L83" class="LineNr"> 83 </span> <span class="Normal">else</span> -<span id="L84" class="LineNr"> 84 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"assume-console: can't press '"</span> << key << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> -<span id="L85" class="LineNr"> 85 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address+<span class="Constant">1</span><span class="Delimiter">)</span> < <span class="Constant">256</span><span class="Delimiter">)</span> +<span id="L84" class="LineNr"> 84 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"assume-console: can't press '"</span> << key << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> +<span id="L85" class="LineNr"> 85 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr_address+<span class="Constant">1</span><span class="Delimiter">)</span> < <span class="Constant">256</span><span class="Delimiter">)</span> <span id="L86" class="LineNr"> 86 </span> <span class="Comment">// these keys are in ascii</span> -<span id="L87" class="LineNr"> 87 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">tag for 'text' variant of 'event' exclusive-container</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L87" class="LineNr"> 87 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr_address<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">tag for 'text' variant of 'event' exclusive-container</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L88" class="LineNr"> 88 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L89" class="LineNr"> 89 </span> <span class="Comment">// distinguish from unicode</span> -<span id="L90" class="LineNr"> 90 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">tag for 'keycode' variant of 'event' exclusive-container</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L90" class="LineNr"> 90 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr_address<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">tag for 'keycode' variant of 'event' exclusive-container</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L91" class="LineNr"> 91 </span> <span class="Delimiter">}</span> <span id="L92" class="LineNr"> 92 </span> curr_address += <a href='085scenario_console.cc.html#L292'>size_of_event</a><span class="Delimiter">();</span> <span id="L93" class="LineNr"> 93 </span> <span class="Delimiter">}</span> @@ -163,12 +165,12 @@ if ('onhashchange' in window) { <span id="L102" class="LineNr">102 </span> <span class="Normal">int</span> curr = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L103" class="LineNr">103 </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 < num_keyboard_events<span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L104" class="LineNr">104 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing 'text' tag at "</span> << curr_address << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L105" class="LineNr">105 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">tag for 'text' variant of 'event' exclusive-container</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L105" class="LineNr">105 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr_address<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">tag for 'text' variant of 'event' exclusive-container</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L106" class="LineNr">106 </span> <span class="Normal">uint32_t</span> curr_character<span class="Delimiter">;</span> <span id="L107" class="LineNr">107 </span> assert<span class="Delimiter">(</span>curr < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>contents<span class="Delimiter">));</span> <span id="L108" class="LineNr">108 </span> tb_utf8_char_to_unicode<span class="Delimiter">(</span>&curr_character<span class="Delimiter">,</span> &raw_contents[curr]<span class="Delimiter">);</span> <span id="L109" class="LineNr">109 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing character "</span> << curr_character << <span class="Constant">" at "</span> << curr_address+<span class="Comment">/*</span><span class="Comment">skip exclusive container tag</span><span class="Comment">*/</span><span class="Constant">1</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L110" class="LineNr">110 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr_address+<span class="Comment">/*</span><span class="Comment">skip exclusive container tag</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> curr_character<span class="Delimiter">);</span> +<span id="L110" class="LineNr">110 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr_address+<span class="Comment">/*</span><span class="Comment">skip exclusive container tag</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> curr_character<span class="Delimiter">);</span> <span id="L111" class="LineNr">111 </span> curr += tb_utf8_char_length<span class="Delimiter">(</span>raw_contents[curr]<span class="Delimiter">);</span> <span id="L112" class="LineNr">112 </span> curr_address += <a href='085scenario_console.cc.html#L292'>size_of_event</a><span class="Delimiter">();</span> <span id="L113" class="LineNr">113 </span> <span class="Delimiter">}</span> @@ -178,71 +180,71 @@ if ('onhashchange' in window) { <span id="L117" class="LineNr">117 </span> <span class="Comment">// wrap the array of events in a console object</span> <span id="L118" class="LineNr">118 </span> <span class="Normal">int</span> console_address = allocate<span class="Delimiter">(</span><a href='085scenario_console.cc.html#L302'>size_of_console</a><span class="Delimiter">());</span> <span id="L119" class="LineNr">119 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing console in "</span> << console_address << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L120" class="LineNr">120 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> CONSOLE+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> console_address<span class="Delimiter">);</span> +<span id="L120" class="LineNr">120 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> CONSOLE+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> console_address<span class="Delimiter">);</span> <span id="L121" class="LineNr">121 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing console data in "</span> << console_address+<span class="Comment">/*</span><span class="Comment">offset of 'data' in container 'events'</span><span class="Comment">*/</span><span class="Constant">1</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L122" class="LineNr">122 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> console_address+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">offset of 'data' in container 'events'</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">skip alloc id of 'data'</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> event_data_address<span class="Delimiter">);</span> +<span id="L122" class="LineNr">122 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> console_address+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">offset of 'data' in container 'events'</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">skip alloc id of 'data'</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> event_data_address<span class="Delimiter">);</span> <span id="L123" class="LineNr">123 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L124" class="LineNr">124 </span><span class="Delimiter">}</span> <span id="L125" class="LineNr">125 </span> <span id="L126" class="LineNr">126 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L127" class="LineNr">127 </span>map<string<span class="Delimiter">,</span> <span class="Normal">int</span>> Key<span class="Delimiter">;</span> +<span id="L127" class="LineNr">127 </span>map<string<span class="Delimiter">,</span> <span class="Normal">int</span>> <span class="Special">Key</span><span class="Delimiter">;</span> <span id="L128" class="LineNr">128 </span><span class="Delimiter">:(before "End One-time Setup")</span> <span id="L129" class="LineNr">129 </span><a href='085scenario_console.cc.html#L131'>initialize_key_names</a><span class="Delimiter">();</span> <span id="L130" class="LineNr">130 </span><span class="Delimiter">:(code)</span> <span id="L131" class="LineNr">131 </span><span class="Normal">void</span> <a href='085scenario_console.cc.html#L131'>initialize_key_names</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L132" class="LineNr">132 </span> Key[<span class="Constant">"F1"</span>] = TB_KEY_F1<span class="Delimiter">;</span> -<span id="L133" class="LineNr">133 </span> Key[<span class="Constant">"F2"</span>] = TB_KEY_F2<span class="Delimiter">;</span> -<span id="L134" class="LineNr">134 </span> Key[<span class="Constant">"F3"</span>] = TB_KEY_F3<span class="Delimiter">;</span> -<span id="L135" class="LineNr">135 </span> Key[<span class="Constant">"F4"</span>] = TB_KEY_F4<span class="Delimiter">;</span> -<span id="L136" class="LineNr">136 </span> Key[<span class="Constant">"F5"</span>] = TB_KEY_F5<span class="Delimiter">;</span> -<span id="L137" class="LineNr">137 </span> Key[<span class="Constant">"F6"</span>] = TB_KEY_F6<span class="Delimiter">;</span> -<span id="L138" class="LineNr">138 </span> Key[<span class="Constant">"F7"</span>] = TB_KEY_F7<span class="Delimiter">;</span> -<span id="L139" class="LineNr">139 </span> Key[<span class="Constant">"F8"</span>] = TB_KEY_F8<span class="Delimiter">;</span> -<span id="L140" class="LineNr">140 </span> Key[<span class="Constant">"F9"</span>] = TB_KEY_F9<span class="Delimiter">;</span> -<span id="L141" class="LineNr">141 </span> Key[<span class="Constant">"F10"</span>] = TB_KEY_F10<span class="Delimiter">;</span> -<span id="L142" class="LineNr">142 </span> Key[<span class="Constant">"F11"</span>] = TB_KEY_F11<span class="Delimiter">;</span> -<span id="L143" class="LineNr">143 </span> Key[<span class="Constant">"F12"</span>] = TB_KEY_F12<span class="Delimiter">;</span> -<span id="L144" class="LineNr">144 </span> Key[<span class="Constant">"insert"</span>] = TB_KEY_INSERT<span class="Delimiter">;</span> -<span id="L145" class="LineNr">145 </span> Key[<span class="Constant">"delete"</span>] = TB_KEY_DELETE<span class="Delimiter">;</span> -<span id="L146" class="LineNr">146 </span> Key[<span class="Constant">"home"</span>] = TB_KEY_HOME<span class="Delimiter">;</span> -<span id="L147" class="LineNr">147 </span> Key[<span class="Constant">"end"</span>] = TB_KEY_END<span class="Delimiter">;</span> -<span id="L148" class="LineNr">148 </span> Key[<span class="Constant">"page-up"</span>] = TB_KEY_PGUP<span class="Delimiter">;</span> -<span id="L149" class="LineNr">149 </span> Key[<span class="Constant">"page-down"</span>] = TB_KEY_PGDN<span class="Delimiter">;</span> -<span id="L150" class="LineNr">150 </span> Key[<span class="Constant">"up-arrow"</span>] = TB_KEY_ARROW_UP<span class="Delimiter">;</span> -<span id="L151" class="LineNr">151 </span> Key[<span class="Constant">"down-arrow"</span>] = TB_KEY_ARROW_DOWN<span class="Delimiter">;</span> -<span id="L152" class="LineNr">152 </span> Key[<span class="Constant">"left-arrow"</span>] = TB_KEY_ARROW_LEFT<span class="Delimiter">;</span> -<span id="L153" class="LineNr">153 </span> Key[<span class="Constant">"right-arrow"</span>] = TB_KEY_ARROW_RIGHT<span class="Delimiter">;</span> -<span id="L154" class="LineNr">154 </span> Key[<span class="Constant">"ctrl-a"</span>] = TB_KEY_CTRL_A<span class="Delimiter">;</span> -<span id="L155" class="LineNr">155 </span> Key[<span class="Constant">"ctrl-b"</span>] = TB_KEY_CTRL_B<span class="Delimiter">;</span> -<span id="L156" class="LineNr">156 </span> Key[<span class="Constant">"ctrl-c"</span>] = TB_KEY_CTRL_C<span class="Delimiter">;</span> -<span id="L157" class="LineNr">157 </span> Key[<span class="Constant">"ctrl-d"</span>] = TB_KEY_CTRL_D<span class="Delimiter">;</span> -<span id="L158" class="LineNr">158 </span> Key[<span class="Constant">"ctrl-e"</span>] = TB_KEY_CTRL_E<span class="Delimiter">;</span> -<span id="L159" class="LineNr">159 </span> Key[<span class="Constant">"ctrl-f"</span>] = TB_KEY_CTRL_F<span class="Delimiter">;</span> -<span id="L160" class="LineNr">160 </span> Key[<span class="Constant">"ctrl-g"</span>] = TB_KEY_CTRL_G<span class="Delimiter">;</span> -<span id="L161" class="LineNr">161 </span> Key[<span class="Constant">"backspace"</span>] = TB_KEY_BACKSPACE<span class="Delimiter">;</span> -<span id="L162" class="LineNr">162 </span> Key[<span class="Constant">"ctrl-h"</span>] = TB_KEY_CTRL_H<span class="Delimiter">;</span> -<span id="L163" class="LineNr">163 </span> Key[<span class="Constant">"tab"</span>] = TB_KEY_TAB<span class="Delimiter">;</span> -<span id="L164" class="LineNr">164 </span> Key[<span class="Constant">"ctrl-i"</span>] = TB_KEY_CTRL_I<span class="Delimiter">;</span> -<span id="L165" class="LineNr">165 </span> Key[<span class="Constant">"ctrl-j"</span>] = TB_KEY_CTRL_J<span class="Delimiter">;</span> -<span id="L166" class="LineNr">166 </span> Key[<span class="Constant">"enter"</span>] = TB_KEY_NEWLINE<span class="Delimiter">;</span> <span class="Comment">// ignore CR/LF distinction; there is only 'enter'</span> -<span id="L167" class="LineNr">167 </span> Key[<span class="Constant">"ctrl-k"</span>] = TB_KEY_CTRL_K<span class="Delimiter">;</span> -<span id="L168" class="LineNr">168 </span> Key[<span class="Constant">"ctrl-l"</span>] = TB_KEY_CTRL_L<span class="Delimiter">;</span> -<span id="L169" class="LineNr">169 </span> Key[<span class="Constant">"ctrl-m"</span>] = TB_KEY_CTRL_M<span class="Delimiter">;</span> -<span id="L170" class="LineNr">170 </span> Key[<span class="Constant">"ctrl-n"</span>] = TB_KEY_CTRL_N<span class="Delimiter">;</span> -<span id="L171" class="LineNr">171 </span> Key[<span class="Constant">"ctrl-o"</span>] = TB_KEY_CTRL_O<span class="Delimiter">;</span> -<span id="L172" class="LineNr">172 </span> Key[<span class="Constant">"ctrl-p"</span>] = TB_KEY_CTRL_P<span class="Delimiter">;</span> -<span id="L173" class="LineNr">173 </span> Key[<span class="Constant">"ctrl-q"</span>] = TB_KEY_CTRL_Q<span class="Delimiter">;</span> -<span id="L174" class="LineNr">174 </span> Key[<span class="Constant">"ctrl-r"</span>] = TB_KEY_CTRL_R<span class="Delimiter">;</span> -<span id="L175" class="LineNr">175 </span> Key[<span class="Constant">"ctrl-s"</span>] = TB_KEY_CTRL_S<span class="Delimiter">;</span> -<span id="L176" class="LineNr">176 </span> Key[<span class="Constant">"ctrl-t"</span>] = TB_KEY_CTRL_T<span class="Delimiter">;</span> -<span id="L177" class="LineNr">177 </span> Key[<span class="Constant">"ctrl-u"</span>] = TB_KEY_CTRL_U<span class="Delimiter">;</span> -<span id="L178" class="LineNr">178 </span> Key[<span class="Constant">"ctrl-v"</span>] = TB_KEY_CTRL_V<span class="Delimiter">;</span> -<span id="L179" class="LineNr">179 </span> Key[<span class="Constant">"ctrl-w"</span>] = TB_KEY_CTRL_W<span class="Delimiter">;</span> -<span id="L180" class="LineNr">180 </span> Key[<span class="Constant">"ctrl-x"</span>] = TB_KEY_CTRL_X<span class="Delimiter">;</span> -<span id="L181" class="LineNr">181 </span> Key[<span class="Constant">"ctrl-y"</span>] = TB_KEY_CTRL_Y<span class="Delimiter">;</span> -<span id="L182" class="LineNr">182 </span> Key[<span class="Constant">"ctrl-z"</span>] = TB_KEY_CTRL_Z<span class="Delimiter">;</span> -<span id="L183" class="LineNr">183 </span> Key[<span class="Constant">"escape"</span>] = TB_KEY_ESC<span class="Delimiter">;</span> -<span id="L184" class="LineNr">184 </span> Key[<span class="Constant">"ctrl-slash"</span>] = TB_KEY_CTRL_SLASH<span class="Delimiter">;</span> +<span id="L132" class="LineNr">132 </span> <span class="Special">Key</span>[<span class="Constant">"F1"</span>] = TB_KEY_F1<span class="Delimiter">;</span> +<span id="L133" class="LineNr">133 </span> <span class="Special">Key</span>[<span class="Constant">"F2"</span>] = TB_KEY_F2<span class="Delimiter">;</span> +<span id="L134" class="LineNr">134 </span> <span class="Special">Key</span>[<span class="Constant">"F3"</span>] = TB_KEY_F3<span class="Delimiter">;</span> +<span id="L135" class="LineNr">135 </span> <span class="Special">Key</span>[<span class="Constant">"F4"</span>] = TB_KEY_F4<span class="Delimiter">;</span> +<span id="L136" class="LineNr">136 </span> <span class="Special">Key</span>[<span class="Constant">"F5"</span>] = TB_KEY_F5<span class="Delimiter">;</span> +<span id="L137" class="LineNr">137 </span> <span class="Special">Key</span>[<span class="Constant">"F6"</span>] = TB_KEY_F6<span class="Delimiter">;</span> +<span id="L138" class="LineNr">138 </span> <span class="Special">Key</span>[<span class="Constant">"F7"</span>] = TB_KEY_F7<span class="Delimiter">;</span> +<span id="L139" class="LineNr">139 </span> <span class="Special">Key</span>[<span class="Constant">"F8"</span>] = TB_KEY_F8<span class="Delimiter">;</span> +<span id="L140" class="LineNr">140 </span> <span class="Special">Key</span>[<span class="Constant">"F9"</span>] = TB_KEY_F9<span class="Delimiter">;</span> +<span id="L141" class="LineNr">141 </span> <span class="Special">Key</span>[<span class="Constant">"F10"</span>] = TB_KEY_F10<span class="Delimiter">;</span> +<span id="L142" class="LineNr">142 </span> <span class="Special">Key</span>[<span class="Constant">"F11"</span>] = TB_KEY_F11<span class="Delimiter">;</span> +<span id="L143" class="LineNr">143 </span> <span class="Special">Key</span>[<span class="Constant">"F12"</span>] = TB_KEY_F12<span class="Delimiter">;</span> +<span id="L144" class="LineNr">144 </span> <span class="Special">Key</span>[<span class="Constant">"insert"</span>] = TB_KEY_INSERT<span class="Delimiter">;</span> +<span id="L145" class="LineNr">145 </span> <span class="Special">Key</span>[<span class="Constant">"delete"</span>] = TB_KEY_DELETE<span class="Delimiter">;</span> +<span id="L146" class="LineNr">146 </span> <span class="Special">Key</span>[<span class="Constant">"home"</span>] = TB_KEY_HOME<span class="Delimiter">;</span> +<span id="L147" class="LineNr">147 </span> <span class="Special">Key</span>[<span class="Constant">"end"</span>] = TB_KEY_END<span class="Delimiter">;</span> +<span id="L148" class="LineNr">148 </span> <span class="Special">Key</span>[<span class="Constant">"page-up"</span>] = TB_KEY_PGUP<span class="Delimiter">;</span> +<span id="L149" class="LineNr">149 </span> <span class="Special">Key</span>[<span class="Constant">"page-down"</span>] = TB_KEY_PGDN<span class="Delimiter">;</span> +<span id="L150" class="LineNr">150 </span> <span class="Special">Key</span>[<span class="Constant">"up-arrow"</span>] = TB_KEY_ARROW_UP<span class="Delimiter">;</span> +<span id="L151" class="LineNr">151 </span> <span class="Special">Key</span>[<span class="Constant">"down-arrow"</span>] = TB_KEY_ARROW_DOWN<span class="Delimiter">;</span> +<span id="L152" class="LineNr">152 </span> <span class="Special">Key</span>[<span class="Constant">"left-arrow"</span>] = TB_KEY_ARROW_LEFT<span class="Delimiter">;</span> +<span id="L153" class="LineNr">153 </span> <span class="Special">Key</span>[<span class="Constant">"right-arrow"</span>] = TB_KEY_ARROW_RIGHT<span class="Delimiter">;</span> +<span id="L154" class="LineNr">154 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-a"</span>] = TB_KEY_CTRL_A<span class="Delimiter">;</span> +<span id="L155" class="LineNr">155 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-b"</span>] = TB_KEY_CTRL_B<span class="Delimiter">;</span> +<span id="L156" class="LineNr">156 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-c"</span>] = TB_KEY_CTRL_C<span class="Delimiter">;</span> +<span id="L157" class="LineNr">157 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-d"</span>] = TB_KEY_CTRL_D<span class="Delimiter">;</span> +<span id="L158" class="LineNr">158 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-e"</span>] = TB_KEY_CTRL_E<span class="Delimiter">;</span> +<span id="L159" class="LineNr">159 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-f"</span>] = TB_KEY_CTRL_F<span class="Delimiter">;</span> +<span id="L160" class="LineNr">160 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-g"</span>] = TB_KEY_CTRL_G<span class="Delimiter">;</span> +<span id="L161" class="LineNr">161 </span> <span class="Special">Key</span>[<span class="Constant">"backspace"</span>] = TB_KEY_BACKSPACE<span class="Delimiter">;</span> +<span id="L162" class="LineNr">162 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-h"</span>] = TB_KEY_CTRL_H<span class="Delimiter">;</span> +<span id="L163" class="LineNr">163 </span> <span class="Special">Key</span>[<span class="Constant">"tab"</span>] = TB_KEY_TAB<span class="Delimiter">;</span> +<span id="L164" class="LineNr">164 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-i"</span>] = TB_KEY_CTRL_I<span class="Delimiter">;</span> +<span id="L165" class="LineNr">165 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-j"</span>] = TB_KEY_CTRL_J<span class="Delimiter">;</span> +<span id="L166" class="LineNr">166 </span> <span class="Special">Key</span>[<span class="Constant">"enter"</span>] = TB_KEY_NEWLINE<span class="Delimiter">;</span> <span class="Comment">// ignore CR/LF distinction; there is only 'enter'</span> +<span id="L167" class="LineNr">167 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-k"</span>] = TB_KEY_CTRL_K<span class="Delimiter">;</span> +<span id="L168" class="LineNr">168 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-l"</span>] = TB_KEY_CTRL_L<span class="Delimiter">;</span> +<span id="L169" class="LineNr">169 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-m"</span>] = TB_KEY_CTRL_M<span class="Delimiter">;</span> +<span id="L170" class="LineNr">170 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-n"</span>] = TB_KEY_CTRL_N<span class="Delimiter">;</span> +<span id="L171" class="LineNr">171 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-o"</span>] = TB_KEY_CTRL_O<span class="Delimiter">;</span> +<span id="L172" class="LineNr">172 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-p"</span>] = TB_KEY_CTRL_P<span class="Delimiter">;</span> +<span id="L173" class="LineNr">173 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-q"</span>] = TB_KEY_CTRL_Q<span class="Delimiter">;</span> +<span id="L174" class="LineNr">174 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-r"</span>] = TB_KEY_CTRL_R<span class="Delimiter">;</span> +<span id="L175" class="LineNr">175 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-s"</span>] = TB_KEY_CTRL_S<span class="Delimiter">;</span> +<span id="L176" class="LineNr">176 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-t"</span>] = TB_KEY_CTRL_T<span class="Delimiter">;</span> +<span id="L177" class="LineNr">177 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-u"</span>] = TB_KEY_CTRL_U<span class="Delimiter">;</span> +<span id="L178" class="LineNr">178 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-v"</span>] = TB_KEY_CTRL_V<span class="Delimiter">;</span> +<span id="L179" class="LineNr">179 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-w"</span>] = TB_KEY_CTRL_W<span class="Delimiter">;</span> +<span id="L180" class="LineNr">180 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-x"</span>] = TB_KEY_CTRL_X<span class="Delimiter">;</span> +<span id="L181" class="LineNr">181 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-y"</span>] = TB_KEY_CTRL_Y<span class="Delimiter">;</span> +<span id="L182" class="LineNr">182 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-z"</span>] = TB_KEY_CTRL_Z<span class="Delimiter">;</span> +<span id="L183" class="LineNr">183 </span> <span class="Special">Key</span>[<span class="Constant">"escape"</span>] = TB_KEY_ESC<span class="Delimiter">;</span> +<span id="L184" class="LineNr">184 </span> <span class="Special">Key</span>[<span class="Constant">"ctrl-slash"</span>] = TB_KEY_CTRL_SLASH<span class="Delimiter">;</span> <span id="L185" class="LineNr">185 </span><span class="Delimiter">}</span> <span id="L186" class="LineNr">186 </span> <span id="L187" class="LineNr">187 </span><span class="Delimiter">:(after "Begin check_or_set_invalid_types(r)")</span> @@ -313,7 +315,7 @@ if ('onhashchange' in window) { <span id="L252" class="LineNr">252 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L253" class="LineNr">253 </span>REPLACE_IN_CONSOLE<span class="Delimiter">,</span> <span id="L254" class="LineNr">254 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L255" class="LineNr">255 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"replace-in-console"</span><span class="Delimiter">,</span> REPLACE_IN_CONSOLE<span class="Delimiter">);</span> +<span id="L255" class="LineNr">255 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"replace-in-console"</span><span class="Delimiter">,</span> REPLACE_IN_CONSOLE<span class="Delimiter">);</span> <span id="L256" class="LineNr">256 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L257" class="LineNr">257 </span><span class="Normal">case</span> REPLACE_IN_CONSOLE: <span class="Delimiter">{</span> <span id="L258" class="LineNr">258 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -321,18 +323,18 @@ if ('onhashchange' in window) { <span id="L260" class="LineNr">260 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L261" class="LineNr">261 </span><span class="Normal">case</span> REPLACE_IN_CONSOLE: <span class="Delimiter">{</span> <span id="L262" class="LineNr">262 </span> assert<span class="Delimiter">(</span>scalar<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)));</span> -<span id="L263" class="LineNr">263 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!get_or_insert<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> CONSOLE<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L264" class="LineNr">264 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"console not initialized</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L263" class="LineNr">263 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!get_or_insert<span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> CONSOLE<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L264" class="LineNr">264 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"console not initialized\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L265" class="LineNr">265 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L266" class="LineNr">266 </span> <span class="Delimiter">}</span> -<span id="L267" class="LineNr">267 </span> <span class="Normal">int</span> console_address = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> CONSOLE<span class="Delimiter">);</span> -<span id="L268" class="LineNr">268 </span> <span class="Normal">int</span> console_data = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> console_address+<span class="Constant">1</span><span class="Delimiter">);</span> -<span id="L269" class="LineNr">269 </span> <span class="Normal">int</span> length = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> console_data<span class="Delimiter">);</span> <span class="Comment">// array length</span> +<span id="L267" class="LineNr">267 </span> <span class="Normal">int</span> console_address = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> CONSOLE<span class="Delimiter">);</span> +<span id="L268" class="LineNr">268 </span> <span class="Normal">int</span> console_data = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> console_address+<span class="Constant">1</span><span class="Delimiter">);</span> +<span id="L269" class="LineNr">269 </span> <span class="Normal">int</span> length = <a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> console_data<span class="Delimiter">);</span> <span class="Comment">// array length</span> <span id="L270" class="LineNr">270 </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> curr = console_data+<span class="Constant">1</span><span class="Delimiter">;</span> i < length<span class="Delimiter">;</span> ++i<span class="Delimiter">,</span> curr+=size_of_event<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L271" class="LineNr">271 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)</span> != <span class="Comment">/*</span><span class="Comment">text</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L272" class="LineNr">272 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr+<span class="Constant">1</span><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 class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L271" class="LineNr">271 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr<span class="Delimiter">)</span> != <span class="Comment">/*</span><span class="Comment">text</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L272" class="LineNr">272 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr+<span class="Constant">1</span><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 class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L273" class="LineNr">273 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> n = <span class="Constant">0</span><span class="Delimiter">;</span> n < <a href='085scenario_console.cc.html#L292'>size_of_event</a><span class="Delimiter">();</span> ++n<span class="Delimiter">)</span> -<span id="L274" class="LineNr">274 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr+n<span class="Delimiter">,</span> ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span>n<span class="Delimiter">));</span> +<span id="L274" class="LineNr">274 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr+n<span class="Delimiter">,</span> ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span>n<span class="Delimiter">));</span> <span id="L275" class="LineNr">275 </span> <span class="Delimiter">}</span> <span id="L276" class="LineNr">276 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L277" class="LineNr">277 </span><span class="Delimiter">}</span> @@ -364,7 +366,7 @@ if ('onhashchange' in window) { <span id="L303" class="LineNr">303 </span> <span class="Comment">// memoize result if already computed</span> <span id="L304" class="LineNr">304 </span> <span class="Normal">static</span> <span class="Normal">int</span> result = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L305" class="LineNr">305 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>result<span class="Delimiter">)</span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> -<span id="L306" class="LineNr">306 </span> assert<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"console"</span><span class="Delimiter">));</span> +<span id="L306" class="LineNr">306 </span> assert<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"console"</span><span class="Delimiter">));</span> <span id="L307" class="LineNr">307 </span> type_tree* type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span><span class="Constant">"console"</span><span class="Delimiter">);</span> <span id="L308" class="LineNr">308 </span> result = size_of<span class="Delimiter">(</span>type<span class="Delimiter">);</span> <span id="L309" class="LineNr">309 </span> <span class="Normal">delete</span> type<span class="Delimiter">;</span> diff --git a/html/086scenario_console_test.mu.html b/html/086scenario_console_test.mu.html index 95f75adb..01bc35e8 100644 --- a/html/086scenario_console_test.mu.html +++ b/html/086scenario_console_test.mu.html @@ -11,16 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -54,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/086scenario_console_test.mu'>https://github.com/akkartik/mu/blob/master/086scenario_console_test.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># To check our support for consoles in scenarios, rewrite tests from</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># scenario_console.mu</span> diff --git a/html/087file.cc.html b/html/087file.cc.html index bb5cacec..a4ed028c 100644 --- a/html/087file.cc.html +++ b/html/087file.cc.html @@ -11,17 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Identifier { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -56,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/087file.cc'>https://github.com/akkartik/mu/blob/master/087file.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Interacting with the file system.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: '$open-file-for-reading' returns a FILE* as a number (ugh)</span> @@ -71,23 +75,23 @@ if ('onhashchange' in window) { <span id="L12" class="LineNr"> 12 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L13" class="LineNr"> 13 </span>_OPEN_FILE_FOR_READING<span class="Delimiter">,</span> <span id="L14" class="LineNr"> 14 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L15" class="LineNr"> 15 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$open-file-for-reading"</span><span class="Delimiter">,</span> _OPEN_FILE_FOR_READING<span class="Delimiter">);</span> +<span id="L15" class="LineNr"> 15 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$open-file-for-reading"</span><span class="Delimiter">,</span> _OPEN_FILE_FOR_READING<span class="Delimiter">);</span> <span id="L16" class="LineNr"> 16 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L17" class="LineNr"> 17 </span><span class="Normal">case</span> _OPEN_FILE_FOR_READING: <span class="Delimiter">{</span> <span id="L18" class="LineNr"> 18 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L19" class="LineNr"> 19 </span> <a href='003trace.cc.html#L196'>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">"'$open-file-for-reading' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L19" class="LineNr"> 19 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$open-file-for-reading' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L20" class="LineNr"> 20 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L21" class="LineNr"> 21 </span> <span class="Delimiter">}</span> <span id="L22" class="LineNr"> 22 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_text<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="L23" class="LineNr"> 23 </span> <a href='003trace.cc.html#L196'>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 '$open-file-for-reading' should be a string, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L23" class="LineNr"> 23 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of '$open-file-for-reading' should be a string, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L24" class="LineNr"> 24 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L25" class="LineNr"> 25 </span> <span class="Delimiter">}</span> <span id="L26" class="LineNr"> 26 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L27" class="LineNr"> 27 </span> <a href='003trace.cc.html#L196'>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">"'$open-file-for-reading' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L27" class="LineNr"> 27 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$open-file-for-reading' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L28" class="LineNr"> 28 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L29" class="LineNr"> 29 </span> <span class="Delimiter">}</span> <span id="L30" class="LineNr"> 30 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_number<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="Delimiter">{</span> -<span id="L31" class="LineNr"> 31 </span> <a href='003trace.cc.html#L196'>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 product of '$open-file-for-reading' should be a number (file handle), but got '"</span> << to_string<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">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L31" class="LineNr"> 31 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first product of '$open-file-for-reading' should be a number (file handle), but got '"</span> << to_string<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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L32" class="LineNr"> 32 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L33" class="LineNr"> 33 </span> <span class="Delimiter">}</span> <span id="L34" class="LineNr"> 34 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -106,23 +110,23 @@ if ('onhashchange' in window) { <span id="L47" class="LineNr"> 47 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L48" class="LineNr"> 48 </span>_OPEN_FILE_FOR_WRITING<span class="Delimiter">,</span> <span id="L49" class="LineNr"> 49 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L50" class="LineNr"> 50 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$open-file-for-writing"</span><span class="Delimiter">,</span> _OPEN_FILE_FOR_WRITING<span class="Delimiter">);</span> +<span id="L50" class="LineNr"> 50 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$open-file-for-writing"</span><span class="Delimiter">,</span> _OPEN_FILE_FOR_WRITING<span class="Delimiter">);</span> <span id="L51" class="LineNr"> 51 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L52" class="LineNr"> 52 </span><span class="Normal">case</span> _OPEN_FILE_FOR_WRITING: <span class="Delimiter">{</span> <span id="L53" class="LineNr"> 53 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L54" class="LineNr"> 54 </span> <a href='003trace.cc.html#L196'>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">"'$open-file-for-writing' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L54" class="LineNr"> 54 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$open-file-for-writing' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L55" class="LineNr"> 55 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L56" class="LineNr"> 56 </span> <span class="Delimiter">}</span> <span id="L57" class="LineNr"> 57 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_text<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="L58" class="LineNr"> 58 </span> <a href='003trace.cc.html#L196'>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 '$open-file-for-writing' should be a string, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L58" class="LineNr"> 58 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of '$open-file-for-writing' should be a string, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L59" class="LineNr"> 59 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L60" class="LineNr"> 60 </span> <span class="Delimiter">}</span> <span id="L61" class="LineNr"> 61 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L62" class="LineNr"> 62 </span> <a href='003trace.cc.html#L196'>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">"'$open-file-for-writing' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L62" class="LineNr"> 62 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$open-file-for-writing' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L63" class="LineNr"> 63 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L64" class="LineNr"> 64 </span> <span class="Delimiter">}</span> <span id="L65" class="LineNr"> 65 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_number<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="Delimiter">{</span> -<span id="L66" class="LineNr"> 66 </span> <a href='003trace.cc.html#L196'>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 product of '$open-file-for-writing' should be a number (file handle), but got '"</span> << to_string<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">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L66" class="LineNr"> 66 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first product of '$open-file-for-writing' should be a number (file handle), but got '"</span> << to_string<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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L67" class="LineNr"> 67 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L68" class="LineNr"> 68 </span> <span class="Delimiter">}</span> <span id="L69" class="LineNr"> 69 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -140,27 +144,27 @@ if ('onhashchange' in window) { <span id="L81" class="LineNr"> 81 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L82" class="LineNr"> 82 </span>_READ_FROM_FILE<span class="Delimiter">,</span> <span id="L83" class="LineNr"> 83 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L84" class="LineNr"> 84 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$read-from-file"</span><span class="Delimiter">,</span> _READ_FROM_FILE<span class="Delimiter">);</span> +<span id="L84" class="LineNr"> 84 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$read-from-file"</span><span class="Delimiter">,</span> _READ_FROM_FILE<span class="Delimiter">);</span> <span id="L85" class="LineNr"> 85 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L86" class="LineNr"> 86 </span><span class="Normal">case</span> _READ_FROM_FILE: <span class="Delimiter">{</span> <span id="L87" class="LineNr"> 87 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L88" class="LineNr"> 88 </span> <a href='003trace.cc.html#L196'>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">"'$read-from-file' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L88" class="LineNr"> 88 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$read-from-file' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L89" class="LineNr"> 89 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L90" class="LineNr"> 90 </span> <span class="Delimiter">}</span> <span id="L91" class="LineNr"> 91 </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="L92" class="LineNr"> 92 </span> <a href='003trace.cc.html#L196'>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 '$read-from-file' should be a number, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L92" class="LineNr"> 92 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of '$read-from-file' should be a number, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L93" class="LineNr"> 93 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L94" class="LineNr"> 94 </span> <span class="Delimiter">}</span> <span id="L95" class="LineNr"> 95 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> != <span class="Constant">2</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L96" class="LineNr"> 96 </span> <a href='003trace.cc.html#L196'>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">"'$read-from-file' requires exactly two products, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L96" class="LineNr"> 96 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$read-from-file' requires exactly two products, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L97" class="LineNr"> 97 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L98" class="LineNr"> 98 </span> <span class="Delimiter">}</span> <span id="L99" class="LineNr"> 99 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_character<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="Delimiter">{</span> -<span id="L100" class="LineNr">100 </span> <a href='003trace.cc.html#L196'>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 product of '$read-from-file' should be a character, but got '"</span> << to_string<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">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L100" class="LineNr">100 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first product of '$read-from-file' should be a character, but got '"</span> << to_string<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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L101" class="LineNr">101 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L102" class="LineNr">102 </span> <span class="Delimiter">}</span> <span id="L103" class="LineNr">103 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_boolean<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L104" class="LineNr">104 </span> <a href='003trace.cc.html#L196'>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 product of '$read-from-file' should be a boolean, but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">))</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L104" class="LineNr">104 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second product of '$read-from-file' should be a boolean, but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">))</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L105" class="LineNr">105 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L106" class="LineNr">106 </span> <span class="Delimiter">}</span> <span id="L107" class="LineNr">107 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -170,7 +174,7 @@ if ('onhashchange' in window) { <span id="L111" class="LineNr">111 </span> <span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> x = <span class="Normal">static_cast</span><<span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span>><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="L112" class="LineNr">112 </span> <span class="Normal">FILE</span>* f = <span class="Normal">reinterpret_cast</span><<span class="Normal">FILE</span>*><span class="Delimiter">(</span>x<span class="Delimiter">);</span> <span id="L113" class="LineNr">113 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>f == <span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L114" class="LineNr">114 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"can't read from null file in '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L114" class="LineNr">114 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"can't read from null file in '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L115" class="LineNr">115 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L116" class="LineNr">116 </span> <span class="Delimiter">}</span> <span id="L117" class="LineNr">117 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span> @@ -180,7 +184,7 @@ if ('onhashchange' in window) { <span id="L121" class="LineNr">121 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L122" class="LineNr">122 </span> <span class="Delimiter">}</span> <span id="L123" class="LineNr">123 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>ferror<span class="Delimiter">(</span>f<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L124" class="LineNr">124 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"file in invalid state in '"</span> << to_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L124" class="LineNr">124 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"file in invalid state in '"</span> << to_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L125" class="LineNr">125 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L126" class="LineNr">126 </span> <span class="Delimiter">}</span> <span id="L127" class="LineNr">127 </span> <span class="Normal">char</span> c = getc<span class="Delimiter">(</span>f<span class="Delimiter">);</span> <span class="Comment">// todo: unicode</span> @@ -190,7 +194,7 @@ if ('onhashchange' in window) { <span id="L131" class="LineNr">131 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L132" class="LineNr">132 </span> <span class="Delimiter">}</span> <span id="L133" class="LineNr">133 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>ferror<span class="Delimiter">(</span>f<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L134" class="LineNr">134 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"couldn't read from file in '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L134" class="LineNr">134 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"couldn't read from file in '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L135" class="LineNr">135 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" errno: "</span> << errno << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L136" class="LineNr">136 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L137" class="LineNr">137 </span> <span class="Delimiter">}</span> @@ -204,23 +208,23 @@ if ('onhashchange' in window) { <span id="L145" class="LineNr">145 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L146" class="LineNr">146 </span>_WRITE_TO_FILE<span class="Delimiter">,</span> <span id="L147" class="LineNr">147 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L148" class="LineNr">148 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$write-to-file"</span><span class="Delimiter">,</span> _WRITE_TO_FILE<span class="Delimiter">);</span> +<span id="L148" class="LineNr">148 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$write-to-file"</span><span class="Delimiter">,</span> _WRITE_TO_FILE<span class="Delimiter">);</span> <span id="L149" class="LineNr">149 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L150" class="LineNr">150 </span><span class="Normal">case</span> _WRITE_TO_FILE: <span class="Delimiter">{</span> <span id="L151" class="LineNr">151 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L152" class="LineNr">152 </span> <a href='003trace.cc.html#L196'>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">"'$write-to-file' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L152" class="LineNr">152 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$write-to-file' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L153" class="LineNr">153 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L154" class="LineNr">154 </span> <span class="Delimiter">}</span> <span id="L155" class="LineNr">155 </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="L156" class="LineNr">156 </span> <a href='003trace.cc.html#L196'>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 '$write-to-file' should be a number, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L156" class="LineNr">156 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of '$write-to-file' should be a number, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L157" class="LineNr">157 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L158" class="LineNr">158 </span> <span class="Delimiter">}</span> <span id="L159" class="LineNr">159 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_character<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="L160" class="LineNr">160 </span> <a href='003trace.cc.html#L196'>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 '$write-to-file' should be a character, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L160" class="LineNr">160 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second ingredient of '$write-to-file' should be a character, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L161" class="LineNr">161 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L162" class="LineNr">162 </span> <span class="Delimiter">}</span> <span id="L163" class="LineNr">163 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L164" class="LineNr">164 </span> <a href='003trace.cc.html#L196'>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">"'$write-to-file' writes to no products, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L164" class="LineNr">164 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$write-to-file' writes to no products, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L165" class="LineNr">165 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L166" class="LineNr">166 </span> <span class="Delimiter">}</span> <span id="L167" class="LineNr">167 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -230,19 +234,19 @@ if ('onhashchange' in window) { <span id="L171" class="LineNr">171 </span> <span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> x = <span class="Normal">static_cast</span><<span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span>><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="L172" class="LineNr">172 </span> <span class="Normal">FILE</span>* f = <span class="Normal">reinterpret_cast</span><<span class="Normal">FILE</span>*><span class="Delimiter">(</span>x<span class="Delimiter">);</span> <span id="L173" class="LineNr">173 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>f == <span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L174" class="LineNr">174 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"can't write to null file in '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><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#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"can't write to null file in '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << end<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="Normal">if</span> <span class="Delimiter">(</span>feof<span class="Delimiter">(</span>f<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L178" class="LineNr">178 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>ferror<span class="Delimiter">(</span>f<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L179" class="LineNr">179 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"file in invalid state in '"</span> << to_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L179" class="LineNr">179 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"file in invalid state in '"</span> << to_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L180" class="LineNr">180 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L181" class="LineNr">181 </span> <span class="Delimiter">}</span> <span id="L182" class="LineNr">182 </span> <span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> y = <span class="Normal">static_cast</span><<span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span>><span class="Delimiter">(</span>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="L183" class="LineNr">183 </span> <span class="Normal">char</span> c = <span class="Normal">static_cast</span><<span class="Normal">char</span>><span class="Delimiter">(</span>y<span class="Delimiter">);</span> <span id="L184" class="LineNr">184 </span> putc<span class="Delimiter">(</span>c<span class="Delimiter">,</span> f<span class="Delimiter">);</span> <span class="Comment">// todo: unicode</span> <span id="L185" class="LineNr">185 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>ferror<span class="Delimiter">(</span>f<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L186" class="LineNr">186 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"couldn't write to file in '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L186" class="LineNr">186 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"couldn't write to file in '"</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">())</span> << <span class="Constant">"'\n"</span> << end<span class="Delimiter">();</span> <span id="L187" class="LineNr">187 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">" errno: "</span> << errno << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L188" class="LineNr">188 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L189" class="LineNr">189 </span> <span class="Delimiter">}</span> @@ -252,23 +256,23 @@ if ('onhashchange' in window) { <span id="L193" class="LineNr">193 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L194" class="LineNr">194 </span>_CLOSE_FILE<span class="Delimiter">,</span> <span id="L195" class="LineNr">195 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L196" class="LineNr">196 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$close-file"</span><span class="Delimiter">,</span> _CLOSE_FILE<span class="Delimiter">);</span> +<span id="L196" class="LineNr">196 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$close-file"</span><span class="Delimiter">,</span> _CLOSE_FILE<span class="Delimiter">);</span> <span id="L197" class="LineNr">197 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L198" class="LineNr">198 </span><span class="Normal">case</span> _CLOSE_FILE: <span class="Delimiter">{</span> <span id="L199" class="LineNr">199 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L200" class="LineNr">200 </span> <a href='003trace.cc.html#L196'>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">"'$close-file' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L200" class="LineNr">200 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$close-file' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L201" class="LineNr">201 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L202" class="LineNr">202 </span> <span class="Delimiter">}</span> <span id="L203" class="LineNr">203 </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="L204" class="LineNr">204 </span> <a href='003trace.cc.html#L196'>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 '$close-file' should be a number, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L204" class="LineNr">204 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of '$close-file' should be a number, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L205" class="LineNr">205 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L206" class="LineNr">206 </span> <span class="Delimiter">}</span> <span id="L207" class="LineNr">207 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L208" class="LineNr">208 </span> <a href='003trace.cc.html#L196'>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">"'$close-file' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L208" class="LineNr">208 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$close-file' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L209" class="LineNr">209 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L210" class="LineNr">210 </span> <span class="Delimiter">}</span> <span id="L211" class="LineNr">211 </span> <span class="Normal">if</span> <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>name != inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L212" class="LineNr">212 </span> <a href='003trace.cc.html#L196'>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">"'$close-file' requires its product to be the same as its ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L212" class="LineNr">212 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$close-file' requires its product to be the same as its ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L213" class="LineNr">213 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L214" class="LineNr">214 </span> <span class="Delimiter">}</span> <span id="L215" class="LineNr">215 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> diff --git a/html/088file.mu.html b/html/088file.mu.html index 63edd7cb..09b70b47 100644 --- a/html/088file.mu.html +++ b/html/088file.mu.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -57,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/088file.mu'>https://github.com/akkartik/mu/blob/master/088file.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Wrappers around file system primitives that take a 'resources' object and</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># are thus easier to test.</span> diff --git a/html/089scenario_filesystem.cc.html b/html/089scenario_filesystem.cc.html index 2ca58946..27a82783 100644 --- a/html/089scenario_filesystem.cc.html +++ b/html/089scenario_filesystem.cc.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.Constant { color: #00a0a0; } -.LineNr { color: #444444; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.Constant { color:#00a0a0; } +.LineNr { color:#444444; } .muScenario { color: #00af00; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -58,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/089scenario_filesystem.cc'>https://github.com/akkartik/mu/blob/master/089scenario_filesystem.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Clean syntax to manipulate and check the file system in scenarios.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: Instruction 'assume-resources' implicitly creates a variable called</span> @@ -135,7 +138,7 @@ if ('onhashchange' in window) { <span id="L74" class="LineNr"> 74 </span><span class="Normal">extern</span> <span class="Normal">const</span> <span class="Normal">int</span> RESOURCES = next_predefined_global_for_scenarios<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">size_of(address:resources)</span><span class="Comment">*/</span><span class="Constant">2</span><span class="Delimiter">);</span> <span id="L75" class="LineNr"> 75 </span><span class="Comment">//: give 'resources' a fixed location in scenarios</span> <span id="L76" class="LineNr"> 76 </span><span class="Delimiter">:(before "End Special Scenario Variable Names(r)")</span> -<span id="L77" class="LineNr"> 77 </span>Name[r][<span class="Constant">"resources"</span>] = RESOURCES<span class="Delimiter">;</span> +<span id="L77" class="LineNr"> 77 </span><span class="Special">Name</span>[r][<span class="Constant">"resources"</span>] = RESOURCES<span class="Delimiter">;</span> <span id="L78" class="LineNr"> 78 </span><span class="Comment">//: make 'resources' always a raw location in scenarios</span> <span id="L79" class="LineNr"> 79 </span><span class="Delimiter">:(before "End <a href='042name.cc.html#L172'>is_special_name</a> Special-cases")</span> <span id="L80" class="LineNr"> 80 </span><span class="Normal">if</span> <span class="Delimiter">(</span>s == <span class="Constant">"resources"</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> @@ -149,7 +152,7 @@ if ('onhashchange' in window) { <span id="L88" class="LineNr"> 88 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L89" class="LineNr"> 89 </span>ASSUME_RESOURCES<span class="Delimiter">,</span> <span id="L90" class="LineNr"> 90 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L91" class="LineNr"> 91 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"assume-resources"</span><span class="Delimiter">,</span> ASSUME_RESOURCES<span class="Delimiter">);</span> +<span id="L91" class="LineNr"> 91 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"assume-resources"</span><span class="Delimiter">,</span> ASSUME_RESOURCES<span class="Delimiter">);</span> <span id="L92" class="LineNr"> 92 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L93" class="LineNr"> 93 </span><span class="Normal">case</span> ASSUME_RESOURCES: <span class="Delimiter">{</span> <span id="L94" class="LineNr"> 94 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -178,49 +181,49 @@ if ('onhashchange' in window) { <span id="L117" class="LineNr">117 </span> string filename = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L118" class="LineNr">118 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>filename<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L119" class="LineNr">119 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L120" class="LineNr">120 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'resources' block at <a href='003trace.cc.html#L225'>end</a> of file (0)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L120" class="LineNr">120 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'resources' block at <a href='003trace.cc.html#L225'>end</a> of file (0)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L121" class="LineNr">121 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L122" class="LineNr">122 </span> <span class="Delimiter">}</span> <span id="L123" class="LineNr">123 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*filename<span class="Delimiter">.</span>begin<span class="Delimiter">()</span> != <span class="Constant">'['</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L124" class="LineNr">124 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: filename '"</span> << filename << <span class="Constant">"' must begin with a '['</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L124" class="LineNr">124 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: filename '"</span> << filename << <span class="Constant">"' must begin with a '['\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L125" class="LineNr">125 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L126" class="LineNr">126 </span> <span class="Delimiter">}</span> <span id="L127" class="LineNr">127 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*filename<span class="Delimiter">.</span>rbegin<span class="Delimiter">()</span> != <span class="Constant">']'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L128" class="LineNr">128 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: filename '"</span> << filename << <span class="Constant">"' must <a href='003trace.cc.html#L225'>end</a> with a ']'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L128" class="LineNr">128 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: filename '"</span> << filename << <span class="Constant">"' must <a href='003trace.cc.html#L225'>end</a> with a ']'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L129" class="LineNr">129 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L130" class="LineNr">130 </span> <span class="Delimiter">}</span> <span id="L131" class="LineNr">131 </span> filename<span class="Delimiter">.</span>erase<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> <span id="L132" class="LineNr">132 </span> filename<span class="Delimiter">.</span>erase<span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>filename<span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">);</span> <span id="L133" class="LineNr">133 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L134" class="LineNr">134 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: no data for filename '"</span> << filename << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L134" class="LineNr">134 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: no data for filename '"</span> << filename << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L135" class="LineNr">135 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L136" class="LineNr">136 </span> <span class="Delimiter">}</span> <span id="L137" class="LineNr">137 </span> string arrow = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L138" class="LineNr">138 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>arrow<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L139" class="LineNr">139 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L140" class="LineNr">140 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'resources' block at <a href='003trace.cc.html#L225'>end</a> of file (1)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L140" class="LineNr">140 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'resources' block at <a href='003trace.cc.html#L225'>end</a> of file (1)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L141" class="LineNr">141 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L142" class="LineNr">142 </span> <span class="Delimiter">}</span> <span id="L143" class="LineNr">143 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>arrow != <span class="Constant">"<-"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L144" class="LineNr">144 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: expected '<-' after filename '"</span> << filename << <span class="Constant">"' but got '"</span> << arrow << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L144" class="LineNr">144 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: expected '<-' after filename '"</span> << filename << <span class="Constant">"' but got '"</span> << arrow << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L145" class="LineNr">145 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L146" class="LineNr">146 </span> <span class="Delimiter">}</span> <span id="L147" class="LineNr">147 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L148" class="LineNr">148 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: no data for filename '"</span> << filename << <span class="Constant">"' after '<-'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L148" class="LineNr">148 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: no data for filename '"</span> << filename << <span class="Constant">"' after '<-'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L149" class="LineNr">149 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L150" class="LineNr">150 </span> <span class="Delimiter">}</span> <span id="L151" class="LineNr">151 </span> string contents = <a href='011load.cc.html#L169'>next_word</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L152" class="LineNr">152 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>contents<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> <span id="L153" class="LineNr">153 </span> assert<span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">));</span> -<span id="L154" class="LineNr">154 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'resources' block at <a href='003trace.cc.html#L225'>end</a> of file (2)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L154" class="LineNr">154 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"incomplete 'resources' block at <a href='003trace.cc.html#L225'>end</a> of file (2)\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L155" class="LineNr">155 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L156" class="LineNr">156 </span> <span class="Delimiter">}</span> <span id="L157" class="LineNr">157 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*contents<span class="Delimiter">.</span>begin<span class="Delimiter">()</span> != <span class="Constant">'['</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L158" class="LineNr">158 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: file contents '"</span> << contents << <span class="Constant">"' for filename '"</span> << filename << <span class="Constant">"' must begin with a '['</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L158" class="LineNr">158 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: file contents '"</span> << contents << <span class="Constant">"' for filename '"</span> << filename << <span class="Constant">"' must begin with a '['\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L159" class="LineNr">159 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L160" class="LineNr">160 </span> <span class="Delimiter">}</span> <span id="L161" class="LineNr">161 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*contents<span class="Delimiter">.</span>rbegin<span class="Delimiter">()</span> != <span class="Constant">']'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L162" class="LineNr">162 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: file contents '"</span> << contents << <span class="Constant">"' for filename '"</span> << filename << <span class="Constant">"' must <a href='003trace.cc.html#L225'>end</a> with a ']'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L162" class="LineNr">162 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: file contents '"</span> << contents << <span class="Constant">"' for filename '"</span> << filename << <span class="Constant">"' must <a href='003trace.cc.html#L225'>end</a> with a ']'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L163" class="LineNr">163 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L164" class="LineNr">164 </span> <span class="Delimiter">}</span> <span id="L165" class="LineNr">165 </span> contents<span class="Delimiter">.</span>erase<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">);</span> @@ -240,7 +243,7 @@ if ('onhashchange' in window) { <span id="L179" class="LineNr">179 </span> <a href='038new_text.cc.html#L229'>skip_whitespace</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L180" class="LineNr">180 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!has_data<span class="Delimiter">(</span>in<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L181" class="LineNr">181 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>peek<span class="Delimiter">()</span> != <span class="Constant">'|'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L182" class="LineNr">182 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: file contents for filename '"</span> << filename << <span class="Constant">"' must be delimited in '|'s</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L182" class="LineNr">182 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: file contents for filename '"</span> << filename << <span class="Constant">"' must be delimited in '|'s\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L183" class="LineNr">183 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L184" class="LineNr">184 </span> <span class="Delimiter">}</span> <span id="L185" class="LineNr">185 </span> in<span class="Delimiter">.</span>get<span class="Delimiter">();</span> <span class="Comment">// skip leading '|'</span> @@ -251,7 +254,7 @@ if ('onhashchange' in window) { <span id="L190" class="LineNr">190 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>line<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)</span> == <span class="cSpecial">'\\'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L191" class="LineNr">191 </span> ++i<span class="Delimiter">;</span> <span class="Comment">// skip</span> <span id="L192" class="LineNr">192 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>i == <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>line<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L193" class="LineNr">193 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: file contents can't end a line with '</span><span class="cSpecial">\\</span><span class="Constant">'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L193" class="LineNr">193 </span> <a href='003trace.cc.html#L196'>raise</a> << caller << <span class="Constant">": assume-resources: file contents can't end a line with '\\'\n"</span> << end<span class="Delimiter">();</span> <span id="L194" class="LineNr">194 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L195" class="LineNr">195 </span> <span class="Delimiter">}</span> <span id="L196" class="LineNr">196 </span> <span class="Delimiter">}</span> @@ -268,24 +271,24 @@ if ('onhashchange' in window) { <span id="L207" class="LineNr">207 </span> <span class="Normal">int</span> curr = resources_data_address + <span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span> + <span class="Comment">/*</span><span class="Comment">skip array length</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> <span id="L208" class="LineNr">208 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>map<string<span class="Delimiter">,</span> string>::const_iterator p = contents<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != contents<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L209" class="LineNr">209 </span> ++curr<span class="Delimiter">;</span> <span class="Comment">// skip alloc id of resource.name</span> -<span id="L210" class="LineNr">210 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">,</span> <a href='038new_text.cc.html#L39'>new_mu_text</a><span class="Delimiter">(</span>p<span class="Delimiter">-></span>first<span class="Delimiter">));</span> -<span id="L211" class="LineNr">211 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing file name "</span> << get<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)</span> << <span class="Constant">" in location "</span> << curr << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L210" class="LineNr">210 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr<span class="Delimiter">,</span> <a href='038new_text.cc.html#L39'>new_mu_text</a><span class="Delimiter">(</span>p<span class="Delimiter">-></span>first<span class="Delimiter">));</span> +<span id="L211" class="LineNr">211 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing file name "</span> << get<span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr<span class="Delimiter">)</span> << <span class="Constant">" in location "</span> << curr << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L212" class="LineNr">212 </span> ++curr<span class="Delimiter">;</span> <span id="L213" class="LineNr">213 </span> ++curr<span class="Delimiter">;</span> <span class="Comment">// skip alloc id of resource.contents</span> -<span id="L214" class="LineNr">214 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">,</span> <a href='038new_text.cc.html#L39'>new_mu_text</a><span class="Delimiter">(</span>p<span class="Delimiter">-></span>second<span class="Delimiter">));</span> -<span id="L215" class="LineNr">215 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing file contents "</span> << get<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)</span> << <span class="Constant">" in location "</span> << curr << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L214" class="LineNr">214 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr<span class="Delimiter">,</span> <a href='038new_text.cc.html#L39'>new_mu_text</a><span class="Delimiter">(</span>p<span class="Delimiter">-></span>second<span class="Delimiter">));</span> +<span id="L215" class="LineNr">215 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing file contents "</span> << get<span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr<span class="Delimiter">)</span> << <span class="Constant">" in location "</span> << curr << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L216" class="LineNr">216 </span> ++curr<span class="Delimiter">;</span> <span id="L217" class="LineNr">217 </span> <span class="Delimiter">}</span> <span id="L218" class="LineNr">218 </span> curr = resources_data_address + <span class="Comment">/*</span><span class="Comment">skip alloc id of resources.data</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L219" class="LineNr">219 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">,</span> <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>contents<span class="Delimiter">));</span> <span class="Comment">// array length</span> -<span id="L220" class="LineNr">220 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing resources size "</span> << get<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">)</span> << <span class="Constant">" in location "</span> << curr << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L219" class="LineNr">219 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr<span class="Delimiter">,</span> <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>contents<span class="Delimiter">));</span> <span class="Comment">// array length</span> +<span id="L220" class="LineNr">220 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing resources size "</span> << get<span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr<span class="Delimiter">)</span> << <span class="Constant">" in location "</span> << curr << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L221" class="LineNr">221 </span> <span class="Comment">// wrap the resources data in a 'resources' object</span> <span id="L222" class="LineNr">222 </span> <span class="Normal">int</span> resources_address = allocate<span class="Delimiter">(</span><a href='089scenario_filesystem.cc.html#L231'>size_of_resources</a><span class="Delimiter">());</span> <span id="L223" class="LineNr">223 </span> curr = resources_address+<span class="Comment">/*</span><span class="Comment">alloc id</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">offset of 'data' element</span><span class="Comment">*/</span><span class="Constant">1</span>+<span class="Comment">/*</span><span class="Comment">skip alloc id of 'data' element</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L224" class="LineNr">224 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> curr<span class="Delimiter">,</span> resources_data_address<span class="Delimiter">);</span> +<span id="L224" class="LineNr">224 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> curr<span class="Delimiter">,</span> resources_data_address<span class="Delimiter">);</span> <span id="L225" class="LineNr">225 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing resources data <a href='043space.cc.html#L101'>address</a> "</span> << resources_data_address << <span class="Constant">" in location "</span> << curr << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L226" class="LineNr">226 </span> <span class="Comment">// save in product</span> -<span id="L227" class="LineNr">227 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> RESOURCES+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> resources_address<span class="Delimiter">);</span> +<span id="L227" class="LineNr">227 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> RESOURCES+<span class="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">,</span> resources_address<span class="Delimiter">);</span> <span id="L228" class="LineNr">228 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"storing resources <a href='043space.cc.html#L101'>address</a> "</span> << resources_address << <span class="Constant">" in location "</span> << RESOURCES << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L229" class="LineNr">229 </span><span class="Delimiter">}</span> <span id="L230" class="LineNr">230 </span> @@ -293,7 +296,7 @@ if ('onhashchange' in window) { <span id="L232" class="LineNr">232 </span> <span class="Comment">// memoize result if already computed</span> <span id="L233" class="LineNr">233 </span> <span class="Normal">static</span> <span class="Normal">int</span> result = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L234" class="LineNr">234 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>result<span class="Delimiter">)</span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> -<span id="L235" class="LineNr">235 </span> assert<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"resources"</span><span class="Delimiter">));</span> +<span id="L235" class="LineNr">235 </span> assert<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Type_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"resources"</span><span class="Delimiter">));</span> <span id="L236" class="LineNr">236 </span> type_tree* type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span><span class="Constant">"resources"</span><span class="Delimiter">);</span> <span id="L237" class="LineNr">237 </span> result = size_of<span class="Delimiter">(</span>type<span class="Delimiter">);</span> <span id="L238" class="LineNr">238 </span> <span class="Normal">delete</span> type<span class="Delimiter">;</span> diff --git a/html/090scenario_filesystem_test.mu.html b/html/090scenario_filesystem_test.mu.html index 22a76dd2..40005592 100644 --- a/html/090scenario_filesystem_test.mu.html +++ b/html/090scenario_filesystem_test.mu.html @@ -11,16 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -54,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/090scenario_filesystem_test.mu'>https://github.com/akkartik/mu/blob/master/090scenario_filesystem_test.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Check our support for fake file systems in scenarios.</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/091socket.cc.html b/html/091socket.cc.html index b77476ab..f4f06882 100644 --- a/html/091socket.cc.html +++ b/html/091socket.cc.html @@ -11,18 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Identifier { color: #c0a020; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -57,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/091socket.cc'>https://github.com/akkartik/mu/blob/master/091socket.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Delimiter">:(before "End Types")</span> <span id="L2" class="LineNr"> 2 </span><span class="Normal">struct</span> socket_t <span class="Delimiter">{</span> @@ -73,27 +77,27 @@ if ('onhashchange' in window) { <span id="L13" class="LineNr"> 13 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L14" class="LineNr"> 14 </span>_OPEN_CLIENT_SOCKET<span class="Delimiter">,</span> <span id="L15" class="LineNr"> 15 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L16" class="LineNr"> 16 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$open-client-socket"</span><span class="Delimiter">,</span> _OPEN_CLIENT_SOCKET<span class="Delimiter">);</span> +<span id="L16" class="LineNr"> 16 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$open-client-socket"</span><span class="Delimiter">,</span> _OPEN_CLIENT_SOCKET<span class="Delimiter">);</span> <span id="L17" class="LineNr"> 17 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L18" class="LineNr"> 18 </span><span class="Normal">case</span> _OPEN_CLIENT_SOCKET: <span class="Delimiter">{</span> <span id="L19" class="LineNr"> 19 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L20" class="LineNr"> 20 </span> <a href='003trace.cc.html#L196'>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">"'$open-client-socket' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L20" class="LineNr"> 20 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$open-client-socket' requires exactly two ingredients, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L21" class="LineNr"> 21 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L22" class="LineNr"> 22 </span> <span class="Delimiter">}</span> <span id="L23" class="LineNr"> 23 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_text<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="L24" class="LineNr"> 24 </span> <a href='003trace.cc.html#L196'>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 '$open-client-socket' should be text (the hostname), 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L24" class="LineNr"> 24 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of '$open-client-socket' should be text (the hostname), 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L25" class="LineNr"> 25 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L26" class="LineNr"> 26 </span> <span class="Delimiter">}</span> <span id="L27" class="LineNr"> 27 </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="L28" class="LineNr"> 28 </span> <a href='003trace.cc.html#L196'>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 '$open-client-socket' should be a number (the port of the hostname to connect to), 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">1</span><span class="Delimiter">))</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L28" class="LineNr"> 28 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second ingredient of '$open-client-socket' should be a number (the port of the hostname to connect to), 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">1</span><span class="Delimiter">))</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L29" class="LineNr"> 29 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L30" class="LineNr"> 30 </span> <span class="Delimiter">}</span> <span id="L31" class="LineNr"> 31 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L32" class="LineNr"> 32 </span> <a href='003trace.cc.html#L196'>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">"'$open-client-socket' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L32" class="LineNr"> 32 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$open-client-socket' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L33" class="LineNr"> 33 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L34" class="LineNr"> 34 </span> <span class="Delimiter">}</span> <span id="L35" class="LineNr"> 35 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_number<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="Delimiter">{</span> -<span id="L36" class="LineNr"> 36 </span> <a href='003trace.cc.html#L196'>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 product of '$open-client-socket' should be a number (socket handle), but got '"</span> << to_string<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">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L36" class="LineNr"> 36 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first product of '$open-client-socket' should be a number (socket handle), but got '"</span> << to_string<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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L37" class="LineNr"> 37 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L38" class="LineNr"> 38 </span> <span class="Delimiter">}</span> <span id="L39" class="LineNr"> 39 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -118,7 +122,7 @@ if ('onhashchange' in window) { <span id="L58" class="LineNr"> 58 </span> socket_t* result = <span class="Normal">new</span> socket_t<span class="Delimiter">;</span> <span id="L59" class="LineNr"> 59 </span> result<span class="Delimiter">-></span>fd = socket<span class="Delimiter">(</span>AF_INET<span class="Delimiter">,</span> SOCK_STREAM<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L60" class="LineNr"> 60 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>result<span class="Delimiter">-></span>fd < <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L61" class="LineNr"> 61 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"Failed to create socket.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L61" class="LineNr"> 61 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"Failed to create socket.\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L62" class="LineNr"> 62 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L63" class="LineNr"> 63 </span> <span class="Delimiter">}</span> <span id="L64" class="LineNr"> 64 </span> result<span class="Delimiter">-></span>addr<span class="Delimiter">.</span>sin_family = AF_INET<span class="Delimiter">;</span> @@ -136,23 +140,23 @@ if ('onhashchange' in window) { <span id="L76" class="LineNr"> 76 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L77" class="LineNr"> 77 </span>_OPEN_SERVER_SOCKET<span class="Delimiter">,</span> <span id="L78" class="LineNr"> 78 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L79" class="LineNr"> 79 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$open-server-socket"</span><span class="Delimiter">,</span> _OPEN_SERVER_SOCKET<span class="Delimiter">);</span> +<span id="L79" class="LineNr"> 79 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$open-server-socket"</span><span class="Delimiter">,</span> _OPEN_SERVER_SOCKET<span class="Delimiter">);</span> <span id="L80" class="LineNr"> 80 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L81" class="LineNr"> 81 </span><span class="Normal">case</span> _OPEN_SERVER_SOCKET: <span class="Delimiter">{</span> <span id="L82" class="LineNr"> 82 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L83" class="LineNr"> 83 </span> <a href='003trace.cc.html#L196'>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">"'$open-server-socket' requires exactly one ingredient (the port to listen for requests on), but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L83" class="LineNr"> 83 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$open-server-socket' requires exactly one ingredient (the port to listen for requests on), but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L84" class="LineNr"> 84 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L85" class="LineNr"> 85 </span> <span class="Delimiter">}</span> <span id="L86" class="LineNr"> 86 </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="L87" class="LineNr"> 87 </span> <a href='003trace.cc.html#L196'>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 '$open-server-socket' should be a number, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L87" class="LineNr"> 87 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of '$open-server-socket' should be a number, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L88" class="LineNr"> 88 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L89" class="LineNr"> 89 </span> <span class="Delimiter">}</span> <span id="L90" class="LineNr"> 90 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L91" class="LineNr"> 91 </span> <a href='003trace.cc.html#L196'>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">"'$open-server-socket' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L91" class="LineNr"> 91 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$open-server-socket' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L92" class="LineNr"> 92 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L93" class="LineNr"> 93 </span> <span class="Delimiter">}</span> <span id="L94" class="LineNr"> 94 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_number<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="Delimiter">{</span> -<span id="L95" class="LineNr"> 95 </span> <a href='003trace.cc.html#L196'>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 product of '$open-server-socket' should be a number (file handle), but got '"</span> << to_string<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">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L95" class="LineNr"> 95 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first product of '$open-server-socket' should be a number (file handle), but got '"</span> << to_string<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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L96" class="LineNr"> 96 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L97" class="LineNr"> 97 </span> <span class="Delimiter">}</span> <span id="L98" class="LineNr"> 98 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -176,13 +180,13 @@ if ('onhashchange' in window) { <span id="L116" class="LineNr">116 </span> socket_t* result = <span class="Normal">new</span> socket_t<span class="Delimiter">;</span> <span id="L117" class="LineNr">117 </span> result<span class="Delimiter">-></span>fd = socket<span class="Delimiter">(</span>AF_INET<span class="Delimiter">,</span> SOCK_STREAM<span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L118" class="LineNr">118 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>result<span class="Delimiter">-></span>fd < <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L119" class="LineNr">119 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"Failed to create server socket.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L119" class="LineNr">119 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"Failed to create server socket.\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L120" class="LineNr">120 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L121" class="LineNr">121 </span> <span class="Delimiter">}</span> <span id="L122" class="LineNr">122 </span> <span class="Normal">int</span> dummy = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L123" class="LineNr">123 </span> setsockopt<span class="Delimiter">(</span>result<span class="Delimiter">-></span>fd<span class="Delimiter">,</span> SOL_SOCKET<span class="Delimiter">,</span> SO_REUSEADDR<span class="Delimiter">,</span> &dummy<span class="Delimiter">,</span> <span class="Normal">sizeof</span><span class="Delimiter">(</span>dummy<span class="Delimiter">));</span> <span id="L124" class="LineNr">124 </span> result<span class="Delimiter">-></span>addr<span class="Delimiter">.</span>sin_family = AF_INET<span class="Delimiter">;</span> -<span id="L125" class="LineNr">125 </span> result<span class="Delimiter">-></span>addr<span class="Delimiter">.</span>sin_addr<span class="Delimiter">.</span>s_addr = Current_scenario ? htonl<span class="Delimiter">(</span>INADDR_LOOPBACK<span class="Delimiter">)</span> : INADDR_ANY<span class="Delimiter">;</span> <span class="Comment">// run tests without running afoul of any firewall</span> +<span id="L125" class="LineNr">125 </span> result<span class="Delimiter">-></span>addr<span class="Delimiter">.</span>sin_addr<span class="Delimiter">.</span>s_addr = <span class="Special">Current_scenario</span> ? htonl<span class="Delimiter">(</span>INADDR_LOOPBACK<span class="Delimiter">)</span> : INADDR_ANY<span class="Delimiter">;</span> <span class="Comment">// run tests without running afoul of any firewall</span> <span id="L126" class="LineNr">126 </span> result<span class="Delimiter">-></span>addr<span class="Delimiter">.</span>sin_port = htons<span class="Delimiter">(</span>port<span class="Delimiter">);</span> <span id="L127" class="LineNr">127 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>bind<span class="Delimiter">(</span>result<span class="Delimiter">-></span>fd<span class="Delimiter">,</span> <span class="Normal">reinterpret_cast</span><sockaddr*><span class="Delimiter">(</span>&result<span class="Delimiter">-></span>addr<span class="Delimiter">),</span> <span class="Normal">sizeof</span><span class="Delimiter">(</span>result<span class="Delimiter">-></span>addr<span class="Delimiter">))</span> >= <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L128" class="LineNr">128 </span> listen<span class="Delimiter">(</span>result<span class="Delimiter">-></span>fd<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">queue length</span><span class="Comment">*/</span><span class="Constant">5</span><span class="Delimiter">);</span> @@ -190,7 +194,7 @@ if ('onhashchange' in window) { <span id="L130" class="LineNr">130 </span> <span class="Normal">else</span> <span class="Delimiter">{</span> <span id="L131" class="LineNr">131 </span> close<span class="Delimiter">(</span>result<span class="Delimiter">-></span>fd<span class="Delimiter">);</span> <span id="L132" class="LineNr">132 </span> result<span class="Delimiter">-></span>fd = -<span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L133" class="LineNr">133 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"Failed to bind result socket to port "</span> << port << <span class="Constant">". Something's already using that port.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> +<span id="L133" class="LineNr">133 </span> <a href='003trace.cc.html#L196'>raise</a> << <span class="Constant">"Failed to bind result socket to port "</span> << port << <span class="Constant">". Something's already using that port.\n"</span> << end<span class="Delimiter">();</span> <span id="L134" class="LineNr">134 </span> <span class="Delimiter">}</span> <span id="L135" class="LineNr">135 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L136" class="LineNr">136 </span><span class="Delimiter">}</span> @@ -198,23 +202,23 @@ if ('onhashchange' in window) { <span id="L138" class="LineNr">138 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L139" class="LineNr">139 </span>_ACCEPT<span class="Delimiter">,</span> <span id="L140" class="LineNr">140 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L141" class="LineNr">141 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$accept"</span><span class="Delimiter">,</span> _ACCEPT<span class="Delimiter">);</span> +<span id="L141" class="LineNr">141 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$accept"</span><span class="Delimiter">,</span> _ACCEPT<span class="Delimiter">);</span> <span id="L142" class="LineNr">142 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L143" class="LineNr">143 </span><span class="Normal">case</span> _ACCEPT: <span class="Delimiter">{</span> <span id="L144" class="LineNr">144 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L145" class="LineNr">145 </span> <a href='003trace.cc.html#L196'>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">"'$accept' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L145" class="LineNr">145 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$accept' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L146" class="LineNr">146 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L147" class="LineNr">147 </span> <span class="Delimiter">}</span> <span id="L148" class="LineNr">148 </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="L149" class="LineNr">149 </span> <a href='003trace.cc.html#L196'>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 '$accept' should be a number, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L149" class="LineNr">149 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of '$accept' should be a number, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L150" class="LineNr">150 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L151" class="LineNr">151 </span> <span class="Delimiter">}</span> <span id="L152" class="LineNr">152 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L153" class="LineNr">153 </span> <a href='003trace.cc.html#L196'>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">"'$accept' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L153" class="LineNr">153 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$accept' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L154" class="LineNr">154 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L155" class="LineNr">155 </span> <span class="Delimiter">}</span> <span id="L156" class="LineNr">156 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_number<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="Delimiter">{</span> -<span id="L157" class="LineNr">157 </span> <a href='003trace.cc.html#L196'>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 product of '$accept' should be a number (file handle), but got '"</span> << to_string<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">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L157" class="LineNr">157 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first product of '$accept' should be a number (file handle), but got '"</span> << to_string<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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L158" class="LineNr">158 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L159" class="LineNr">159 </span> <span class="Delimiter">}</span> <span id="L160" class="LineNr">160 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -247,36 +251,36 @@ if ('onhashchange' in window) { <span id="L187" class="LineNr">187 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L188" class="LineNr">188 </span>_READ_FROM_SOCKET<span class="Delimiter">,</span> <span id="L189" class="LineNr">189 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L190" class="LineNr">190 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$read-from-socket"</span><span class="Delimiter">,</span> _READ_FROM_SOCKET<span class="Delimiter">);</span> +<span id="L190" class="LineNr">190 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$read-from-socket"</span><span class="Delimiter">,</span> _READ_FROM_SOCKET<span class="Delimiter">);</span> <span id="L191" class="LineNr">191 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L192" class="LineNr">192 </span><span class="Normal">case</span> _READ_FROM_SOCKET: <span class="Delimiter">{</span> <span id="L193" class="LineNr">193 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L194" class="LineNr">194 </span> <a href='003trace.cc.html#L196'>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">"'$read-from-socket' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L194" class="LineNr">194 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$read-from-socket' requires exactly one ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L195" class="LineNr">195 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L196" class="LineNr">196 </span> <span class="Delimiter">}</span> <span id="L197" class="LineNr">197 </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="L198" class="LineNr">198 </span> <a href='003trace.cc.html#L196'>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 '$read-from-socket' should be a number (socket), 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L198" class="LineNr">198 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of '$read-from-socket' should be a number (socket), 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L199" class="LineNr">199 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L200" class="LineNr">200 </span> <span class="Delimiter">}</span> <span id="L201" class="LineNr">201 </span> <span class="Normal">int</span> nprod = <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">);</span> <span id="L202" class="LineNr">202 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>nprod == <span class="Constant">0</span> || nprod > <span class="Constant">4</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L203" class="LineNr">203 </span> <a href='003trace.cc.html#L196'>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">"'$read-from-socket' requires 1-4 products, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L203" class="LineNr">203 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$read-from-socket' requires 1-4 products, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L204" class="LineNr">204 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L205" class="LineNr">205 </span> <span class="Delimiter">}</span> <span id="L206" class="LineNr">206 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_character<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="Delimiter">{</span> -<span id="L207" class="LineNr">207 </span> <a href='003trace.cc.html#L196'>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 product of '$read-from-socket' should be a character, but got '"</span> << to_string<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">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L207" class="LineNr">207 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first product of '$read-from-socket' should be a character, but got '"</span> << to_string<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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L208" class="LineNr">208 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L209" class="LineNr">209 </span> <span class="Delimiter">}</span> <span id="L210" class="LineNr">210 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>nprod > <span class="Constant">1</span> && !is_mu_boolean<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L211" class="LineNr">211 </span> <a href='003trace.cc.html#L196'>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 product of '$read-from-socket' should be a boolean (data received?), but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">))</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L211" class="LineNr">211 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"second product of '$read-from-socket' should be a boolean (data received?), but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">))</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L212" class="LineNr">212 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L213" class="LineNr">213 </span> <span class="Delimiter">}</span> <span id="L214" class="LineNr">214 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>nprod > <span class="Constant">2</span> && !is_mu_boolean<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L215" class="LineNr">215 </span> <a href='003trace.cc.html#L196'>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">"third product of '$read-from-socket' should be a boolean (eof?), but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">))</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L215" class="LineNr">215 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"third product of '$read-from-socket' should be a boolean (eof?), but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">))</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L216" class="LineNr">216 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L217" class="LineNr">217 </span> <span class="Delimiter">}</span> <span id="L218" class="LineNr">218 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>nprod > <span class="Constant">3</span> && !is_mu_number<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">3</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> -<span id="L219" class="LineNr">219 </span> <a href='003trace.cc.html#L196'>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">"fourth product of '$read-from-socket' should be a number (error code), but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">3</span><span class="Delimiter">))</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L219" class="LineNr">219 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"fourth product of '$read-from-socket' should be a number (error code), but got '"</span> << to_string<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">3</span><span class="Delimiter">))</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L220" class="LineNr">220 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L221" class="LineNr">221 </span> <span class="Delimiter">}</span> <span id="L222" class="LineNr">222 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -312,7 +316,7 @@ if ('onhashchange' in window) { <span id="L252" class="LineNr">252 </span> <span class="Delimiter">}</span> <span id="L253" class="LineNr">253 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>poll_result < <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L254" class="LineNr">254 </span> <span class="Normal">int</span> error_code = errno<span class="Delimiter">;</span> -<span id="L255" class="LineNr">255 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"error in $read-from-socket</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L255" class="LineNr">255 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"error in $read-from-socket\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L256" class="LineNr">256 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">no data</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L257" class="LineNr">257 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">found</span><span class="Comment">*/</span><span class="Constant">false</span><span class="Delimiter">);</span> <span id="L258" class="LineNr">258 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">eof</span><span class="Comment">*/</span><span class="Constant">false</span><span class="Delimiter">);</span> @@ -340,11 +344,11 @@ if ('onhashchange' in window) { <span id="L280" class="LineNr">280 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L281" class="LineNr">281 </span>_WRITE_TO_SOCKET<span class="Delimiter">,</span> <span id="L282" class="LineNr">282 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L283" class="LineNr">283 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$write-to-socket"</span><span class="Delimiter">,</span> _WRITE_TO_SOCKET<span class="Delimiter">);</span> +<span id="L283" class="LineNr">283 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$write-to-socket"</span><span class="Delimiter">,</span> _WRITE_TO_SOCKET<span class="Delimiter">);</span> <span id="L284" class="LineNr">284 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L285" class="LineNr">285 </span><span class="Normal">case</span> _WRITE_TO_SOCKET: <span class="Delimiter">{</span> <span id="L286" class="LineNr">286 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L287" class="LineNr">287 </span> <a href='003trace.cc.html#L196'>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">"'$write-to-socket' requires exactly two ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L287" class="LineNr">287 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$write-to-socket' requires exactly two ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L288" class="LineNr">288 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L289" class="LineNr">289 </span> <span class="Delimiter">}</span> <span id="L290" class="LineNr">290 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -357,7 +361,7 @@ if ('onhashchange' in window) { <span id="L297" class="LineNr">297 </span> <span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span> y = <span class="Normal">static_cast</span><<span class="Normal">long</span> <span class="Normal">long</span> <span class="Normal">int</span>><span class="Delimiter">(</span>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="L298" class="LineNr">298 </span> <span class="Normal">char</span> c = <span class="Normal">static_cast</span><<span class="Normal">char</span>><span class="Delimiter">(</span>y<span class="Delimiter">);</span> <span id="L299" class="LineNr">299 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>write<span class="Delimiter">(</span>socket<span class="Delimiter">-></span>fd<span class="Delimiter">,</span> &c<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L300" class="LineNr">300 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"failed to write to socket</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L300" class="LineNr">300 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span><a href='026call.cc.html#L87'>current_recipe_name</a><span class="Delimiter">())</span> << <span class="Constant">"failed to write to socket\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L301" class="LineNr">301 </span> exit<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L302" class="LineNr">302 </span> <span class="Delimiter">}</span> <span id="L303" class="LineNr">303 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> @@ -368,23 +372,23 @@ if ('onhashchange' in window) { <span id="L308" class="LineNr">308 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L309" class="LineNr">309 </span>_CLOSE_SOCKET<span class="Delimiter">,</span> <span id="L310" class="LineNr">310 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L311" class="LineNr">311 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$close-socket"</span><span class="Delimiter">,</span> _CLOSE_SOCKET<span class="Delimiter">);</span> +<span id="L311" class="LineNr">311 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$close-socket"</span><span class="Delimiter">,</span> _CLOSE_SOCKET<span class="Delimiter">);</span> <span id="L312" class="LineNr">312 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L313" class="LineNr">313 </span><span class="Normal">case</span> _CLOSE_SOCKET: <span class="Delimiter">{</span> <span id="L314" class="LineNr">314 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L315" class="LineNr">315 </span> <a href='003trace.cc.html#L196'>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">"'$close-socket' requires exactly two ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L315" class="LineNr">315 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$close-socket' requires exactly two ingredient, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L316" class="LineNr">316 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L317" class="LineNr">317 </span> <span class="Delimiter">}</span> <span id="L318" class="LineNr">318 </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="L319" class="LineNr">319 </span> <a href='003trace.cc.html#L196'>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 '$close-socket' should be a number, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L319" class="LineNr">319 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of '$close-socket' should be a number, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L320" class="LineNr">320 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L321" class="LineNr">321 </span> <span class="Delimiter">}</span> <span id="L322" class="LineNr">322 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L323" class="LineNr">323 </span> <a href='003trace.cc.html#L196'>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">"'$close-socket' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L323" class="LineNr">323 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'$close-socket' requires exactly one product, but got '"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L324" class="LineNr">324 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L325" class="LineNr">325 </span> <span class="Delimiter">}</span> <span id="L326" class="LineNr">326 </span> <span class="Normal">if</span> <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>name != inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L327" class="LineNr">327 </span> <a href='003trace.cc.html#L196'>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">"product of '$close-socket' must be first ingredient '"</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">"', but got '"</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>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L327" class="LineNr">327 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"product of '$close-socket' must be first ingredient '"</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">"', but got '"</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>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L328" class="LineNr">328 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L329" class="LineNr">329 </span> <span class="Delimiter">}</span> <span id="L330" class="LineNr">330 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> diff --git a/html/092socket.mu.html b/html/092socket.mu.html index f6010a34..68d6be5d 100644 --- a/html/092socket.mu.html +++ b/html/092socket.mu.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -58,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/092socket.mu'>https://github.com/akkartik/mu/blob/master/092socket.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Wrappers around socket primitives that are easier to test.</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/099hardware_checks.cc.html b/html/099hardware_checks.cc.html index 0310ff92..679e4113 100644 --- a/html/099hardware_checks.cc.html +++ b/html/099hardware_checks.cc.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .traceContains { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -59,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/099hardware_checks.cc'>https://github.com/akkartik/mu/blob/master/099hardware_checks.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Let's raise errors when students use real hardware in any recipes besides</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: 'main'. Part of the goal is to teach them testing hygiene and dependency</span> @@ -67,16 +70,16 @@ if ('onhashchange' in window) { <span id="L5" class="LineNr"> 5 </span><span class="Comment">//: This is easy to sidestep, it's for feedback rather than safety.</span> <span id="L6" class="LineNr"> 6 </span> <span id="L7" class="LineNr"> 7 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L8" class="LineNr"> 8 </span>vector<type_tree*> Real_hardware_types<span class="Delimiter">;</span> +<span id="L8" class="LineNr"> 8 </span>vector<type_tree*> <span class="Special">Real_hardware_types</span><span class="Delimiter">;</span> <span id="L9" class="LineNr"> 9 </span><span class="Delimiter">:(before "Begin transform_all")</span> <span id="L10" class="LineNr">10 </span><a href='099hardware_checks.cc.html#L14'>setup_real_hardware_types</a><span class="Delimiter">();</span> <span id="L11" class="LineNr">11 </span><span class="Delimiter">:(before "End transform_all")</span> <span id="L12" class="LineNr">12 </span><a href='099hardware_checks.cc.html#L25'>teardown_real_hardware_types</a><span class="Delimiter">();</span> <span id="L13" class="LineNr">13 </span><span class="Delimiter">:(code)</span> <span id="L14" class="LineNr">14 </span><span class="Normal">void</span> <a href='099hardware_checks.cc.html#L14'>setup_real_hardware_types</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L15" class="LineNr">15 </span> Real_hardware_types<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='099hardware_checks.cc.html#L19'>parse_type</a><span class="Delimiter">(</span><span class="Constant">"address:screen"</span><span class="Delimiter">));</span> -<span id="L16" class="LineNr">16 </span> Real_hardware_types<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='099hardware_checks.cc.html#L19'>parse_type</a><span class="Delimiter">(</span><span class="Constant">"address:console"</span><span class="Delimiter">));</span> -<span id="L17" class="LineNr">17 </span> Real_hardware_types<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='099hardware_checks.cc.html#L19'>parse_type</a><span class="Delimiter">(</span><span class="Constant">"address:resources"</span><span class="Delimiter">));</span> +<span id="L15" class="LineNr">15 </span> <span class="Special">Real_hardware_types</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='099hardware_checks.cc.html#L19'>parse_type</a><span class="Delimiter">(</span><span class="Constant">"address:screen"</span><span class="Delimiter">));</span> +<span id="L16" class="LineNr">16 </span> <span class="Special">Real_hardware_types</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='099hardware_checks.cc.html#L19'>parse_type</a><span class="Delimiter">(</span><span class="Constant">"address:console"</span><span class="Delimiter">));</span> +<span id="L17" class="LineNr">17 </span> <span class="Special">Real_hardware_types</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='099hardware_checks.cc.html#L19'>parse_type</a><span class="Delimiter">(</span><span class="Constant">"address:resources"</span><span class="Delimiter">));</span> <span id="L18" class="LineNr">18 </span><span class="Delimiter">}</span> <span id="L19" class="LineNr">19 </span>type_tree* <a href='099hardware_checks.cc.html#L19'>parse_type</a><span class="Delimiter">(</span>string s<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L20" class="LineNr">20 </span> reagent x<span class="Delimiter">(</span><span class="Constant">"x:"</span>+s<span class="Delimiter">);</span> @@ -85,16 +88,16 @@ if ('onhashchange' in window) { <span id="L23" class="LineNr">23 </span> <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span id="L24" class="LineNr">24 </span><span class="Delimiter">}</span> <span id="L25" class="LineNr">25 </span><span class="Normal">void</span> <a href='099hardware_checks.cc.html#L25'>teardown_real_hardware_types</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L26" class="LineNr">26 </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#L141'>SIZE</a><span class="Delimiter">(</span>Real_hardware_types<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> -<span id="L27" class="LineNr">27 </span> <span class="Normal">delete</span> Real_hardware_types<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L28" class="LineNr">28 </span> Real_hardware_types<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L26" class="LineNr">26 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Real_hardware_types</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> +<span id="L27" class="LineNr">27 </span> <span class="Normal">delete</span> <span class="Special">Real_hardware_types</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L28" class="LineNr">28 </span> <span class="Special">Real_hardware_types</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L29" class="LineNr">29 </span><span class="Delimiter">}</span> <span id="L30" class="LineNr">30 </span> <span id="L31" class="LineNr">31 </span><span class="Delimiter">:(before "End Checks")</span> -<span id="L32" class="LineNr">32 </span>Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='099hardware_checks.cc.html#L34'>check_for_misuse_of_real_hardware</a><span class="Delimiter">);</span> +<span id="L32" class="LineNr">32 </span><span class="Special">Transform</span><span class="Delimiter">.</span>push_back<span class="Delimiter">(</span><a href='099hardware_checks.cc.html#L34'>check_for_misuse_of_real_hardware</a><span class="Delimiter">);</span> <span id="L33" class="LineNr">33 </span><span class="Delimiter">:(code)</span> <span id="L34" class="LineNr">34 </span><span class="Normal">void</span> <a href='099hardware_checks.cc.html#L34'>check_for_misuse_of_real_hardware</a><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="L35" class="LineNr">35 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> +<span id="L35" class="LineNr">35 </span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span id="L36" class="LineNr">36 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name == <span class="Constant">"main"</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L37" class="LineNr">37 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L77'>starts_with</a><span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">,</span> <span class="Constant">"scenario_"</span><span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L38" class="LineNr">38 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- check if <a href='010vm.cc.html#L19'>recipe</a> "</span> << caller<span class="Delimiter">.</span>name << <span class="Constant">" has any dependency-injection mistakes"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> @@ -104,12 +107,12 @@ if ('onhashchange' in window) { <span id="L42" class="LineNr">42 </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#L141'>SIZE</a><span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L43" class="LineNr">43 </span> <span class="Normal">const</span> reagent& ing = inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L44" class="LineNr">44 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<span class="Delimiter">(</span>ing<span class="Delimiter">)</span> || ing<span class="Delimiter">.</span>name != <span class="Constant">"0"</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L45" class="LineNr">45 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">);</span> +<span id="L45" class="LineNr">45 </span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> inst<span class="Delimiter">.</span>operation<span class="Delimiter">);</span> <span id="L46" class="LineNr">46 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!callee<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L47" class="LineNr">47 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>i >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>callee<span class="Delimiter">.</span>ingredients<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L48" class="LineNr">48 </span> <span class="Normal">const</span> reagent& expected_ing = callee<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> -<span id="L49" class="LineNr">49 </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#L141'>SIZE</a><span class="Delimiter">(</span>Real_hardware_types<span class="Delimiter">);</span> ++j<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L50" class="LineNr">50 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*Real_hardware_types<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">)</span> == *expected_ing<span class="Delimiter">.</span>type<span class="Delimiter">)</span> +<span id="L49" class="LineNr">49 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Real_hardware_types</span><span class="Delimiter">);</span> ++j<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L50" class="LineNr">50 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*<span class="Special">Real_hardware_types</span><span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">)</span> == *expected_ing<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span id="L51" class="LineNr">51 </span> <a href='003trace.cc.html#L196'>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">"'"</span> << to_original_string<span class="Delimiter">(</span>inst<span class="Delimiter">)</span> << <span class="Constant">"': only 'main' can pass 0 into a "</span> << <a href='028call_return.cc.html#L163'>to_string</a><span class="Delimiter">(</span>expected_ing<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << <span class="cSpecial">'\n'</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L52" class="LineNr">52 </span> <span class="Delimiter">}</span> <span id="L53" class="LineNr">53 </span> <span class="Delimiter">}</span> diff --git a/html/100trace_browser.cc.html b/html/100trace_browser.cc.html index 54fbdef7..4f8bbd64 100644 --- a/html/100trace_browser.cc.html +++ b/html/100trace_browser.cc.html @@ -11,17 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Identifier { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -56,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/100trace_browser.cc'>https://github.com/akkartik/mu/blob/master/100trace_browser.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: A debugging helper that lets you zoom in/out on a trace.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: Warning: this tool has zero automated tests.</span> @@ -125,7 +129,7 @@ if ('onhashchange' in window) { <span id="L66" class="LineNr"> 66 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L67" class="LineNr"> 67 </span>_BROWSE_TRACE<span class="Delimiter">,</span> <span id="L68" class="LineNr"> 68 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L69" class="LineNr"> 69 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$browse-trace"</span><span class="Delimiter">,</span> _BROWSE_TRACE<span class="Delimiter">);</span> +<span id="L69" class="LineNr"> 69 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$browse-trace"</span><span class="Delimiter">,</span> _BROWSE_TRACE<span class="Delimiter">);</span> <span id="L70" class="LineNr"> 70 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L71" class="LineNr"> 71 </span><span class="Normal">case</span> _BROWSE_TRACE: <span class="Delimiter">{</span> <span id="L72" class="LineNr"> 72 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -145,36 +149,36 @@ if ('onhashchange' in window) { <span id="L86" class="LineNr"> 86 </span><span class="Delimiter">}</span> <span id="L87" class="LineNr"> 87 </span> <span id="L88" class="LineNr"> 88 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L89" class="LineNr"> 89 </span>set<<span class="Normal">int</span>> Visible<span class="Delimiter">;</span> -<span id="L90" class="LineNr"> 90 </span><span class="Normal">int</span> Top_of_screen = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L91" class="LineNr"> 91 </span><span class="Normal">int</span> Left_of_screen = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L92" class="LineNr"> 92 </span><span class="Normal">int</span> Last_printed_row = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L93" class="LineNr"> 93 </span>map<<span class="Normal">int</span><span class="Delimiter">,</span> <span class="Normal">int</span>> Trace_index<span class="Delimiter">;</span> <span class="Comment">// screen row -> trace index</span> -<span id="L94" class="LineNr"> 94 </span>string Current_search_pattern = <span class="Constant">""</span><span class="Delimiter">;</span> +<span id="L89" class="LineNr"> 89 </span>set<<span class="Normal">int</span>> <span class="Special">Visible</span><span class="Delimiter">;</span> +<span id="L90" class="LineNr"> 90 </span><span class="Normal">int</span> <span class="Special">Top_of_screen</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L91" class="LineNr"> 91 </span><span class="Normal">int</span> <span class="Special">Left_of_screen</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L92" class="LineNr"> 92 </span><span class="Normal">int</span> <span class="Special">Last_printed_row</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L93" class="LineNr"> 93 </span>map<<span class="Normal">int</span><span class="Delimiter">,</span> <span class="Normal">int</span>> <span class="Special">Trace_index</span><span class="Delimiter">;</span> <span class="Comment">// screen row -> trace index</span> +<span id="L94" class="LineNr"> 94 </span>string <span class="Special">Current_search_pattern</span> = <span class="Constant">""</span><span class="Delimiter">;</span> <span id="L95" class="LineNr"> 95 </span><span class="Delimiter">:(before "End Types")</span> <span id="L96" class="LineNr"> 96 </span><span class="Normal">enum</span> <a href='100trace_browser.cc.html#L96'>search_direction</a> <span class="Delimiter">{</span> <a href='100trace_browser.cc.html#L96'>FORWARD</a><span class="Delimiter">,</span> <a href='100trace_browser.cc.html#L96'>BACKWARD</a> <span class="Delimiter">};</span> <span id="L97" class="LineNr"> 97 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L98" class="LineNr"> 98 </span><a href='100trace_browser.cc.html#L96'>search_direction</a> Current_search_direction = <a href='100trace_browser.cc.html#L96'>FORWARD</a><span class="Delimiter">;</span> +<span id="L98" class="LineNr"> 98 </span><a href='100trace_browser.cc.html#L96'>search_direction</a> <span class="Special">Current_search_direction</span> = <a href='100trace_browser.cc.html#L96'>FORWARD</a><span class="Delimiter">;</span> <span id="L99" class="LineNr"> 99 </span> <span id="L100" class="LineNr">100 </span><span class="Delimiter">:(code)</span> <span id="L101" class="LineNr">101 </span><span class="Normal">void</span> <a href='100trace_browser.cc.html#L101'>start_trace_browser</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L102" class="LineNr">102 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Trace_stream<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L103" class="LineNr">103 </span> cerr << <span class="Constant">"computing min depth to display</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> +<span id="L102" class="LineNr">102 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L103" class="LineNr">103 </span> cerr << <span class="Constant">"computing min depth to display\n"</span><span class="Delimiter">;</span> <span id="L104" class="LineNr">104 </span> <span class="Normal">int</span> min_depth = <span class="Constant">9999</span><span class="Delimiter">;</span> -<span id="L105" class="LineNr">105 </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#L141'>SIZE</a><span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L106" class="LineNr">106 </span> trace_line& curr_line = Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L105" class="LineNr">105 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L106" class="LineNr">106 </span> trace_line& curr_line = <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L107" class="LineNr">107 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr_line<span class="Delimiter">.</span>depth < min_depth<span class="Delimiter">)</span> min_depth = curr_line<span class="Delimiter">.</span>depth<span class="Delimiter">;</span> <span id="L108" class="LineNr">108 </span> <span class="Delimiter">}</span> <span id="L109" class="LineNr">109 </span> cerr << <span class="Constant">"min depth is "</span> << min_depth << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> -<span id="L110" class="LineNr">110 </span> cerr << <span class="Constant">"computing lines to display</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> -<span id="L111" class="LineNr">111 </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#L141'>SIZE</a><span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L112" class="LineNr">112 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>depth == min_depth<span class="Delimiter">)</span> -<span id="L113" class="LineNr">113 </span> Visible<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L110" class="LineNr">110 </span> cerr << <span class="Constant">"computing lines to display\n"</span><span class="Delimiter">;</span> +<span id="L111" class="LineNr">111 </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#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L112" class="LineNr">112 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>depth == min_depth<span class="Delimiter">)</span> +<span id="L113" class="LineNr">113 </span> <span class="Special">Visible</span><span class="Delimiter">.</span>insert<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L114" class="LineNr">114 </span> <span class="Delimiter">}</span> <span id="L115" class="LineNr">115 </span> tb_init<span class="Delimiter">();</span> <span id="L116" class="LineNr">116 </span> tb_clear<span class="Delimiter">();</span> -<span id="L117" class="LineNr">117 </span> Display_row = Display_column = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L118" class="LineNr">118 </span> Top_of_screen = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L117" class="LineNr">117 </span> <span class="Special">Display_row</span> = <span class="Special">Display_column</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L118" class="LineNr">118 </span> <span class="Special">Top_of_screen</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L119" class="LineNr">119 </span> <a href='100trace_browser.cc.html#L402'>refresh_screen_rows</a><span class="Delimiter">();</span> <span id="L120" class="LineNr">120 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><span class="Constant">true</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L121" class="LineNr">121 </span> <a href='100trace_browser.cc.html#L417'>render</a><span class="Delimiter">();</span> @@ -182,146 +186,146 @@ if ('onhashchange' in window) { <span id="L123" class="LineNr">123 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'q'</span> || key == <span class="Constant">'Q'</span> || key == TB_KEY_CTRL_C<span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L124" class="LineNr">124 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'j'</span> || key == TB_KEY_ARROW_DOWN<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L125" class="LineNr">125 </span> <span class="Comment">// move cursor one line down</span> -<span id="L126" class="LineNr">126 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Display_row < Last_printed_row<span class="Delimiter">)</span> ++Display_row<span class="Delimiter">;</span> +<span id="L126" class="LineNr">126 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Display_row</span> < <span class="Special">Last_printed_row</span><span class="Delimiter">)</span> ++<span class="Special">Display_row</span><span class="Delimiter">;</span> <span id="L127" class="LineNr">127 </span> <span class="Delimiter">}</span> <span id="L128" class="LineNr">128 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'k'</span> || key == TB_KEY_ARROW_UP<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L129" class="LineNr">129 </span> <span class="Comment">// move cursor one line up</span> -<span id="L130" class="LineNr">130 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Display_row > <span class="Constant">0</span><span class="Delimiter">)</span> --Display_row<span class="Delimiter">;</span> +<span id="L130" class="LineNr">130 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Display_row</span> > <span class="Constant">0</span><span class="Delimiter">)</span> --<span class="Special">Display_row</span><span class="Delimiter">;</span> <span id="L131" class="LineNr">131 </span> <span class="Delimiter">}</span> <span id="L132" class="LineNr">132 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'t'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L133" class="LineNr">133 </span> <span class="Comment">// move cursor to top of screen</span> -<span id="L134" class="LineNr">134 </span> Display_row = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L134" class="LineNr">134 </span> <span class="Special">Display_row</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L135" class="LineNr">135 </span> <span class="Delimiter">}</span> <span id="L136" class="LineNr">136 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'c'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L137" class="LineNr">137 </span> <span class="Comment">// move cursor to center of screen</span> -<span id="L138" class="LineNr">138 </span> Display_row = tb_height<span class="Delimiter">()</span>/<span class="Constant">2</span><span class="Delimiter">;</span> -<span id="L139" class="LineNr">139 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> Display_row<span class="Delimiter">))</span> -<span id="L140" class="LineNr">140 </span> --Display_row<span class="Delimiter">;</span> +<span id="L138" class="LineNr">138 </span> <span class="Special">Display_row</span> = tb_height<span class="Delimiter">()</span>/<span class="Constant">2</span><span class="Delimiter">;</span> +<span id="L139" class="LineNr">139 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">))</span> +<span id="L140" class="LineNr">140 </span> --<span class="Special">Display_row</span><span class="Delimiter">;</span> <span id="L141" class="LineNr">141 </span> <span class="Delimiter">}</span> <span id="L142" class="LineNr">142 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'b'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L143" class="LineNr">143 </span> <span class="Comment">// move cursor to bottom of screen</span> -<span id="L144" class="LineNr">144 </span> Display_row = tb_height<span class="Delimiter">()</span>-<span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L145" class="LineNr">145 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> Display_row<span class="Delimiter">))</span> -<span id="L146" class="LineNr">146 </span> --Display_row<span class="Delimiter">;</span> +<span id="L144" class="LineNr">144 </span> <span class="Special">Display_row</span> = tb_height<span class="Delimiter">()</span>-<span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L145" class="LineNr">145 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">))</span> +<span id="L146" class="LineNr">146 </span> --<span class="Special">Display_row</span><span class="Delimiter">;</span> <span id="L147" class="LineNr">147 </span> <span class="Delimiter">}</span> <span id="L148" class="LineNr">148 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'T'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L149" class="LineNr">149 </span> <span class="Comment">// scroll line at cursor to top of screen</span> -<span id="L150" class="LineNr">150 </span> Top_of_screen = get<span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> -<span id="L151" class="LineNr">151 </span> Display_row = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L150" class="LineNr">150 </span> <span class="Special">Top_of_screen</span> = get<span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">);</span> +<span id="L151" class="LineNr">151 </span> <span class="Special">Display_row</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L152" class="LineNr">152 </span> <a href='100trace_browser.cc.html#L402'>refresh_screen_rows</a><span class="Delimiter">();</span> <span id="L153" class="LineNr">153 </span> <span class="Delimiter">}</span> <span id="L154" class="LineNr">154 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'h'</span> || key == TB_KEY_ARROW_LEFT<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L155" class="LineNr">155 </span> <span class="Comment">// pan screen one character left</span> -<span id="L156" class="LineNr">156 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Left_of_screen > <span class="Constant">0</span><span class="Delimiter">)</span> --Left_of_screen<span class="Delimiter">;</span> +<span id="L156" class="LineNr">156 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Left_of_screen</span> > <span class="Constant">0</span><span class="Delimiter">)</span> --<span class="Special">Left_of_screen</span><span class="Delimiter">;</span> <span id="L157" class="LineNr">157 </span> <span class="Delimiter">}</span> <span id="L158" class="LineNr">158 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'l'</span> || key == TB_KEY_ARROW_RIGHT<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L159" class="LineNr">159 </span> <span class="Comment">// pan screen one character right</span> -<span id="L160" class="LineNr">160 </span> ++Left_of_screen<span class="Delimiter">;</span> +<span id="L160" class="LineNr">160 </span> ++<span class="Special">Left_of_screen</span><span class="Delimiter">;</span> <span id="L161" class="LineNr">161 </span> <span class="Delimiter">}</span> <span id="L162" class="LineNr">162 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'H'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L163" class="LineNr">163 </span> <span class="Comment">// pan screen one screen-width left</span> -<span id="L164" class="LineNr">164 </span> Left_of_screen -= <span class="Delimiter">(</span>tb_width<span class="Delimiter">()</span> - <span class="Constant">5</span><span class="Delimiter">);</span> -<span id="L165" class="LineNr">165 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Left_of_screen < <span class="Constant">0</span><span class="Delimiter">)</span> Left_of_screen = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L164" class="LineNr">164 </span> <span class="Special">Left_of_screen</span> -= <span class="Delimiter">(</span>tb_width<span class="Delimiter">()</span> - <span class="Constant">5</span><span class="Delimiter">);</span> +<span id="L165" class="LineNr">165 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Left_of_screen</span> < <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Special">Left_of_screen</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L166" class="LineNr">166 </span> <span class="Delimiter">}</span> <span id="L167" class="LineNr">167 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'L'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L168" class="LineNr">168 </span> <span class="Comment">// pan screen one screen-width right</span> -<span id="L169" class="LineNr">169 </span> Left_of_screen += <span class="Delimiter">(</span>tb_width<span class="Delimiter">()</span> - <span class="Constant">5</span><span class="Delimiter">);</span> +<span id="L169" class="LineNr">169 </span> <span class="Special">Left_of_screen</span> += <span class="Delimiter">(</span>tb_width<span class="Delimiter">()</span> - <span class="Constant">5</span><span class="Delimiter">);</span> <span id="L170" class="LineNr">170 </span> <span class="Delimiter">}</span> <span id="L171" class="LineNr">171 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'J'</span> || key == TB_KEY_PGDN || key == TB_KEY_CTRL_F<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L172" class="LineNr">172 </span> <span class="Comment">// page-down</span> -<span id="L173" class="LineNr">173 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Trace_index<span class="Delimiter">.</span>find<span class="Delimiter">(</span>tb_height<span class="Delimiter">()</span>-<span class="Constant">1</span><span class="Delimiter">)</span> != Trace_index<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L174" class="LineNr">174 </span> Top_of_screen = get<span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> tb_height<span class="Delimiter">()</span>-<span class="Constant">1</span><span class="Delimiter">)</span> + <span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L173" class="LineNr">173 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">.</span>find<span class="Delimiter">(</span>tb_height<span class="Delimiter">()</span>-<span class="Constant">1</span><span class="Delimiter">)</span> != <span class="Special">Trace_index</span><span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">())</span> <span class="Delimiter">{</span> +<span id="L174" class="LineNr">174 </span> <span class="Special">Top_of_screen</span> = get<span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> tb_height<span class="Delimiter">()</span>-<span class="Constant">1</span><span class="Delimiter">)</span> + <span class="Constant">1</span><span class="Delimiter">;</span> <span id="L175" class="LineNr">175 </span> <a href='100trace_browser.cc.html#L402'>refresh_screen_rows</a><span class="Delimiter">();</span> <span id="L176" class="LineNr">176 </span> <span class="Delimiter">}</span> <span id="L177" class="LineNr">177 </span> <span class="Delimiter">}</span> <span id="L178" class="LineNr">178 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'K'</span> || key == TB_KEY_PGUP || key == TB_KEY_CTRL_B<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L179" class="LineNr">179 </span> <span class="Comment">// page-up is more convoluted</span> -<span id="L180" class="LineNr">180 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> screen_row = tb_height<span class="Delimiter">();</span> screen_row > <span class="Constant">0</span> && Top_of_screen > <span class="Constant">0</span><span class="Delimiter">;</span> --screen_row<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L181" class="LineNr">181 </span> --Top_of_screen<span class="Delimiter">;</span> -<span id="L182" class="LineNr">182 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Top_of_screen <= <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L183" class="LineNr">183 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>Top_of_screen > <span class="Constant">0</span> && !contains_key<span class="Delimiter">(</span>Visible<span class="Delimiter">,</span> Top_of_screen<span class="Delimiter">))</span> -<span id="L184" class="LineNr">184 </span> --Top_of_screen<span class="Delimiter">;</span> +<span id="L180" class="LineNr">180 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> screen_row = tb_height<span class="Delimiter">();</span> screen_row > <span class="Constant">0</span> && <span class="Special">Top_of_screen</span> > <span class="Constant">0</span><span class="Delimiter">;</span> --screen_row<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L181" class="LineNr">181 </span> --<span class="Special">Top_of_screen</span><span class="Delimiter">;</span> +<span id="L182" class="LineNr">182 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Top_of_screen</span> <= <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L183" class="LineNr">183 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><span class="Special">Top_of_screen</span> > <span class="Constant">0</span> && !contains_key<span class="Delimiter">(</span><span class="Special">Visible</span><span class="Delimiter">,</span> <span class="Special">Top_of_screen</span><span class="Delimiter">))</span> +<span id="L184" class="LineNr">184 </span> --<span class="Special">Top_of_screen</span><span class="Delimiter">;</span> <span id="L185" class="LineNr">185 </span> <span class="Delimiter">}</span> -<span id="L186" class="LineNr">186 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Top_of_screen >= <span class="Constant">0</span><span class="Delimiter">)</span> +<span id="L186" class="LineNr">186 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Top_of_screen</span> >= <span class="Constant">0</span><span class="Delimiter">)</span> <span id="L187" class="LineNr">187 </span> <a href='100trace_browser.cc.html#L402'>refresh_screen_rows</a><span class="Delimiter">();</span> <span id="L188" class="LineNr">188 </span> <span class="Delimiter">}</span> <span id="L189" class="LineNr">189 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'g'</span> || key == TB_KEY_HOME<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L190" class="LineNr">190 </span> Top_of_screen = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L191" class="LineNr">191 </span> Last_printed_row = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L192" class="LineNr">192 </span> Display_row = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L190" class="LineNr">190 </span> <span class="Special">Top_of_screen</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L191" class="LineNr">191 </span> <span class="Special">Last_printed_row</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L192" class="LineNr">192 </span> <span class="Special">Display_row</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L193" class="LineNr">193 </span> <a href='100trace_browser.cc.html#L402'>refresh_screen_rows</a><span class="Delimiter">();</span> <span id="L194" class="LineNr">194 </span> <span class="Delimiter">}</span> <span id="L195" class="LineNr">195 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'G'</span> || key == TB_KEY_END<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L196" class="LineNr">196 </span> <span class="Comment">// go to bottom of screen; largely like page-up, interestingly</span> -<span id="L197" class="LineNr">197 </span> Top_of_screen = <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">;</span> -<span id="L198" class="LineNr">198 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> screen_row = tb_height<span class="Delimiter">();</span> screen_row > <span class="Constant">0</span> && Top_of_screen > <span class="Constant">0</span><span class="Delimiter">;</span> --screen_row<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L199" class="LineNr">199 </span> --Top_of_screen<span class="Delimiter">;</span> -<span id="L200" class="LineNr">200 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Top_of_screen <= <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L201" class="LineNr">201 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>Top_of_screen > <span class="Constant">0</span> && !contains_key<span class="Delimiter">(</span>Visible<span class="Delimiter">,</span> Top_of_screen<span class="Delimiter">))</span> -<span id="L202" class="LineNr">202 </span> --Top_of_screen<span class="Delimiter">;</span> +<span id="L197" class="LineNr">197 </span> <span class="Special">Top_of_screen</span> = <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L198" class="LineNr">198 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> screen_row = tb_height<span class="Delimiter">();</span> screen_row > <span class="Constant">0</span> && <span class="Special">Top_of_screen</span> > <span class="Constant">0</span><span class="Delimiter">;</span> --screen_row<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L199" class="LineNr">199 </span> --<span class="Special">Top_of_screen</span><span class="Delimiter">;</span> +<span id="L200" class="LineNr">200 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Top_of_screen</span> <= <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L201" class="LineNr">201 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><span class="Special">Top_of_screen</span> > <span class="Constant">0</span> && !contains_key<span class="Delimiter">(</span><span class="Special">Visible</span><span class="Delimiter">,</span> <span class="Special">Top_of_screen</span><span class="Delimiter">))</span> +<span id="L202" class="LineNr">202 </span> --<span class="Special">Top_of_screen</span><span class="Delimiter">;</span> <span id="L203" class="LineNr">203 </span> <span class="Delimiter">}</span> <span id="L204" class="LineNr">204 </span> <a href='100trace_browser.cc.html#L402'>refresh_screen_rows</a><span class="Delimiter">();</span> <span id="L205" class="LineNr">205 </span> <span class="Comment">// move cursor to bottom</span> -<span id="L206" class="LineNr">206 </span> Display_row = Last_printed_row<span class="Delimiter">;</span> +<span id="L206" class="LineNr">206 </span> <span class="Special">Display_row</span> = <span class="Special">Last_printed_row</span><span class="Delimiter">;</span> <span id="L207" class="LineNr">207 </span> <a href='100trace_browser.cc.html#L402'>refresh_screen_rows</a><span class="Delimiter">();</span> <span id="L208" class="LineNr">208 </span> <span class="Delimiter">}</span> <span id="L209" class="LineNr">209 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == TB_KEY_CARRIAGE_RETURN<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L210" class="LineNr">210 </span> <span class="Comment">// expand lines under current by one level</span> -<span id="L211" class="LineNr">211 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> Display_row<span class="Delimiter">));</span> -<span id="L212" class="LineNr">212 </span> <span class="Normal">int</span> start_index = get<span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> +<span id="L211" class="LineNr">211 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">));</span> +<span id="L212" class="LineNr">212 </span> <span class="Normal">int</span> start_index = get<span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">);</span> <span id="L213" class="LineNr">213 </span> <span class="Normal">int</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L214" class="LineNr">214 </span> <span class="Comment">// simultaneously compute end_index and min_depth</span> <span id="L215" class="LineNr">215 </span> <span class="Normal">int</span> min_depth = <span class="Constant">9999</span><span class="Delimiter">;</span> -<span id="L216" class="LineNr">216 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>index = start_index+<span class="Constant">1</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L217" class="LineNr">217 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Visible<span class="Delimiter">,</span> index<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L218" class="LineNr">218 </span> trace_line& curr_line = Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> -<span id="L219" class="LineNr">219 </span> assert<span class="Delimiter">(</span>curr_line<span class="Delimiter">.</span>depth > Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>start_index<span class="Delimiter">).</span>depth<span class="Delimiter">);</span> +<span id="L216" class="LineNr">216 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>index = start_index+<span class="Constant">1</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L217" class="LineNr">217 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Visible</span><span class="Delimiter">,</span> index<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L218" class="LineNr">218 </span> trace_line& curr_line = <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> +<span id="L219" class="LineNr">219 </span> assert<span class="Delimiter">(</span>curr_line<span class="Delimiter">.</span>depth > <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>start_index<span class="Delimiter">).</span>depth<span class="Delimiter">);</span> <span id="L220" class="LineNr">220 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr_line<span class="Delimiter">.</span>depth < min_depth<span class="Delimiter">)</span> min_depth = curr_line<span class="Delimiter">.</span>depth<span class="Delimiter">;</span> <span id="L221" class="LineNr">221 </span> <span class="Delimiter">}</span> <span id="L222" class="LineNr">222 </span> <span class="Normal">int</span> end_index = index<span class="Delimiter">;</span> <span id="L223" class="LineNr">223 </span> <span class="Comment">// mark as visible all intervening indices at min_depth</span> <span id="L224" class="LineNr">224 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>index = start_index<span class="Delimiter">;</span> index < end_index<span class="Delimiter">;</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L225" class="LineNr">225 </span> trace_line& curr_line = Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> +<span id="L225" class="LineNr">225 </span> trace_line& curr_line = <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> <span id="L226" class="LineNr">226 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr_line<span class="Delimiter">.</span>depth == min_depth<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L227" class="LineNr">227 </span> Visible<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>index<span class="Delimiter">);</span> +<span id="L227" class="LineNr">227 </span> <span class="Special">Visible</span><span class="Delimiter">.</span>insert<span class="Delimiter">(</span>index<span class="Delimiter">);</span> <span id="L228" class="LineNr">228 </span> <span class="Delimiter">}</span> <span id="L229" class="LineNr">229 </span> <span class="Delimiter">}</span> <span id="L230" class="LineNr">230 </span> <a href='100trace_browser.cc.html#L402'>refresh_screen_rows</a><span class="Delimiter">();</span> <span id="L231" class="LineNr">231 </span> <span class="Delimiter">}</span> <span id="L232" class="LineNr">232 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == TB_KEY_BACKSPACE || key == TB_KEY_BACKSPACE2<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L233" class="LineNr">233 </span> <span class="Comment">// collapse all lines under current</span> -<span id="L234" class="LineNr">234 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> Display_row<span class="Delimiter">));</span> -<span id="L235" class="LineNr">235 </span> <span class="Normal">int</span> start_index = get<span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> +<span id="L234" class="LineNr">234 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">));</span> +<span id="L235" class="LineNr">235 </span> <span class="Normal">int</span> start_index = get<span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">);</span> <span id="L236" class="LineNr">236 </span> <span class="Normal">int</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L237" class="LineNr">237 </span> <span class="Comment">// end_index is the next line at a depth same as or lower than start_index</span> -<span id="L238" class="LineNr">238 </span> <span class="Normal">int</span> initial_depth = Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>start_index<span class="Delimiter">).</span>depth<span class="Delimiter">;</span> -<span id="L239" class="LineNr">239 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>index = start_index+<span class="Constant">1</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L240" class="LineNr">240 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Visible<span class="Delimiter">,</span> index<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L241" class="LineNr">241 </span> trace_line& curr_line = Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> +<span id="L238" class="LineNr">238 </span> <span class="Normal">int</span> initial_depth = <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>start_index<span class="Delimiter">).</span>depth<span class="Delimiter">;</span> +<span id="L239" class="LineNr">239 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>index = start_index+<span class="Constant">1</span><span class="Delimiter">;</span> index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L240" class="LineNr">240 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Visible</span><span class="Delimiter">,</span> index<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L241" class="LineNr">241 </span> trace_line& curr_line = <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span> <span id="L242" class="LineNr">242 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr_line<span class="Delimiter">.</span>depth <= initial_depth<span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L243" class="LineNr">243 </span> <span class="Delimiter">}</span> <span id="L244" class="LineNr">244 </span> <span class="Normal">int</span> end_index = index<span class="Delimiter">;</span> <span id="L245" class="LineNr">245 </span> <span class="Comment">// mark as visible all intervening indices at min_depth</span> <span id="L246" class="LineNr">246 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>index = start_index+<span class="Constant">1</span><span class="Delimiter">;</span> index < end_index<span class="Delimiter">;</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L247" class="LineNr">247 </span> Visible<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>index<span class="Delimiter">);</span> +<span id="L247" class="LineNr">247 </span> <span class="Special">Visible</span><span class="Delimiter">.</span>erase<span class="Delimiter">(</span>index<span class="Delimiter">);</span> <span id="L248" class="LineNr">248 </span> <span class="Delimiter">}</span> <span id="L249" class="LineNr">249 </span> <a href='100trace_browser.cc.html#L402'>refresh_screen_rows</a><span class="Delimiter">();</span> <span id="L250" class="LineNr">250 </span> <span class="Delimiter">}</span> <span id="L251" class="LineNr">251 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'/'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L252" class="LineNr">252 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='100trace_browser.cc.html#L271'>start_search_editor</a><span class="Delimiter">(</span><a href='100trace_browser.cc.html#L96'>FORWARD</a><span class="Delimiter">))</span> -<span id="L253" class="LineNr">253 </span> <a href='100trace_browser.cc.html#L360'>search</a><span class="Delimiter">(</span>Current_search_pattern<span class="Delimiter">,</span> Current_search_direction<span class="Delimiter">);</span> +<span id="L253" class="LineNr">253 </span> <a href='100trace_browser.cc.html#L360'>search</a><span class="Delimiter">(</span><span class="Special">Current_search_pattern</span><span class="Delimiter">,</span> <span class="Special">Current_search_direction</span><span class="Delimiter">);</span> <span id="L254" class="LineNr">254 </span> <span class="Delimiter">}</span> <span id="L255" class="LineNr">255 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'?'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L256" class="LineNr">256 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='100trace_browser.cc.html#L271'>start_search_editor</a><span class="Delimiter">(</span><a href='100trace_browser.cc.html#L96'>BACKWARD</a><span class="Delimiter">))</span> -<span id="L257" class="LineNr">257 </span> <a href='100trace_browser.cc.html#L360'>search</a><span class="Delimiter">(</span>Current_search_pattern<span class="Delimiter">,</span> Current_search_direction<span class="Delimiter">);</span> +<span id="L257" class="LineNr">257 </span> <a href='100trace_browser.cc.html#L360'>search</a><span class="Delimiter">(</span><span class="Special">Current_search_pattern</span><span class="Delimiter">,</span> <span class="Special">Current_search_direction</span><span class="Delimiter">);</span> <span id="L258" class="LineNr">258 </span> <span class="Delimiter">}</span> <span id="L259" class="LineNr">259 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'n'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L260" class="LineNr">260 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Current_search_pattern<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> -<span id="L261" class="LineNr">261 </span> <a href='100trace_browser.cc.html#L360'>search</a><span class="Delimiter">(</span>Current_search_pattern<span class="Delimiter">,</span> Current_search_direction<span class="Delimiter">);</span> +<span id="L260" class="LineNr">260 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Current_search_pattern</span><span class="Delimiter">.</span>empty<span class="Delimiter">())</span> +<span id="L261" class="LineNr">261 </span> <a href='100trace_browser.cc.html#L360'>search</a><span class="Delimiter">(</span><span class="Special">Current_search_pattern</span><span class="Delimiter">,</span> <span class="Special">Current_search_direction</span><span class="Delimiter">);</span> <span id="L262" class="LineNr">262 </span> <span class="Delimiter">}</span> <span id="L263" class="LineNr">263 </span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == <span class="Constant">'N'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L264" class="LineNr">264 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Current_search_pattern<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> -<span id="L265" class="LineNr">265 </span> <a href='100trace_browser.cc.html#L360'>search</a><span class="Delimiter">(</span>Current_search_pattern<span class="Delimiter">,</span> <a href='100trace_browser.cc.html#L365'>opposite</a><span class="Delimiter">(</span>Current_search_direction<span class="Delimiter">));</span> +<span id="L264" class="LineNr">264 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Current_search_pattern</span><span class="Delimiter">.</span>empty<span class="Delimiter">())</span> +<span id="L265" class="LineNr">265 </span> <a href='100trace_browser.cc.html#L360'>search</a><span class="Delimiter">(</span><span class="Special">Current_search_pattern</span><span class="Delimiter">,</span> <a href='100trace_browser.cc.html#L365'>opposite</a><span class="Delimiter">(</span><span class="Special">Current_search_direction</span><span class="Delimiter">));</span> <span id="L266" class="LineNr">266 </span> <span class="Delimiter">}</span> <span id="L267" class="LineNr">267 </span> <span class="Delimiter">}</span> <span id="L268" class="LineNr">268 </span> tb_shutdown<span class="Delimiter">();</span> @@ -340,8 +344,8 @@ if ('onhashchange' in window) { <span id="L281" class="LineNr">281 </span> <span class="Normal">int</span> key = <a href='100trace_browser.cc.html#L522'>read_key</a><span class="Delimiter">();</span> <span id="L282" class="LineNr">282 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>key == TB_KEY_ENTER<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L283" class="LineNr">283 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!pattern<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> -<span id="L284" class="LineNr">284 </span> Current_search_pattern = pattern<span class="Delimiter">;</span> -<span id="L285" class="LineNr">285 </span> Current_search_direction = dir<span class="Delimiter">;</span> +<span id="L284" class="LineNr">284 </span> <span class="Special">Current_search_pattern</span> = pattern<span class="Delimiter">;</span> +<span id="L285" class="LineNr">285 </span> <span class="Special">Current_search_direction</span> = dir<span class="Delimiter">;</span> <span id="L286" class="LineNr">286 </span> <span class="Delimiter">}</span> <span id="L287" class="LineNr">287 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L288" class="LineNr">288 </span> <span class="Delimiter">}</span> @@ -427,24 +431,24 @@ if ('onhashchange' in window) { <span id="L368" class="LineNr">368 </span><span class="Delimiter">}</span> <span id="L369" class="LineNr">369 </span> <span id="L370" class="LineNr">370 </span><span class="Normal">void</span> <a href='100trace_browser.cc.html#L370'>search_next</a><span class="Delimiter">(</span><span class="Normal">const</span> string& pat<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L371" class="LineNr">371 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> trace_index = get<span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> Display_row<span class="Delimiter">)</span>+<span class="Constant">1</span><span class="Delimiter">;</span> trace_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">);</span> ++trace_index<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L372" class="LineNr">372 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Visible<span class="Delimiter">,</span> trace_index<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L373" class="LineNr">373 </span> <span class="Normal">const</span> trace_line& line = Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>trace_index<span class="Delimiter">);</span> +<span id="L371" class="LineNr">371 </span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> trace_index = get<span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">)</span>+<span class="Constant">1</span><span class="Delimiter">;</span> trace_index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">);</span> ++trace_index<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L372" class="LineNr">372 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Visible</span><span class="Delimiter">,</span> trace_index<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L373" class="LineNr">373 </span> <span class="Normal">const</span> trace_line& line = <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>trace_index<span class="Delimiter">);</span> <span id="L374" class="LineNr">374 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>line<span class="Delimiter">.</span>label<span class="Delimiter">.</span>find<span class="Delimiter">(</span>pat<span class="Delimiter">)</span> == string::npos && line<span class="Delimiter">.</span>contents<span class="Delimiter">.</span>find<span class="Delimiter">(</span>pat<span class="Delimiter">)</span> == string::npos<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L375" class="LineNr">375 </span> Top_of_screen = trace_index<span class="Delimiter">;</span> -<span id="L376" class="LineNr">376 </span> Display_row = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L375" class="LineNr">375 </span> <span class="Special">Top_of_screen</span> = trace_index<span class="Delimiter">;</span> +<span id="L376" class="LineNr">376 </span> <span class="Special">Display_row</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L377" class="LineNr">377 </span> <a href='100trace_browser.cc.html#L402'>refresh_screen_rows</a><span class="Delimiter">();</span> <span id="L378" class="LineNr">378 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L379" class="LineNr">379 </span> <span class="Delimiter">}</span> <span id="L380" class="LineNr">380 </span><span class="Delimiter">}</span> <span id="L381" class="LineNr">381 </span> <span id="L382" class="LineNr">382 </span><span class="Normal">void</span> <a href='100trace_browser.cc.html#L382'>search_previous</a><span class="Delimiter">(</span><span class="Normal">const</span> string& pat<span class="Delimiter">)</span> <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> trace_index = get<span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> Display_row<span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">;</span> trace_index >= <span class="Constant">0</span><span class="Delimiter">;</span> --trace_index<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L384" class="LineNr">384 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Visible<span class="Delimiter">,</span> trace_index<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L385" class="LineNr">385 </span> <span class="Normal">const</span> trace_line& line = Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>trace_index<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> trace_index = get<span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">)</span>-<span class="Constant">1</span><span class="Delimiter">;</span> trace_index >= <span class="Constant">0</span><span class="Delimiter">;</span> --trace_index<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L384" class="LineNr">384 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Visible</span><span class="Delimiter">,</span> trace_index<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L385" class="LineNr">385 </span> <span class="Normal">const</span> trace_line& line = <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>trace_index<span class="Delimiter">);</span> <span id="L386" class="LineNr">386 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>line<span class="Delimiter">.</span>label<span class="Delimiter">.</span>find<span class="Delimiter">(</span>pat<span class="Delimiter">)</span> == string::npos && line<span class="Delimiter">.</span>contents<span class="Delimiter">.</span>find<span class="Delimiter">(</span>pat<span class="Delimiter">)</span> == string::npos<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> -<span id="L387" class="LineNr">387 </span> Top_of_screen = trace_index<span class="Delimiter">;</span> -<span id="L388" class="LineNr">388 </span> Display_row = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L387" class="LineNr">387 </span> <span class="Special">Top_of_screen</span> = trace_index<span class="Delimiter">;</span> +<span id="L388" class="LineNr">388 </span> <span class="Special">Display_row</span> = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L389" class="LineNr">389 </span> <a href='100trace_browser.cc.html#L402'>refresh_screen_rows</a><span class="Delimiter">();</span> <span id="L390" class="LineNr">390 </span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span id="L391" class="LineNr">391 </span> <span class="Delimiter">}</span> @@ -460,15 +464,15 @@ if ('onhashchange' in window) { <span id="L401" class="LineNr">401 </span><span class="Comment">// update Trace_indices for each screen_row on the basis of Top_of_screen and Visible</span> <span id="L402" class="LineNr">402 </span><span class="Normal">void</span> <a href='100trace_browser.cc.html#L402'>refresh_screen_rows</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> <span id="L403" class="LineNr">403 </span> <span class="Normal">int</span> screen_row = <span class="Constant">0</span><span class="Delimiter">,</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L404" class="LineNr">404 </span> Trace_index<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L405" class="LineNr">405 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>screen_row = <span class="Constant">0</span><span class="Delimiter">,</span> index = Top_of_screen<span class="Delimiter">;</span> screen_row < tb_height<span class="Delimiter">()</span> && index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">);</span> ++screen_row<span class="Delimiter">,</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L404" class="LineNr">404 </span> <span class="Special">Trace_index</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L405" class="LineNr">405 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>screen_row = <span class="Constant">0</span><span class="Delimiter">,</span> index = <span class="Special">Top_of_screen</span><span class="Delimiter">;</span> screen_row < tb_height<span class="Delimiter">()</span> && index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">);</span> ++screen_row<span class="Delimiter">,</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L406" class="LineNr">406 </span> <span class="Comment">// skip lines without depth for now</span> -<span id="L407" class="LineNr">407 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Visible<span class="Delimiter">,</span> index<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L407" class="LineNr">407 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Visible</span><span class="Delimiter">,</span> index<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L408" class="LineNr">408 </span> ++index<span class="Delimiter">;</span> -<span id="L409" class="LineNr">409 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>index >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">))</span> <span class="Identifier">goto</span> done<span class="Delimiter">;</span> +<span id="L409" class="LineNr">409 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>index >= <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">))</span> <span class="Identifier">goto</span> done<span class="Delimiter">;</span> <span id="L410" class="LineNr">410 </span> <span class="Delimiter">}</span> -<span id="L411" class="LineNr">411 </span> assert<span class="Delimiter">(</span>index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">));</span> -<span id="L412" class="LineNr">412 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> screen_row<span class="Delimiter">,</span> index<span class="Delimiter">);</span> +<span id="L411" class="LineNr">411 </span> assert<span class="Delimiter">(</span>index < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">));</span> +<span id="L412" class="LineNr">412 </span> <a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> screen_row<span class="Delimiter">,</span> index<span class="Delimiter">);</span> <span id="L413" class="LineNr">413 </span> <span class="Delimiter">}</span> <span id="L414" class="LineNr">414 </span><span class="Normal">done</span>:<span class="Delimiter">;</span> <span id="L415" class="LineNr">415 </span><span class="Delimiter">}</span> @@ -476,8 +480,8 @@ if ('onhashchange' in window) { <span id="L417" class="LineNr">417 </span><span class="Normal">void</span> <a href='100trace_browser.cc.html#L417'>render</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> <span id="L418" class="LineNr">418 </span> <span class="Normal">int</span> screen_row = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L419" class="LineNr">419 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>screen_row = <span class="Constant">0</span><span class="Delimiter">;</span> screen_row < tb_height<span class="Delimiter">();</span> ++screen_row<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L420" class="LineNr">420 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> screen_row<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L421" class="LineNr">421 </span> trace_line& curr_line = Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> screen_row<span class="Delimiter">));</span> +<span id="L420" class="LineNr">420 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> screen_row<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L421" class="LineNr">421 </span> trace_line& curr_line = <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>at<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> screen_row<span class="Delimiter">));</span> <span id="L422" class="LineNr">422 </span> ostringstream out<span class="Delimiter">;</span> <span id="L423" class="LineNr">423 </span> out << std::setw<span class="Delimiter">(</span><span class="Constant">4</span><span class="Delimiter">)</span> << curr_line<span class="Delimiter">.</span>depth << <span class="Constant">' '</span> << curr_line<span class="Delimiter">.</span>label << <span class="Constant">": "</span> << curr_line<span class="Delimiter">.</span>contents<span class="Delimiter">;</span> <span id="L424" class="LineNr">424 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>screen_row < tb_height<span class="Delimiter">()</span>-<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -489,37 +493,37 @@ if ('onhashchange' in window) { <span id="L430" class="LineNr">430 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>delta > <span class="Constant">999</span><span class="Delimiter">)</span> out << <span class="Normal">static_cast</span><<span class="Normal">char</span>><span class="Delimiter">(</span><span class="Constant">2</span><span class="Delimiter">);</span> <span id="L431" class="LineNr">431 </span> <span class="Delimiter">}</span> <span id="L432" class="LineNr">432 </span> <span class="Delimiter">}</span> -<span id="L433" class="LineNr">433 </span> <a href='100trace_browser.cc.html#L451'>render_line</a><span class="Delimiter">(</span>screen_row<span class="Delimiter">,</span> out<span class="Delimiter">.</span>str<span class="Delimiter">(),</span> screen_row == Display_row<span class="Delimiter">);</span> +<span id="L433" class="LineNr">433 </span> <a href='100trace_browser.cc.html#L451'>render_line</a><span class="Delimiter">(</span>screen_row<span class="Delimiter">,</span> out<span class="Delimiter">.</span>str<span class="Delimiter">(),</span> screen_row == <span class="Special">Display_row</span><span class="Delimiter">);</span> <span id="L434" class="LineNr">434 </span> <span class="Delimiter">}</span> <span id="L435" class="LineNr">435 </span> <span class="Comment">// clear rest of screen</span> -<span id="L436" class="LineNr">436 </span> Last_printed_row = screen_row-<span class="Constant">1</span><span class="Delimiter">;</span> +<span id="L436" class="LineNr">436 </span> <span class="Special">Last_printed_row</span> = screen_row-<span class="Constant">1</span><span class="Delimiter">;</span> <span id="L437" class="LineNr">437 </span> <span class="Normal">for</span> <span class="Delimiter">(;</span> screen_row < tb_height<span class="Delimiter">();</span> ++screen_row<span class="Delimiter">)</span> <span id="L438" class="LineNr">438 </span> <a href='100trace_browser.cc.html#L451'>render_line</a><span class="Delimiter">(</span>screen_row<span class="Delimiter">,</span> <span class="Constant">"~"</span><span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">cursor_line?</span><span class="Comment">*/</span><span class="Constant">false</span><span class="Delimiter">);</span> <span id="L439" class="LineNr">439 </span> <span class="Comment">// move cursor back to display row at the end</span> -<span id="L440" class="LineNr">440 </span> tb_set_cursor<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> +<span id="L440" class="LineNr">440 </span> tb_set_cursor<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">,</span> <span class="Special">Display_row</span><span class="Delimiter">);</span> <span id="L441" class="LineNr">441 </span><span class="Delimiter">}</span> <span id="L442" class="LineNr">442 </span> <span id="L443" class="LineNr">443 </span><span class="Normal">int</span> <a href='100trace_browser.cc.html#L443'>lines_hidden</a><span class="Delimiter">(</span><span class="Normal">int</span> screen_row<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L444" class="LineNr">444 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> screen_row<span class="Delimiter">));</span> -<span id="L445" class="LineNr">445 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> screen_row+<span class="Constant">1</span><span class="Delimiter">))</span> -<span id="L446" class="LineNr">446 </span> <span class="Identifier">return</span> <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">)</span> - get<span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> screen_row<span class="Delimiter">);</span> +<span id="L444" class="LineNr">444 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> screen_row<span class="Delimiter">));</span> +<span id="L445" class="LineNr">445 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> screen_row+<span class="Constant">1</span><span class="Delimiter">))</span> +<span id="L446" class="LineNr">446 </span> <span class="Identifier">return</span> <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">)</span> - get<span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> screen_row<span class="Delimiter">);</span> <span id="L447" class="LineNr">447 </span> <span class="Normal">else</span> -<span id="L448" class="LineNr">448 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> screen_row+<span class="Constant">1</span><span class="Delimiter">)</span> - get<span class="Delimiter">(</span>Trace_index<span class="Delimiter">,</span> screen_row<span class="Delimiter">);</span> +<span id="L448" class="LineNr">448 </span> <span class="Identifier">return</span> get<span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> screen_row+<span class="Constant">1</span><span class="Delimiter">)</span> - get<span class="Delimiter">(</span><span class="Special">Trace_index</span><span class="Delimiter">,</span> screen_row<span class="Delimiter">);</span> <span id="L449" class="LineNr">449 </span><span class="Delimiter">}</span> <span id="L450" class="LineNr">450 </span> <span id="L451" class="LineNr">451 </span><span class="Normal">void</span> <a href='100trace_browser.cc.html#L451'>render_line</a><span class="Delimiter">(</span><span class="Normal">int</span> screen_row<span class="Delimiter">,</span> <span class="Normal">const</span> string& s<span class="Delimiter">,</span> <span class="Normal">bool</span> cursor_line<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L452" class="LineNr">452 </span> <span class="Normal">int</span> col = <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L453" class="LineNr">453 </span> <span class="Normal">int</span> color = TB_WHITE<span class="Delimiter">;</span> <span id="L454" class="LineNr">454 </span> <span class="Normal">int</span> background_color = cursor_line ? <span class="Comment">/*</span><span class="Comment">subtle grey</span><span class="Comment">*/</span><span class="Constant">240</span> : TB_BLACK<span class="Delimiter">;</span> -<span id="L455" class="LineNr">455 </span> vector<pair<<span class="Normal">size_t</span><span class="Delimiter">,</span> <span class="Normal">size_t</span>> > highlight_ranges = <a href='100trace_browser.cc.html#L472'>find_all_occurrences</a><span class="Delimiter">(</span>s<span class="Delimiter">,</span> Current_search_pattern<span class="Delimiter">);</span> +<span id="L455" class="LineNr">455 </span> vector<pair<<span class="Normal">size_t</span><span class="Delimiter">,</span> <span class="Normal">size_t</span>> > highlight_ranges = <a href='100trace_browser.cc.html#L472'>find_all_occurrences</a><span class="Delimiter">(</span>s<span class="Delimiter">,</span> <span class="Special">Current_search_pattern</span><span class="Delimiter">);</span> <span id="L456" class="LineNr">456 </span> tb_set_cursor<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">,</span> screen_row<span class="Delimiter">);</span> -<span id="L457" class="LineNr">457 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>col = <span class="Constant">0</span><span class="Delimiter">;</span> col < tb_width<span class="Delimiter">()</span> && col+Left_of_screen < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>s<span class="Delimiter">);</span> ++col<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L458" class="LineNr">458 </span> <span class="Normal">char</span> c = s<span class="Delimiter">.</span>at<span class="Delimiter">(</span>col+Left_of_screen<span class="Delimiter">);</span> <span class="Comment">// todo: unicode</span> +<span id="L457" class="LineNr">457 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>col = <span class="Constant">0</span><span class="Delimiter">;</span> col < tb_width<span class="Delimiter">()</span> && col+<span class="Special">Left_of_screen</span> < <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>s<span class="Delimiter">);</span> ++col<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L458" class="LineNr">458 </span> <span class="Normal">char</span> c = s<span class="Delimiter">.</span>at<span class="Delimiter">(</span>col+<span class="Special">Left_of_screen</span><span class="Delimiter">);</span> <span class="Comment">// todo: unicode</span> <span id="L459" class="LineNr">459 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> c = <span class="Constant">';'</span><span class="Delimiter">;</span> <span class="Comment">// replace newlines with semi-colons</span> <span id="L460" class="LineNr">460 </span> <span class="Comment">// escapes. hack: can't start a line with them.</span> <span id="L461" class="LineNr">461 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="cSpecial">'\1'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> color = <span class="Comment">/*</span><span class="Comment">red</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> c = <span class="Constant">' '</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> <span id="L462" class="LineNr">462 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>c == <span class="cSpecial">'\2'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> color = TB_WHITE<span class="Delimiter">;</span> c = <span class="Constant">' '</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> -<span id="L463" class="LineNr">463 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='100trace_browser.cc.html#L485'>in_range</a><span class="Delimiter">(</span>highlight_ranges<span class="Delimiter">,</span> col+Left_of_screen<span class="Delimiter">))</span> +<span id="L463" class="LineNr">463 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='100trace_browser.cc.html#L485'>in_range</a><span class="Delimiter">(</span>highlight_ranges<span class="Delimiter">,</span> col+<span class="Special">Left_of_screen</span><span class="Delimiter">))</span> <span id="L464" class="LineNr">464 </span> tb_print<span class="Delimiter">(</span>c<span class="Delimiter">,</span> TB_BLACK<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">yellow</span><span class="Comment">*/</span><span class="Constant">11</span><span class="Delimiter">);</span> <span id="L465" class="LineNr">465 </span> <span class="Normal">else</span> <span id="L466" class="LineNr">466 </span> tb_print<span class="Delimiter">(</span>c<span class="Delimiter">,</span> color<span class="Delimiter">,</span> background_color<span class="Delimiter">);</span> @@ -556,7 +560,7 @@ if ('onhashchange' in window) { <span id="L497" class="LineNr">497 </span> cerr << <span class="Constant">"no such file: "</span> << filename << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L498" class="LineNr">498 </span> exit<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L499" class="LineNr">499 </span> <span class="Delimiter">}</span> -<span id="L500" class="LineNr">500 </span> Trace_stream = <span class="Normal">new</span> trace_stream<span class="Delimiter">;</span> +<span id="L500" class="LineNr">500 </span> <span class="Special">Trace_stream</span> = <span class="Normal">new</span> trace_stream<span class="Delimiter">;</span> <span id="L501" class="LineNr">501 </span> <span class="Normal">while</span> <span class="Delimiter">(</span><a href='001help.cc.html#L239'>has_data</a><span class="Delimiter">(</span>tin<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span id="L502" class="LineNr">502 </span> tin >> std::noskipws<span class="Delimiter">;</span> <span id="L503" class="LineNr">503 </span> skip_whitespace_but_not_newline<span class="Delimiter">(</span>tin<span class="Delimiter">);</span> @@ -573,9 +577,9 @@ if ('onhashchange' in window) { <span id="L514" class="LineNr">514 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*--label<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">()</span> == <span class="Constant">':'</span><span class="Delimiter">)</span> label<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>--label<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">());</span> <span id="L515" class="LineNr">515 </span> string line<span class="Delimiter">;</span> <span id="L516" class="LineNr">516 </span> getline<span class="Delimiter">(</span>tin<span class="Delimiter">,</span> line<span class="Delimiter">);</span> -<span id="L517" class="LineNr">517 </span> Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>trace_line<span class="Delimiter">(</span>depth<span class="Delimiter">,</span> label<span class="Delimiter">,</span> line<span class="Delimiter">));</span> +<span id="L517" class="LineNr">517 </span> <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>trace_line<span class="Delimiter">(</span>depth<span class="Delimiter">,</span> label<span class="Delimiter">,</span> line<span class="Delimiter">));</span> <span id="L518" class="LineNr">518 </span> <span class="Delimiter">}</span> -<span id="L519" class="LineNr">519 </span> cerr << <span class="Constant">"lines read: "</span> << Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>size<span class="Delimiter">()</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> +<span id="L519" class="LineNr">519 </span> cerr << <span class="Constant">"lines read: "</span> << <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>size<span class="Delimiter">()</span> << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L520" class="LineNr">520 </span><span class="Delimiter">}</span> <span id="L521" class="LineNr">521 </span> <span id="L522" class="LineNr">522 </span><span class="Normal">int</span> <a href='100trace_browser.cc.html#L522'>read_key</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> diff --git a/html/101run_sandboxed.cc.html b/html/101run_sandboxed.cc.html index 97ebc1ff..69560c91 100644 --- a/html/101run_sandboxed.cc.html +++ b/html/101run_sandboxed.cc.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .muRecipe { color: #ff8700; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } .traceContains { color: #008000; } --> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/101run_sandboxed.cc'>https://github.com/akkartik/mu/blob/master/101run_sandboxed.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Helper for various programming environments: run arbitrary Mu code and</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: return some result in text form.</span> @@ -86,10 +89,10 @@ if ('onhashchange' in window) { <span id="L23" class="LineNr"> 23 </span><span class="Comment">//: As the name suggests, 'run-sandboxed' will prevent certain operations that</span> <span id="L24" class="LineNr"> 24 </span><span class="Comment">//: regular Mu code can perform.</span> <span id="L25" class="LineNr"> 25 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L26" class="LineNr"> 26 </span><span class="Normal">bool</span> Sandbox_mode =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L26" class="LineNr"> 26 </span><span class="Normal">bool</span> <span class="Special">Sandbox_mode</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L27" class="LineNr"> 27 </span><span class="Comment">//: for starters, users can't override 'main' when the environment is running</span> <span id="L28" class="LineNr"> 28 </span><span class="Delimiter">:(before "End Load Recipe Name")</span> -<span id="L29" class="LineNr"> 29 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Sandbox_mode && result<span class="Delimiter">.</span>name == <span class="Constant">"main"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L29" class="LineNr"> 29 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Sandbox_mode</span> && result<span class="Delimiter">.</span>name == <span class="Constant">"main"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L30" class="LineNr"> 30 </span> <a href='016dilated_reagent.cc.html#L57'>slurp_balanced_bracket</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> <span id="L31" class="LineNr"> 31 </span> <span class="Identifier">return</span> -<span class="Constant">1</span><span class="Delimiter">;</span> <span id="L32" class="LineNr"> 32 </span><span class="Delimiter">}</span> @@ -102,15 +105,15 @@ if ('onhashchange' in window) { <span id="L39" class="LineNr"> 39 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L40" class="LineNr"> 40 </span>RUN_SANDBOXED<span class="Delimiter">,</span> <span id="L41" class="LineNr"> 41 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L42" class="LineNr"> 42 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"run-sandboxed"</span><span class="Delimiter">,</span> RUN_SANDBOXED<span class="Delimiter">);</span> +<span id="L42" class="LineNr"> 42 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"run-sandboxed"</span><span class="Delimiter">,</span> RUN_SANDBOXED<span class="Delimiter">);</span> <span id="L43" class="LineNr"> 43 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L44" class="LineNr"> 44 </span><span class="Normal">case</span> RUN_SANDBOXED: <span class="Delimiter">{</span> <span id="L45" class="LineNr"> 45 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L46" class="LineNr"> 46 </span> <a href='003trace.cc.html#L196'>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">"'run-sandboxed' 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L46" class="LineNr"> 46 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'run-sandboxed' requires exactly one ingredient, but got '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L47" class="LineNr"> 47 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L48" class="LineNr"> 48 </span> <span class="Delimiter">}</span> <span id="L49" class="LineNr"> 49 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_text<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="L50" class="LineNr"> 50 </span> <a href='003trace.cc.html#L196'>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 'run-sandboxed' should be a string, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L50" class="LineNr"> 50 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'run-sandboxed' should be a string, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L51" class="LineNr"> 51 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L52" class="LineNr"> 52 </span> <span class="Delimiter">}</span> <span id="L53" class="LineNr"> 53 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -143,166 +146,166 @@ if ('onhashchange' in window) { <span id="L80" class="LineNr"> 80 </span><span class="Comment">//: result of a sandbox.</span> <span id="L81" class="LineNr"> 81 </span> <span id="L82" class="LineNr"> 82 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L83" class="LineNr"> 83 </span><span class="Normal">bool</span> Track_most_recent_products =<span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L84" class="LineNr"> 84 </span><span class="Normal">int</span> Call_depth_to_track_most_recent_products_at = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L85" class="LineNr"> 85 </span>string Most_recent_products<span class="Delimiter">;</span> +<span id="L83" class="LineNr"> 83 </span><span class="Normal">bool</span> <span class="Special">Track_most_recent_products</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L84" class="LineNr"> 84 </span><span class="Normal">int</span> <span class="Special">Call_depth_to_track_most_recent_products_at</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L85" class="LineNr"> 85 </span>string <span class="Special">Most_recent_products</span><span class="Delimiter">;</span> <span id="L86" class="LineNr"> 86 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L87" class="LineNr"> 87 </span>Track_most_recent_products =<span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L88" class="LineNr"> 88 </span>Call_depth_to_track_most_recent_products_at = <span class="Constant">0</span><span class="Delimiter">;</span> -<span id="L89" class="LineNr"> 89 </span>Most_recent_products = <span class="Constant">""</span><span class="Delimiter">;</span> +<span id="L87" class="LineNr"> 87 </span><span class="Special">Track_most_recent_products</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L88" class="LineNr"> 88 </span><span class="Special">Call_depth_to_track_most_recent_products_at</span> = <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L89" class="LineNr"> 89 </span><span class="Special">Most_recent_products</span> = <span class="Constant">""</span><span class="Delimiter">;</span> <span id="L90" class="LineNr"> 90 </span> <span id="L91" class="LineNr"> 91 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L92" class="LineNr"> 92 </span>trace_stream* Save_trace_stream = <span class="Constant">NULL</span><span class="Delimiter">;</span> -<span id="L93" class="LineNr"> 93 </span>string Save_trace_file<span class="Delimiter">;</span> +<span id="L92" class="LineNr"> 92 </span>trace_stream* <span class="Special">Save_trace_stream</span> = <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L93" class="LineNr"> 93 </span>string <span class="Special">Save_trace_file</span><span class="Delimiter">;</span> <span id="L94" class="LineNr"> 94 </span><span class="Delimiter">:(code)</span> <span id="L95" class="LineNr"> 95 </span><span class="Comment">// reads a string, tries to call it as code (treating it as a test), saving</span> <span id="L96" class="LineNr"> 96 </span><span class="Comment">// all errors.</span> <span id="L97" class="LineNr"> 97 </span><span class="Comment">// returns true if successfully called (no errors found during load and transform)</span> <span id="L98" class="LineNr"> 98 </span><span class="Normal">bool</span> <a href='101run_sandboxed.cc.html#L98'>run_interactive</a><span class="Delimiter">(</span><span class="Normal">int</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L99" class="LineNr"> 99 </span><span class="CommentedCode">//? cerr << "run_interactive: " << address << '\n';</span> -<span id="L100" class="LineNr">100 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"interactive"</span><span class="Delimiter">)</span> && get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"interactive"</span><span class="Delimiter">)</span> != <span class="Constant">0</span><span class="Delimiter">);</span> +<span id="L100" class="LineNr">100 </span> assert<span class="Delimiter">(</span><a href='001help.cc.html#L226'>contains_key</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"interactive"</span><span class="Delimiter">)</span> && get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"interactive"</span><span class="Delimiter">)</span> != <span class="Constant">0</span><span class="Delimiter">);</span> <span id="L101" class="LineNr">101 </span> <span class="Comment">// try to sandbox the run as best you can</span> <span id="L102" class="LineNr">102 </span> <span class="Comment">// todo: test this</span> -<span id="L103" class="LineNr">103 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Current_scenario<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L104" class="LineNr">104 </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 < Reserved_for_tests<span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> -<span id="L105" class="LineNr">105 </span> Memory<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>i<span class="Delimiter">);</span> +<span id="L103" class="LineNr">103 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Current_scenario</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L104" class="LineNr">104 </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 < <span class="Special">Reserved_for_tests</span><span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> +<span id="L105" class="LineNr">105 </span> <span class="Special">Memory</span><span class="Delimiter">.</span>erase<span class="Delimiter">(</span>i<span class="Delimiter">);</span> <span id="L106" class="LineNr">106 </span> <span class="Delimiter">}</span> <span id="L107" class="LineNr">107 </span> string command = <a href='003trace.cc.html#L394'>trim</a><span class="Delimiter">(</span><a href='101run_sandboxed.cc.html#L494'>strip_comments</a><span class="Delimiter">(</span><a href='038new_text.cc.html#L142'>read_mu_text</a><span class="Delimiter">(</span><a href='043space.cc.html#L101'>address</a><span class="Delimiter">)));</span> <span id="L108" class="LineNr">108 </span><span class="CommentedCode">//? cerr << "command: " << command << '\n';</span> -<span id="L109" class="LineNr">109 </span> Name[get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"interactive"</span><span class="Delimiter">)</span>]<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L109" class="LineNr">109 </span> <span class="Special">Name</span>[get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"interactive"</span><span class="Delimiter">)</span>]<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L110" class="LineNr">110 </span> <a href='101run_sandboxed.cc.html#L153'>run_code_begin</a><span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">should_stash_snapshots</span><span class="Comment">*/</span><span class="Constant">true</span><span class="Delimiter">);</span> <span id="L111" class="LineNr">111 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>command<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L112" class="LineNr">112 </span> <span class="Comment">// don't kill the current routine on parse errors</span> -<span id="L113" class="LineNr">113 </span> routine* save_current_routine = Current_routine<span class="Delimiter">;</span> -<span id="L114" class="LineNr">114 </span> Current_routine = <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L113" class="LineNr">113 </span> routine* save_current_routine = <span class="Special">Current_routine</span><span class="Delimiter">;</span> +<span id="L114" class="LineNr">114 </span> <span class="Special">Current_routine</span> = <span class="Constant">NULL</span><span class="Delimiter">;</span> <span id="L115" class="LineNr">115 </span> <span class="Comment">// call run(string) but without the scheduling</span> -<span id="L116" class="LineNr">116 </span> load<span class="Delimiter">(</span>string<span class="Delimiter">(</span><span class="Constant">"recipe! interactive [</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">)</span> + -<span id="L117" class="LineNr">117 </span> <span class="Constant">"local-scope</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L118" class="LineNr">118 </span> <span class="Constant">"screen:&:screen <- next-ingredient</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L119" class="LineNr">119 </span> <span class="Constant">"$start-tracking-products</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L120" class="LineNr">120 </span> command + <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L121" class="LineNr">121 </span> <span class="Constant">"$stop-tracking-products</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L122" class="LineNr">122 </span> <span class="Constant">"return screen</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L123" class="LineNr">123 </span> <span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L116" class="LineNr">116 </span> load<span class="Delimiter">(</span>string<span class="Delimiter">(</span><span class="Constant">"recipe! interactive [\n"</span><span class="Delimiter">)</span> + +<span id="L117" class="LineNr">117 </span> <span class="Constant">"local-scope\n"</span> + +<span id="L118" class="LineNr">118 </span> <span class="Constant">"screen:&:screen <- next-ingredient\n"</span> + +<span id="L119" class="LineNr">119 </span> <span class="Constant">"$start-tracking-products\n"</span> + +<span id="L120" class="LineNr">120 </span> command + <span class="Constant">"\n"</span> + +<span id="L121" class="LineNr">121 </span> <span class="Constant">"$stop-tracking-products\n"</span> + +<span id="L122" class="LineNr">122 </span> <span class="Constant">"return screen\n"</span> + +<span id="L123" class="LineNr">123 </span> <span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L124" class="LineNr">124 </span> <a href='012transform.cc.html#L46'>transform_all</a><span class="Delimiter">();</span> -<span id="L125" class="LineNr">125 </span> Current_routine = save_current_routine<span class="Delimiter">;</span> +<span id="L125" class="LineNr">125 </span> <span class="Special">Current_routine</span> = save_current_routine<span class="Delimiter">;</span> <span id="L126" class="LineNr">126 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>trace_count<span class="Delimiter">(</span><span class="Constant">"error"</span><span class="Delimiter">)</span> > <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L127" class="LineNr">127 </span> <span class="Comment">// now call 'sandbox' which will run 'interactive' in a separate routine,</span> <span id="L128" class="LineNr">128 </span> <span class="Comment">// and wait for it</span> -<span id="L129" class="LineNr">129 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>Save_trace_stream<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L130" class="LineNr">130 </span> ++Save_trace_stream<span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> -<span id="L131" class="LineNr">131 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9999</span><span class="Delimiter">,</span> <span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"run-sandboxed: incrementing callstack depth to "</span> << Save_trace_stream<span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> -<span id="L132" class="LineNr">132 </span> assert<span class="Delimiter">(</span>Save_trace_stream<span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> +<span id="L129" class="LineNr">129 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Save_trace_stream</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L130" class="LineNr">130 </span> ++<span class="Special">Save_trace_stream</span><span class="Delimiter">-></span>callstack_depth<span class="Delimiter">;</span> +<span id="L131" class="LineNr">131 </span> <a href='003trace.cc.html#L189'>trace</a><span class="Delimiter">(</span><span class="Constant">9999</span><span class="Delimiter">,</span> <span class="Constant">"trace"</span><span class="Delimiter">)</span> << <span class="Constant">"run-sandboxed: incrementing callstack depth to "</span> << <span class="Special">Save_trace_stream</span><span class="Delimiter">-></span>callstack_depth << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> +<span id="L132" class="LineNr">132 </span> assert<span class="Delimiter">(</span><span class="Special">Save_trace_stream</span><span class="Delimiter">-></span>callstack_depth < <span class="Constant">9000</span><span class="Delimiter">);</span> <span class="Comment">// 9998-101 plus cushion</span> <span id="L133" class="LineNr">133 </span> <span class="Delimiter">}</span> -<span id="L134" class="LineNr">134 </span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>call<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"sandbox"</span><span class="Delimiter">)));</span> +<span id="L134" class="LineNr">134 </span> <span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>call<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"sandbox"</span><span class="Delimiter">)));</span> <span id="L135" class="LineNr">135 </span> <span class="Identifier">return</span><span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L136" class="LineNr">136 </span><span class="Delimiter">}</span> <span id="L137" class="LineNr">137 </span> <span id="L138" class="LineNr">138 </span><span class="Comment">//: Carefully update all state to exactly how it was -- including snapshots.</span> <span id="L139" class="LineNr">139 </span> <span id="L140" class="LineNr">140 </span><span class="Delimiter">:(before "End Globals")</span> -<span id="L141" class="LineNr">141 </span><span class="Normal">bool</span> Run_profiler_stash =<span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L142" class="LineNr">142 </span>map<string<span class="Delimiter">,</span> recipe_ordinal> Recipe_ordinal_snapshot_stash<span class="Delimiter">;</span> -<span id="L143" class="LineNr">143 </span>map<recipe_ordinal<span class="Delimiter">,</span> recipe> Recipe_snapshot_stash<span class="Delimiter">;</span> -<span id="L144" class="LineNr">144 </span>map<string<span class="Delimiter">,</span> type_ordinal> Type_ordinal_snapshot_stash<span class="Delimiter">;</span> -<span id="L145" class="LineNr">145 </span>map<type_ordinal<span class="Delimiter">,</span> type_info> Type_snapshot_stash<span class="Delimiter">;</span> -<span id="L146" class="LineNr">146 </span>map<recipe_ordinal<span class="Delimiter">,</span> map<string<span class="Delimiter">,</span> <span class="Normal">int</span>> > Name_snapshot_stash<span class="Delimiter">;</span> -<span id="L147" class="LineNr">147 </span>map<string<span class="Delimiter">,</span> vector<recipe_ordinal> > Recipe_variants_snapshot_stash<span class="Delimiter">;</span> -<span id="L148" class="LineNr">148 </span>map<string<span class="Delimiter">,</span> type_tree*> Type_abbreviations_snapshot_stash<span class="Delimiter">;</span> -<span id="L149" class="LineNr">149 </span>vector<scenario> Scenarios_snapshot_stash<span class="Delimiter">;</span> -<span id="L150" class="LineNr">150 </span>set<string> Scenario_names_snapshot_stash<span class="Delimiter">;</span> +<span id="L141" class="LineNr">141 </span><span class="Normal">bool</span> <span class="Special">Run_profiler_stash</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L142" class="LineNr">142 </span>map<string<span class="Delimiter">,</span> recipe_ordinal> <span class="Special">Recipe_ordinal_snapshot_stash</span><span class="Delimiter">;</span> +<span id="L143" class="LineNr">143 </span>map<recipe_ordinal<span class="Delimiter">,</span> recipe> <span class="Special">Recipe_snapshot_stash</span><span class="Delimiter">;</span> +<span id="L144" class="LineNr">144 </span>map<string<span class="Delimiter">,</span> type_ordinal> <span class="Special">Type_ordinal_snapshot_stash</span><span class="Delimiter">;</span> +<span id="L145" class="LineNr">145 </span>map<type_ordinal<span class="Delimiter">,</span> type_info> <span class="Special">Type_snapshot_stash</span><span class="Delimiter">;</span> +<span id="L146" class="LineNr">146 </span>map<recipe_ordinal<span class="Delimiter">,</span> map<string<span class="Delimiter">,</span> <span class="Normal">int</span>> > <span class="Special">Name_snapshot_stash</span><span class="Delimiter">;</span> +<span id="L147" class="LineNr">147 </span>map<string<span class="Delimiter">,</span> vector<recipe_ordinal> > <span class="Special">Recipe_variants_snapshot_stash</span><span class="Delimiter">;</span> +<span id="L148" class="LineNr">148 </span>map<string<span class="Delimiter">,</span> type_tree*> <span class="Special">Type_abbreviations_snapshot_stash</span><span class="Delimiter">;</span> +<span id="L149" class="LineNr">149 </span>vector<scenario> <span class="Special">Scenarios_snapshot_stash</span><span class="Delimiter">;</span> +<span id="L150" class="LineNr">150 </span>set<string> <span class="Special">Scenario_names_snapshot_stash</span><span class="Delimiter">;</span> <span id="L151" class="LineNr">151 </span> <span id="L152" class="LineNr">152 </span><span class="Delimiter">:(code)</span> <span id="L153" class="LineNr">153 </span><span class="Normal">void</span> <a href='101run_sandboxed.cc.html#L153'>run_code_begin</a><span class="Delimiter">(</span><span class="Normal">bool</span> should_stash_snapshots<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L154" class="LineNr">154 </span> <span class="Comment">// stuff to undo later, in run_code_end()</span> -<span id="L155" class="LineNr">155 </span> Hide_errors =<span class="Constant"> true</span><span class="Delimiter">;</span> -<span id="L156" class="LineNr">156 </span> Disable_redefine_checks =<span class="Constant"> true</span><span class="Delimiter">;</span> -<span id="L157" class="LineNr">157 </span> Run_profiler_stash = Run_profiler<span class="Delimiter">;</span> -<span id="L158" class="LineNr">158 </span> Run_profiler =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L155" class="LineNr">155 </span> <span class="Special">Hide_errors</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L156" class="LineNr">156 </span> <span class="Special">Disable_redefine_checks</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L157" class="LineNr">157 </span> <span class="Special">Run_profiler_stash</span> = <span class="Special">Run_profiler</span><span class="Delimiter">;</span> +<span id="L158" class="LineNr">158 </span> <span class="Special">Run_profiler</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L159" class="LineNr">159 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>should_stash_snapshots<span class="Delimiter">)</span> <span id="L160" class="LineNr">160 </span> <a href='101run_sandboxed.cc.html#L184'>stash_snapshots</a><span class="Delimiter">();</span> -<span id="L161" class="LineNr">161 </span> Save_trace_stream = Trace_stream<span class="Delimiter">;</span> -<span id="L162" class="LineNr">162 </span> Trace_stream = <span class="Normal">new</span> trace_stream<span class="Delimiter">;</span> -<span id="L163" class="LineNr">163 </span> Trace_stream<span class="Delimiter">-></span>collect_depth = App_depth<span class="Delimiter">;</span> +<span id="L161" class="LineNr">161 </span> <span class="Special">Save_trace_stream</span> = <span class="Special">Trace_stream</span><span class="Delimiter">;</span> +<span id="L162" class="LineNr">162 </span> <span class="Special">Trace_stream</span> = <span class="Normal">new</span> trace_stream<span class="Delimiter">;</span> +<span id="L163" class="LineNr">163 </span> <span class="Special">Trace_stream</span><span class="Delimiter">-></span>collect_depth = <span class="Special">App_depth</span><span class="Delimiter">;</span> <span id="L164" class="LineNr">164 </span><span class="Delimiter">}</span> <span id="L165" class="LineNr">165 </span> <span id="L166" class="LineNr">166 </span><span class="Normal">void</span> <a href='101run_sandboxed.cc.html#L166'>run_code_end</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L167" class="LineNr">167 </span> Hide_errors =<span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L168" class="LineNr">168 </span> Disable_redefine_checks =<span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L169" class="LineNr">169 </span> Run_profiler = Run_profiler_stash<span class="Delimiter">;</span> -<span id="L170" class="LineNr">170 </span> Run_profiler_stash =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L167" class="LineNr">167 </span> <span class="Special">Hide_errors</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L168" class="LineNr">168 </span> <span class="Special">Disable_redefine_checks</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L169" class="LineNr">169 </span> <span class="Special">Run_profiler</span> = <span class="Special">Run_profiler_stash</span><span class="Delimiter">;</span> +<span id="L170" class="LineNr">170 </span> <span class="Special">Run_profiler_stash</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L171" class="LineNr">171 </span><span class="CommentedCode">//? ofstream fout("sandbox.log");</span> <span id="L172" class="LineNr">172 </span><span class="CommentedCode">//? fout << Trace_stream->readable_contents("");</span> <span id="L173" class="LineNr">173 </span><span class="CommentedCode">//? fout.close();</span> -<span id="L174" class="LineNr">174 </span> <span class="Normal">delete</span> Trace_stream<span class="Delimiter">;</span> -<span id="L175" class="LineNr">175 </span> Trace_stream = Save_trace_stream<span class="Delimiter">;</span> -<span id="L176" class="LineNr">176 </span> Save_trace_stream = <span class="Constant">NULL</span><span class="Delimiter">;</span> -<span id="L177" class="LineNr">177 </span> Save_trace_file<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L178" class="LineNr">178 </span> Recipe<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"interactive"</span><span class="Delimiter">));</span> <span class="Comment">// keep past sandboxes from inserting errors</span> -<span id="L179" class="LineNr">179 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Recipe_snapshot_stash<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> +<span id="L174" class="LineNr">174 </span> <span class="Normal">delete</span> <span class="Special">Trace_stream</span><span class="Delimiter">;</span> +<span id="L175" class="LineNr">175 </span> <span class="Special">Trace_stream</span> = <span class="Special">Save_trace_stream</span><span class="Delimiter">;</span> +<span id="L176" class="LineNr">176 </span> <span class="Special">Save_trace_stream</span> = <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L177" class="LineNr">177 </span> <span class="Special">Save_trace_file</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L178" class="LineNr">178 </span> <span class="Special">Recipe</span><span class="Delimiter">.</span>erase<span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"interactive"</span><span class="Delimiter">));</span> <span class="Comment">// keep past sandboxes from inserting errors</span> +<span id="L179" class="LineNr">179 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Recipe_snapshot_stash</span><span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span id="L180" class="LineNr">180 </span> <a href='101run_sandboxed.cc.html#L205'>unstash_snapshots</a><span class="Delimiter">();</span> <span id="L181" class="LineNr">181 </span><span class="Delimiter">}</span> <span id="L182" class="LineNr">182 </span> <span id="L183" class="LineNr">183 </span><span class="Comment">// keep sync'd with save_snapshots and restore_snapshots</span> <span id="L184" class="LineNr">184 </span><span class="Normal">void</span> <a href='101run_sandboxed.cc.html#L184'>stash_snapshots</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L185" class="LineNr">185 </span> assert<span class="Delimiter">(</span>Recipe_ordinal_snapshot_stash<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L186" class="LineNr">186 </span> Recipe_ordinal_snapshot_stash = Recipe_ordinal_snapshot<span class="Delimiter">;</span> -<span id="L187" class="LineNr">187 </span> assert<span class="Delimiter">(</span>Recipe_snapshot_stash<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L188" class="LineNr">188 </span> Recipe_snapshot_stash = Recipe_snapshot<span class="Delimiter">;</span> -<span id="L189" class="LineNr">189 </span> assert<span class="Delimiter">(</span>Type_ordinal_snapshot_stash<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L190" class="LineNr">190 </span> Type_ordinal_snapshot_stash = Type_ordinal_snapshot<span class="Delimiter">;</span> -<span id="L191" class="LineNr">191 </span> assert<span class="Delimiter">(</span>Type_snapshot_stash<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L192" class="LineNr">192 </span> Type_snapshot_stash = Type_snapshot<span class="Delimiter">;</span> -<span id="L193" class="LineNr">193 </span> assert<span class="Delimiter">(</span>Name_snapshot_stash<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L194" class="LineNr">194 </span> Name_snapshot_stash = Name_snapshot<span class="Delimiter">;</span> -<span id="L195" class="LineNr">195 </span> assert<span class="Delimiter">(</span>Recipe_variants_snapshot_stash<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L196" class="LineNr">196 </span> Recipe_variants_snapshot_stash = Recipe_variants_snapshot<span class="Delimiter">;</span> -<span id="L197" class="LineNr">197 </span> assert<span class="Delimiter">(</span>Type_abbreviations_snapshot_stash<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L198" class="LineNr">198 </span> Type_abbreviations_snapshot_stash = Type_abbreviations_snapshot<span class="Delimiter">;</span> -<span id="L199" class="LineNr">199 </span> assert<span class="Delimiter">(</span>Scenarios_snapshot_stash<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L200" class="LineNr">200 </span> Scenarios_snapshot_stash = Scenarios_snapshot<span class="Delimiter">;</span> -<span id="L201" class="LineNr">201 </span> assert<span class="Delimiter">(</span>Scenario_names_snapshot_stash<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> -<span id="L202" class="LineNr">202 </span> Scenario_names_snapshot_stash = Scenario_names_snapshot<span class="Delimiter">;</span> +<span id="L185" class="LineNr">185 </span> assert<span class="Delimiter">(</span><span class="Special">Recipe_ordinal_snapshot_stash</span><span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L186" class="LineNr">186 </span> <span class="Special">Recipe_ordinal_snapshot_stash</span> = <span class="Special">Recipe_ordinal_snapshot</span><span class="Delimiter">;</span> +<span id="L187" class="LineNr">187 </span> assert<span class="Delimiter">(</span><span class="Special">Recipe_snapshot_stash</span><span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L188" class="LineNr">188 </span> <span class="Special">Recipe_snapshot_stash</span> = <span class="Special">Recipe_snapshot</span><span class="Delimiter">;</span> +<span id="L189" class="LineNr">189 </span> assert<span class="Delimiter">(</span><span class="Special">Type_ordinal_snapshot_stash</span><span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L190" class="LineNr">190 </span> <span class="Special">Type_ordinal_snapshot_stash</span> = <span class="Special">Type_ordinal_snapshot</span><span class="Delimiter">;</span> +<span id="L191" class="LineNr">191 </span> assert<span class="Delimiter">(</span><span class="Special">Type_snapshot_stash</span><span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L192" class="LineNr">192 </span> <span class="Special">Type_snapshot_stash</span> = <span class="Special">Type_snapshot</span><span class="Delimiter">;</span> +<span id="L193" class="LineNr">193 </span> assert<span class="Delimiter">(</span><span class="Special">Name_snapshot_stash</span><span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L194" class="LineNr">194 </span> <span class="Special">Name_snapshot_stash</span> = <span class="Special">Name_snapshot</span><span class="Delimiter">;</span> +<span id="L195" class="LineNr">195 </span> assert<span class="Delimiter">(</span><span class="Special">Recipe_variants_snapshot_stash</span><span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L196" class="LineNr">196 </span> <span class="Special">Recipe_variants_snapshot_stash</span> = <span class="Special">Recipe_variants_snapshot</span><span class="Delimiter">;</span> +<span id="L197" class="LineNr">197 </span> assert<span class="Delimiter">(</span><span class="Special">Type_abbreviations_snapshot_stash</span><span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L198" class="LineNr">198 </span> <span class="Special">Type_abbreviations_snapshot_stash</span> = <span class="Special">Type_abbreviations_snapshot</span><span class="Delimiter">;</span> +<span id="L199" class="LineNr">199 </span> assert<span class="Delimiter">(</span><span class="Special">Scenarios_snapshot_stash</span><span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L200" class="LineNr">200 </span> <span class="Special">Scenarios_snapshot_stash</span> = <span class="Special">Scenarios_snapshot</span><span class="Delimiter">;</span> +<span id="L201" class="LineNr">201 </span> assert<span class="Delimiter">(</span><span class="Special">Scenario_names_snapshot_stash</span><span class="Delimiter">.</span>empty<span class="Delimiter">());</span> +<span id="L202" class="LineNr">202 </span> <span class="Special">Scenario_names_snapshot_stash</span> = <span class="Special">Scenario_names_snapshot</span><span class="Delimiter">;</span> <span id="L203" class="LineNr">203 </span> save_snapshots<span class="Delimiter">();</span> <span id="L204" class="LineNr">204 </span><span class="Delimiter">}</span> <span id="L205" class="LineNr">205 </span><span class="Normal">void</span> <a href='101run_sandboxed.cc.html#L205'>unstash_snapshots</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> <span id="L206" class="LineNr">206 </span> restore_snapshots<span class="Delimiter">();</span> -<span id="L207" class="LineNr">207 </span> Recipe_ordinal_snapshot = Recipe_ordinal_snapshot_stash<span class="Delimiter">;</span> Recipe_ordinal_snapshot_stash<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L208" class="LineNr">208 </span> Recipe_snapshot = Recipe_snapshot_stash<span class="Delimiter">;</span> Recipe_snapshot_stash<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L209" class="LineNr">209 </span> Type_ordinal_snapshot = Type_ordinal_snapshot_stash<span class="Delimiter">;</span> Type_ordinal_snapshot_stash<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L210" class="LineNr">210 </span> Type_snapshot = Type_snapshot_stash<span class="Delimiter">;</span> Type_snapshot_stash<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L211" class="LineNr">211 </span> Name_snapshot = Name_snapshot_stash<span class="Delimiter">;</span> Name_snapshot_stash<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L212" class="LineNr">212 </span> Recipe_variants_snapshot = Recipe_variants_snapshot_stash<span class="Delimiter">;</span> Recipe_variants_snapshot_stash<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L213" class="LineNr">213 </span> Type_abbreviations_snapshot = Type_abbreviations_snapshot_stash<span class="Delimiter">;</span> Type_abbreviations_snapshot_stash<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L214" class="LineNr">214 </span> Scenarios_snapshot = Scenarios_snapshot_stash<span class="Delimiter">;</span> Scenarios_snapshot_stash<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> -<span id="L215" class="LineNr">215 </span> Scenario_names_snapshot = Scenario_names_snapshot_stash<span class="Delimiter">;</span> Scenario_names_snapshot_stash<span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L207" class="LineNr">207 </span> <span class="Special">Recipe_ordinal_snapshot</span> = <span class="Special">Recipe_ordinal_snapshot_stash</span><span class="Delimiter">;</span> <span class="Special">Recipe_ordinal_snapshot_stash</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L208" class="LineNr">208 </span> <span class="Special">Recipe_snapshot</span> = <span class="Special">Recipe_snapshot_stash</span><span class="Delimiter">;</span> <span class="Special">Recipe_snapshot_stash</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L209" class="LineNr">209 </span> <span class="Special">Type_ordinal_snapshot</span> = <span class="Special">Type_ordinal_snapshot_stash</span><span class="Delimiter">;</span> <span class="Special">Type_ordinal_snapshot_stash</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L210" class="LineNr">210 </span> <span class="Special">Type_snapshot</span> = <span class="Special">Type_snapshot_stash</span><span class="Delimiter">;</span> <span class="Special">Type_snapshot_stash</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L211" class="LineNr">211 </span> <span class="Special">Name_snapshot</span> = <span class="Special">Name_snapshot_stash</span><span class="Delimiter">;</span> <span class="Special">Name_snapshot_stash</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L212" class="LineNr">212 </span> <span class="Special">Recipe_variants_snapshot</span> = <span class="Special">Recipe_variants_snapshot_stash</span><span class="Delimiter">;</span> <span class="Special">Recipe_variants_snapshot_stash</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L213" class="LineNr">213 </span> <span class="Special">Type_abbreviations_snapshot</span> = <span class="Special">Type_abbreviations_snapshot_stash</span><span class="Delimiter">;</span> <span class="Special">Type_abbreviations_snapshot_stash</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L214" class="LineNr">214 </span> <span class="Special">Scenarios_snapshot</span> = <span class="Special">Scenarios_snapshot_stash</span><span class="Delimiter">;</span> <span class="Special">Scenarios_snapshot_stash</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> +<span id="L215" class="LineNr">215 </span> <span class="Special">Scenario_names_snapshot</span> = <span class="Special">Scenario_names_snapshot_stash</span><span class="Delimiter">;</span> <span class="Special">Scenario_names_snapshot_stash</span><span class="Delimiter">.</span><a href='050scenario.cc.html#L60'>clear</a><span class="Delimiter">();</span> <span id="L216" class="LineNr">216 </span><span class="Delimiter">}</span> <span id="L217" class="LineNr">217 </span> <span id="L218" class="LineNr">218 </span><span class="Delimiter">:(before "End Mu Prelude")</span> <span id="L219" class="LineNr">219 </span>load<span class="Delimiter">(</span>string<span class="Delimiter">(</span> -<span id="L220" class="LineNr">220 </span><span class="Constant">"recipe interactive [</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">)</span> + <span class="Comment">// just a dummy version to initialize the Recipe_ordinal and so on</span> -<span id="L221" class="LineNr">221 </span><span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L222" class="LineNr">222 </span><span class="Constant">"recipe sandbox [</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L223" class="LineNr">223 </span> <span class="Constant">"local-scope</span><span class="cSpecial">\n</span><span class="Constant">"</span> + +<span id="L220" class="LineNr">220 </span><span class="Constant">"recipe interactive [\n"</span><span class="Delimiter">)</span> + <span class="Comment">// just a dummy version to initialize the Recipe_ordinal and so on</span> +<span id="L221" class="LineNr">221 </span><span class="Constant">"]\n"</span> + +<span id="L222" class="LineNr">222 </span><span class="Constant">"recipe sandbox [\n"</span> + +<span id="L223" class="LineNr">223 </span> <span class="Constant">"local-scope\n"</span> + <span id="L224" class="LineNr">224 </span><span class="CommentedCode">//? "$print [aaa] 10/newline\n" +</span> -<span id="L225" class="LineNr">225 </span> <span class="Constant">"screen:&:screen <- new-fake-screen 30, 5</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L226" class="LineNr">226 </span> <span class="Constant">"routine-id:num <- start-running interactive, screen</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L227" class="LineNr">227 </span> <span class="Constant">"limit-time routine-id, 100000/instructions</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L228" class="LineNr">228 </span> <span class="Constant">"wait-for-routine routine-id</span><span class="cSpecial">\n</span><span class="Constant">"</span> + +<span id="L225" class="LineNr">225 </span> <span class="Constant">"screen:&:screen <- new-fake-screen 30, 5\n"</span> + +<span id="L226" class="LineNr">226 </span> <span class="Constant">"routine-id:num <- start-running interactive, screen\n"</span> + +<span id="L227" class="LineNr">227 </span> <span class="Constant">"limit-time routine-id, 100000/instructions\n"</span> + +<span id="L228" class="LineNr">228 </span> <span class="Constant">"wait-for-routine routine-id\n"</span> + <span id="L229" class="LineNr">229 </span><span class="CommentedCode">//? "$print [bbb] 10/newline\n" +</span> -<span id="L230" class="LineNr">230 </span> <span class="Constant">"instructions-run:num <- number-of-instructions routine-id</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L231" class="LineNr">231 </span> <span class="Constant">"stash instructions-run [instructions run]</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L232" class="LineNr">232 </span> <span class="Constant">"sandbox-state:num <- routine-state routine-id</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L233" class="LineNr">233 </span> <span class="Constant">"completed?:bool <- equal sandbox-state, 1/completed</span><span class="cSpecial">\n</span><span class="Constant">"</span> + +<span id="L230" class="LineNr">230 </span> <span class="Constant">"instructions-run:num <- number-of-instructions routine-id\n"</span> + +<span id="L231" class="LineNr">231 </span> <span class="Constant">"stash instructions-run [instructions run]\n"</span> + +<span id="L232" class="LineNr">232 </span> <span class="Constant">"sandbox-state:num <- routine-state routine-id\n"</span> + +<span id="L233" class="LineNr">233 </span> <span class="Constant">"completed?:bool <- equal sandbox-state, 1/completed\n"</span> + <span id="L234" class="LineNr">234 </span><span class="CommentedCode">//? "$print [completed: ] completed? 10/newline\n" +</span> -<span id="L235" class="LineNr">235 </span> <span class="Constant">"output:text <- $most-recent-products</span><span class="cSpecial">\n</span><span class="Constant">"</span> + +<span id="L235" class="LineNr">235 </span> <span class="Constant">"output:text <- $most-recent-products\n"</span> + <span id="L236" class="LineNr">236 </span><span class="CommentedCode">//? "$print [zzz] 10/newline\n" +</span> <span id="L237" class="LineNr">237 </span><span class="CommentedCode">//? "$print output\n" +</span> -<span id="L238" class="LineNr">238 </span> <span class="Constant">"errors:text <- save-errors</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L239" class="LineNr">239 </span> <span class="Constant">"stashes:text <- save-app-trace</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L240" class="LineNr">240 </span> <span class="Constant">"$cleanup-run-sandboxed</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L241" class="LineNr">241 </span> <span class="Constant">"return output, errors, screen, stashes, completed?</span><span class="cSpecial">\n</span><span class="Constant">"</span> + -<span id="L242" class="LineNr">242 </span><span class="Constant">"]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> +<span id="L238" class="LineNr">238 </span> <span class="Constant">"errors:text <- save-errors\n"</span> + +<span id="L239" class="LineNr">239 </span> <span class="Constant">"stashes:text <- save-app-trace\n"</span> + +<span id="L240" class="LineNr">240 </span> <span class="Constant">"$cleanup-run-sandboxed\n"</span> + +<span id="L241" class="LineNr">241 </span> <span class="Constant">"return output, errors, screen, stashes, completed?\n"</span> + +<span id="L242" class="LineNr">242 </span><span class="Constant">"]\n"</span><span class="Delimiter">);</span> <span id="L243" class="LineNr">243 </span> <span id="L244" class="LineNr">244 </span><span class="Comment">//: adjust errors in the sandbox</span> <span id="L245" class="LineNr">245 </span><span class="Delimiter">:(before "End maybe(recipe_name) Special-cases")</span> @@ -320,36 +323,36 @@ if ('onhashchange' in window) { <span id="L257" class="LineNr">257 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L258" class="LineNr">258 </span>_START_TRACKING_PRODUCTS<span class="Delimiter">,</span> <span id="L259" class="LineNr">259 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L260" class="LineNr">260 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$start-tracking-products"</span><span class="Delimiter">,</span> _START_TRACKING_PRODUCTS<span class="Delimiter">);</span> +<span id="L260" class="LineNr">260 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$start-tracking-products"</span><span class="Delimiter">,</span> _START_TRACKING_PRODUCTS<span class="Delimiter">);</span> <span id="L261" class="LineNr">261 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L262" class="LineNr">262 </span><span class="Normal">case</span> _START_TRACKING_PRODUCTS: <span class="Delimiter">{</span> <span id="L263" class="LineNr">263 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L264" class="LineNr">264 </span><span class="Delimiter">}</span> <span id="L265" class="LineNr">265 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L266" class="LineNr">266 </span><span class="Normal">case</span> _START_TRACKING_PRODUCTS: <span class="Delimiter">{</span> -<span id="L267" class="LineNr">267 </span> Track_most_recent_products =<span class="Constant"> true</span><span class="Delimiter">;</span> -<span id="L268" class="LineNr">268 </span> Call_depth_to_track_most_recent_products_at = <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">);</span> +<span id="L267" class="LineNr">267 </span> <span class="Special">Track_most_recent_products</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L268" class="LineNr">268 </span> <span class="Special">Call_depth_to_track_most_recent_products_at</span> = <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">);</span> <span id="L269" class="LineNr">269 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L270" class="LineNr">270 </span><span class="Delimiter">}</span> <span id="L271" class="LineNr">271 </span> <span id="L272" class="LineNr">272 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L273" class="LineNr">273 </span>_STOP_TRACKING_PRODUCTS<span class="Delimiter">,</span> <span id="L274" class="LineNr">274 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L275" class="LineNr">275 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$stop-tracking-products"</span><span class="Delimiter">,</span> _STOP_TRACKING_PRODUCTS<span class="Delimiter">);</span> +<span id="L275" class="LineNr">275 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$stop-tracking-products"</span><span class="Delimiter">,</span> _STOP_TRACKING_PRODUCTS<span class="Delimiter">);</span> <span id="L276" class="LineNr">276 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L277" class="LineNr">277 </span><span class="Normal">case</span> _STOP_TRACKING_PRODUCTS: <span class="Delimiter">{</span> <span id="L278" class="LineNr">278 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L279" class="LineNr">279 </span><span class="Delimiter">}</span> <span id="L280" class="LineNr">280 </span><span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> <span id="L281" class="LineNr">281 </span><span class="Normal">case</span> _STOP_TRACKING_PRODUCTS: <span class="Delimiter">{</span> -<span id="L282" class="LineNr">282 </span> Track_most_recent_products =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L282" class="LineNr">282 </span> <span class="Special">Track_most_recent_products</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> <span id="L283" class="LineNr">283 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L284" class="LineNr">284 </span><span class="Delimiter">}</span> <span id="L285" class="LineNr">285 </span> <span id="L286" class="LineNr">286 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L287" class="LineNr">287 </span>_MOST_RECENT_PRODUCTS<span class="Delimiter">,</span> <span id="L288" class="LineNr">288 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L289" class="LineNr">289 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$most-recent-products"</span><span class="Delimiter">,</span> _MOST_RECENT_PRODUCTS<span class="Delimiter">);</span> +<span id="L289" class="LineNr">289 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$most-recent-products"</span><span class="Delimiter">,</span> _MOST_RECENT_PRODUCTS<span class="Delimiter">);</span> <span id="L290" class="LineNr">290 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L291" class="LineNr">291 </span><span class="Normal">case</span> _MOST_RECENT_PRODUCTS: <span class="Delimiter">{</span> <span id="L292" class="LineNr">292 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -358,14 +361,14 @@ if ('onhashchange' in window) { <span id="L295" class="LineNr">295 </span><span class="Normal">case</span> _MOST_RECENT_PRODUCTS: <span class="Delimiter">{</span> <span id="L296" class="LineNr">296 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L297" class="LineNr">297 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">alloc id</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">);</span> -<span id="L298" class="LineNr">298 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><a href='038new_text.cc.html#L39'>new_mu_text</a><span class="Delimiter">(</span>Most_recent_products<span class="Delimiter">));</span> +<span id="L298" class="LineNr">298 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><a href='038new_text.cc.html#L39'>new_mu_text</a><span class="Delimiter">(</span><span class="Special">Most_recent_products</span><span class="Delimiter">));</span> <span id="L299" class="LineNr">299 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L300" class="LineNr">300 </span><span class="Delimiter">}</span> <span id="L301" class="LineNr">301 </span> <span id="L302" class="LineNr">302 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L303" class="LineNr">303 </span>SAVE_ERRORS<span class="Delimiter">,</span> <span id="L304" class="LineNr">304 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L305" class="LineNr">305 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"save-errors"</span><span class="Delimiter">,</span> SAVE_ERRORS<span class="Delimiter">);</span> +<span id="L305" class="LineNr">305 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"save-errors"</span><span class="Delimiter">,</span> SAVE_ERRORS<span class="Delimiter">);</span> <span id="L306" class="LineNr">306 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L307" class="LineNr">307 </span><span class="Normal">case</span> SAVE_ERRORS: <span class="Delimiter">{</span> <span id="L308" class="LineNr">308 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -381,7 +384,7 @@ if ('onhashchange' in window) { <span id="L318" class="LineNr">318 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L319" class="LineNr">319 </span>SAVE_APP_TRACE<span class="Delimiter">,</span> <span id="L320" class="LineNr">320 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L321" class="LineNr">321 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"save-app-trace"</span><span class="Delimiter">,</span> SAVE_APP_TRACE<span class="Delimiter">);</span> +<span id="L321" class="LineNr">321 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"save-app-trace"</span><span class="Delimiter">,</span> SAVE_APP_TRACE<span class="Delimiter">);</span> <span id="L322" class="LineNr">322 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L323" class="LineNr">323 </span><span class="Normal">case</span> SAVE_APP_TRACE: <span class="Delimiter">{</span> <span id="L324" class="LineNr">324 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -397,7 +400,7 @@ if ('onhashchange' in window) { <span id="L334" class="LineNr">334 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L335" class="LineNr">335 </span>_CLEANUP_RUN_SANDBOXED<span class="Delimiter">,</span> <span id="L336" class="LineNr">336 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L337" class="LineNr">337 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"$cleanup-run-sandboxed"</span><span class="Delimiter">,</span> _CLEANUP_RUN_SANDBOXED<span class="Delimiter">);</span> +<span id="L337" class="LineNr">337 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"$cleanup-run-sandboxed"</span><span class="Delimiter">,</span> _CLEANUP_RUN_SANDBOXED<span class="Delimiter">);</span> <span id="L338" class="LineNr">338 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L339" class="LineNr">339 </span><span class="Normal">case</span> _CLEANUP_RUN_SANDBOXED: <span class="Delimiter">{</span> <span id="L340" class="LineNr">340 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -515,14 +518,14 @@ if ('onhashchange' in window) { <span id="L452" class="LineNr">452 </span><span class="traceContains">+mem: storing 0 in location 31</span> <span id="L453" class="LineNr">453 </span> <span id="L454" class="LineNr">454 </span><span class="Delimiter">:(after "Running One Instruction")</span> -<span id="L455" class="LineNr">455 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Track_most_recent_products && <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">)</span> == Call_depth_to_track_most_recent_products_at +<span id="L455" class="LineNr">455 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Track_most_recent_products</span> && <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">)</span> == <span class="Special">Call_depth_to_track_most_recent_products_at</span> <span id="L456" class="LineNr">456 </span> && !current_instruction<span class="Delimiter">().</span>is_label <span id="L457" class="LineNr">457 </span> && <a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">().</span>name != <span class="Constant">"$stop-tracking-products"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L458" class="LineNr">458 </span> Most_recent_products = <span class="Constant">""</span><span class="Delimiter">;</span> +<span id="L458" class="LineNr">458 </span> <span class="Special">Most_recent_products</span> = <span class="Constant">""</span><span class="Delimiter">;</span> <span id="L459" class="LineNr">459 </span><span class="Delimiter">}</span> <span id="L460" class="LineNr">460 </span><span class="Delimiter">:(before "End Running One Instruction")</span> -<span id="L461" class="LineNr">461 </span><span class="Normal">if</span> <span class="Delimiter">(</span>Track_most_recent_products && <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">)</span> == Call_depth_to_track_most_recent_products_at<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L462" class="LineNr">462 </span> Most_recent_products = <a href='101run_sandboxed.cc.html#L466'>track_most_recent_products</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">(),</span> products<span class="Delimiter">);</span> +<span id="L461" class="LineNr">461 </span><span class="Normal">if</span> <span class="Delimiter">(</span><span class="Special">Track_most_recent_products</span> && <a href='001help.cc.html#L141'>SIZE</a><span class="Delimiter">(</span><span class="Special">Current_routine</span><span class="Delimiter">-></span>calls<span class="Delimiter">)</span> == <span class="Special">Call_depth_to_track_most_recent_products_at</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L462" class="LineNr">462 </span> <span class="Special">Most_recent_products</span> = <a href='101run_sandboxed.cc.html#L466'>track_most_recent_products</a><span class="Delimiter">(</span><a href='026call.cc.html#L89'>current_instruction</a><span class="Delimiter">(),</span> products<span class="Delimiter">);</span> <span id="L463" class="LineNr">463 </span><span class="CommentedCode">//? cerr << "most recent products: " << Most_recent_products << '\n';</span> <span id="L464" class="LineNr">464 </span><span class="Delimiter">}</span> <span id="L465" class="LineNr">465 </span><span class="Delimiter">:(code)</span> @@ -571,14 +574,14 @@ if ('onhashchange' in window) { <span id="L508" class="LineNr">508 </span><span class="Normal">int</span> <a href='101run_sandboxed.cc.html#L508'>stringified_value_of_location</a><span class="Delimiter">(</span><span class="Normal">int</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L509" class="LineNr">509 </span> <span class="Comment">// convert to string</span> <span id="L510" class="LineNr">510 </span> ostringstream out<span class="Delimiter">;</span> -<span id="L511" class="LineNr">511 </span> out << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">));</span> +<span id="L511" class="LineNr">511 </span> out << no_scientific<span class="Delimiter">(</span><a href='001help.cc.html#L229'>get_or_insert</a><span class="Delimiter">(</span><span class="Special">Memory</span><span class="Delimiter">,</span> <a href='043space.cc.html#L101'>address</a><span class="Delimiter">));</span> <span id="L512" class="LineNr">512 </span> <span class="Identifier">return</span> <a href='038new_text.cc.html#L39'>new_mu_text</a><span class="Delimiter">(</span>out<span class="Delimiter">.</span>str<span class="Delimiter">());</span> <span id="L513" class="LineNr">513 </span><span class="Delimiter">}</span> <span id="L514" class="LineNr">514 </span> <span id="L515" class="LineNr">515 </span><span class="Normal">int</span> <a href='101run_sandboxed.cc.html#L515'>trace_error_contents</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L516" class="LineNr">516 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Trace_stream<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L516" class="LineNr">516 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L517" class="LineNr">517 </span> ostringstream out<span class="Delimiter">;</span> -<span id="L518" class="LineNr">518 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<trace_line>::iterator p = Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L518" class="LineNr">518 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<trace_line>::iterator p = <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L519" class="LineNr">519 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>p<span class="Delimiter">-></span>label != <span class="Constant">"error"</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L520" class="LineNr">520 </span> out << p<span class="Delimiter">-></span>contents<span class="Delimiter">;</span> <span id="L521" class="LineNr">521 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*--p<span class="Delimiter">-></span>contents<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> out << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> @@ -590,10 +593,10 @@ if ('onhashchange' in window) { <span id="L527" class="LineNr">527 </span><span class="Delimiter">}</span> <span id="L528" class="LineNr">528 </span> <span id="L529" class="LineNr">529 </span><span class="Normal">int</span> <a href='101run_sandboxed.cc.html#L529'>trace_app_contents</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L530" class="LineNr">530 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!Trace_stream<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> +<span id="L530" class="LineNr">530 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!<span class="Special">Trace_stream</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">0</span><span class="Delimiter">;</span> <span id="L531" class="LineNr">531 </span> ostringstream out<span class="Delimiter">;</span> -<span id="L532" class="LineNr">532 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<trace_line>::iterator p = Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != Trace_stream<span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L533" class="LineNr">533 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>p<span class="Delimiter">-></span>depth != App_depth<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> +<span id="L532" class="LineNr">532 </span> <span class="Normal">for</span> <span class="Delimiter">(</span>vector<trace_line>::iterator p = <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != <span class="Special">Trace_stream</span><span class="Delimiter">-></span>past_lines<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L533" class="LineNr">533 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>p<span class="Delimiter">-></span>depth != <span class="Special">App_depth</span><span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span id="L534" class="LineNr">534 </span> out << p<span class="Delimiter">-></span>contents<span class="Delimiter">;</span> <span id="L535" class="LineNr">535 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>*--p<span class="Delimiter">-></span>contents<span class="Delimiter">.</span><a href='003trace.cc.html#L225'>end</a><span class="Delimiter">()</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> out << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span id="L536" class="LineNr">536 </span> <span class="Delimiter">}</span> @@ -618,15 +621,15 @@ if ('onhashchange' in window) { <span id="L555" class="LineNr">555 </span><span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> <span id="L556" class="LineNr">556 </span>RELOAD<span class="Delimiter">,</span> <span id="L557" class="LineNr">557 </span><span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> -<span id="L558" class="LineNr">558 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">"reload"</span><span class="Delimiter">,</span> RELOAD<span class="Delimiter">);</span> +<span id="L558" class="LineNr">558 </span><a href='001help.cc.html#L221'>put</a><span class="Delimiter">(</span><span class="Special">Recipe_ordinal</span><span class="Delimiter">,</span> <span class="Constant">"reload"</span><span class="Delimiter">,</span> RELOAD<span class="Delimiter">);</span> <span id="L559" class="LineNr">559 </span><span class="Delimiter">:(before "End Primitive Recipe Checks")</span> <span id="L560" class="LineNr">560 </span><span class="Normal">case</span> RELOAD: <span class="Delimiter">{</span> <span id="L561" class="LineNr">561 </span> <span class="Normal">if</span> <span class="Delimiter">(</span><a href='001help.cc.html#L141'>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="L562" class="LineNr">562 </span> <a href='003trace.cc.html#L196'>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">"'reload' 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L562" class="LineNr">562 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"'reload' requires exactly one ingredient, but got '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L563" class="LineNr">563 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L564" class="LineNr">564 </span> <span class="Delimiter">}</span> <span id="L565" class="LineNr">565 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_text<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="L566" class="LineNr">566 </span> <a href='003trace.cc.html#L196'>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 'reload' should be a string, 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#L225'>end</a><span class="Delimiter">();</span> +<span id="L566" class="LineNr">566 </span> <a href='003trace.cc.html#L196'>raise</a> << <a href='013update_operation.cc.html#L25'>maybe</a><span class="Delimiter">(</span>get<span class="Delimiter">(</span><span class="Special">Recipe</span><span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"first ingredient of 'reload' should be a string, 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">"'\n"</span> << <a href='003trace.cc.html#L225'>end</a><span class="Delimiter">();</span> <span id="L567" class="LineNr">567 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span id="L568" class="LineNr">568 </span> <span class="Delimiter">}</span> <span id="L569" class="LineNr">569 </span> <span class="Identifier">break</span><span class="Delimiter">;</span> @@ -636,14 +639,14 @@ if ('onhashchange' in window) { <span id="L573" class="LineNr">573 </span> restore_non_recipe_snapshots<span class="Delimiter">();</span> <span id="L574" class="LineNr">574 </span> string code = <a href='038new_text.cc.html#L142'>read_mu_text</a><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="Comment">/*</span><span class="Comment">skip alloc id</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">));</span> <span id="L575" class="LineNr">575 </span> <a href='101run_sandboxed.cc.html#L153'>run_code_begin</a><span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">should_stash_snapshots</span><span class="Comment">*/</span><span class="Constant">false</span><span class="Delimiter">);</span> -<span id="L576" class="LineNr">576 </span> routine* save_current_routine = Current_routine<span class="Delimiter">;</span> -<span id="L577" class="LineNr">577 </span> Current_routine = <span class="Constant">NULL</span><span class="Delimiter">;</span> -<span id="L578" class="LineNr">578 </span> Sandbox_mode =<span class="Constant"> true</span><span class="Delimiter">;</span> +<span id="L576" class="LineNr">576 </span> routine* save_current_routine = <span class="Special">Current_routine</span><span class="Delimiter">;</span> +<span id="L577" class="LineNr">577 </span> <span class="Special">Current_routine</span> = <span class="Constant">NULL</span><span class="Delimiter">;</span> +<span id="L578" class="LineNr">578 </span> <span class="Special">Sandbox_mode</span> =<span class="Constant"> true</span><span class="Delimiter">;</span> <span id="L579" class="LineNr">579 </span> vector<recipe_ordinal> recipes_reloaded = load<span class="Delimiter">(</span>code<span class="Delimiter">);</span> <span id="L580" class="LineNr">580 </span> <a href='012transform.cc.html#L46'>transform_all</a><span class="Delimiter">();</span> -<span id="L581" class="LineNr">581 </span> Trace_stream<span class="Delimiter">-></span><a href='003trace.cc.html#L147'>newline</a><span class="Delimiter">();</span> <span class="Comment">// flush trace</span> -<span id="L582" class="LineNr">582 </span> Sandbox_mode =<span class="Constant"> false</span><span class="Delimiter">;</span> -<span id="L583" class="LineNr">583 </span> Current_routine = save_current_routine<span class="Delimiter">;</span> +<span id="L581" class="LineNr">581 </span> <span class="Special">Trace_stream</span><span class="Delimiter">-></span><a href='003trace.cc.html#L147'>newline</a><span class="Delimiter">();</span> <span class="Comment">// flush trace</span> +<span id="L582" class="LineNr">582 </span> <span class="Special">Sandbox_mode</span> =<span class="Constant"> false</span><span class="Delimiter">;</span> +<span id="L583" class="LineNr">583 </span> <span class="Special">Current_routine</span> = save_current_routine<span class="Delimiter">;</span> <span id="L584" class="LineNr">584 </span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> <span id="L585" class="LineNr">585 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><span class="Comment">/*</span><span class="Comment">alloc id</span><span class="Comment">*/</span><span class="Constant">0</span><span class="Delimiter">);</span> <span id="L586" class="LineNr">586 </span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span><a href='101run_sandboxed.cc.html#L515'>trace_error_contents</a><span class="Delimiter">());</span> diff --git a/html/998check_type_pointers.cc.html b/html/998check_type_pointers.cc.html index ba56ad81..4c809828 100644 --- a/html/998check_type_pointers.cc.html +++ b/html/998check_type_pointers.cc.html @@ -11,14 +11,16 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } -.LineNr { color: #444444; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Comment { color: #8080ff; } --> </style> @@ -52,6 +54,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/998check_type_pointers.cc'>https://github.com/akkartik/mu/blob/master/998check_type_pointers.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: enable this when tracking down null types</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: (but it interferes with edit/; since recipes created in the environment</span> diff --git a/html/999spaces.cc.html b/html/999spaces.cc.html index 2add52e4..bffc759a 100644 --- a/html/999spaces.cc.html +++ b/html/999spaces.cc.html @@ -11,15 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } --> </style> @@ -54,6 +57,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/999spaces.cc'>https://github.com/akkartik/mu/blob/master/999spaces.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Since different layers all carve out different parts of various namespaces</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: (recipes, memory, etc.) for their own use, there's no previous place where</span> @@ -67,9 +71,9 @@ if ('onhashchange' in window) { <span id="L10" class="LineNr">10 </span><span class="Comment">//: Locations 1-899 - reserved for tests</span> <span id="L11" class="LineNr">11 </span><span class="Comment">//: Locations 900-999 - reserved for predefined globals in Mu scenarios, like keyboard, screen, etc.</span> <span id="L12" class="LineNr">12 </span><span class="Delimiter">:(before "End Reset")</span> -<span id="L13" class="LineNr">13 </span>assert<span class="Delimiter">(</span>Max_variables_in_scenarios == <span class="Constant">900</span><span class="Delimiter">);</span> +<span id="L13" class="LineNr">13 </span>assert<span class="Delimiter">(</span><span class="Special">Max_variables_in_scenarios</span> == <span class="Constant">900</span><span class="Delimiter">);</span> <span id="L14" class="LineNr">14 </span><span class="Comment">//: Locations 1000 ('Reserved_for_tests') onward - available to the allocator in chunks of size Initial_memory_per_routine.</span> -<span id="L15" class="LineNr">15 </span>assert<span class="Delimiter">(</span>Reserved_for_tests == <span class="Constant">1000</span><span class="Delimiter">);</span> +<span id="L15" class="LineNr">15 </span>assert<span class="Delimiter">(</span><span class="Special">Reserved_for_tests</span> == <span class="Constant">1000</span><span class="Delimiter">);</span> <span id="L16" class="LineNr">16 </span> <span id="L17" class="LineNr">17 </span><span class="SalientComment">//:: Recipes</span> <span id="L18" class="LineNr">18 </span><span class="Comment">//:</span> @@ -77,7 +81,7 @@ if ('onhashchange' in window) { <span id="L20" class="LineNr">20 </span><span class="Comment">//: 1-199 - primitives</span> <span id="L21" class="LineNr">21 </span>assert<span class="Delimiter">(</span><a href='010vm.cc.html#L198'>MAX_PRIMITIVE_RECIPES</a> < <span class="Constant">200</span><span class="Delimiter">);</span> <span id="L22" class="LineNr">22 </span><span class="Comment">//: 200-999 - defined in .mu files as sequences of primitives</span> -<span id="L23" class="LineNr">23 </span>assert<span class="Delimiter">(</span>Next_recipe_ordinal == <span class="Constant">1000</span><span class="Delimiter">);</span> +<span id="L23" class="LineNr">23 </span>assert<span class="Delimiter">(</span><span class="Special">Next_recipe_ordinal</span> == <span class="Constant">1000</span><span class="Delimiter">);</span> <span id="L24" class="LineNr">24 </span><span class="Comment">//: 1000 onwards - reserved for tests, cleared between tests</span> <span id="L25" class="LineNr">25 </span> <span id="L26" class="LineNr">26 </span><span class="SalientComment">//:: Depths for tracing</span> @@ -85,8 +89,8 @@ if ('onhashchange' in window) { <span id="L28" class="LineNr">28 </span><span class="Comment">//: 0 - unused</span> <span id="L29" class="LineNr">29 </span><span class="Comment">//: 1-100 - app-level trace statements in Mu</span> <span id="L30" class="LineNr">30 </span><span class="Comment">//: 101-9989 - call-stack statements (mostly label run)</span> -<span id="L31" class="LineNr">31 </span>assert<span class="Delimiter">(</span>Initial_callstack_depth == <span class="Constant">101</span><span class="Delimiter">);</span> -<span id="L32" class="LineNr">32 </span>assert<span class="Delimiter">(</span>Max_callstack_depth == <span class="Constant">9989</span><span class="Delimiter">);</span> +<span id="L31" class="LineNr">31 </span>assert<span class="Delimiter">(</span><span class="Special">Initial_callstack_depth</span> == <span class="Constant">101</span><span class="Delimiter">);</span> +<span id="L32" class="LineNr">32 </span>assert<span class="Delimiter">(</span><span class="Special">Max_callstack_depth</span> == <span class="Constant">9989</span><span class="Delimiter">);</span> <span id="L33" class="LineNr">33 </span><span class="Comment">//: 9990-9999 - intra-instruction lines (mostly label mem)</span> <span id="L34" class="LineNr">34 </span> <span id="L35" class="LineNr">35 </span><span class="SalientComment">//:: Summary of transforms and their dependencies</span> diff --git a/html/channel.mu.html b/html/channel.mu.html index 55201f33..98e30a8a 100644 --- a/html/channel.mu.html +++ b/html/channel.mu.html @@ -11,18 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -56,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/channel.mu'>https://github.com/akkartik/mu/blob/master/channel.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># example program: communicating between routines using channels</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/chessboard.mu.html b/html/chessboard.mu.html index 3cb915ef..6c4d882a 100644 --- a/html/chessboard.mu.html +++ b/html/chessboard.mu.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } -.muControl { color: #c0a020; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } --> </style> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/chessboard.mu'>https://github.com/akkartik/mu/blob/master/chessboard.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Chessboard program: you type in moves in algebraic notation, and it'll</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># display the position after each move.</span> diff --git a/html/console.mu.html b/html/console.mu.html index 01572445..6943a358 100644 --- a/html/console.mu.html +++ b/html/console.mu.html @@ -11,18 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -56,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/console.mu'>https://github.com/akkartik/mu/blob/master/console.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># example program: reading events from keyboard or mouse</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">#</span> diff --git a/html/continuation1.mu.html b/html/continuation1.mu.html index 3f9df7df..29efdcbd 100644 --- a/html/continuation1.mu.html +++ b/html/continuation1.mu.html @@ -11,17 +11,19 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -55,6 +57,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/continuation1.mu'>https://github.com/akkartik/mu/blob/master/continuation1.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Example program showing that 'return-continuation-until-mark' can 'pause' a</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># function call, returning a continuation, and that calling the continuation</span> diff --git a/html/continuation2.mu.html b/html/continuation2.mu.html index cc796796..b447d0cb 100644 --- a/html/continuation2.mu.html +++ b/html/continuation2.mu.html @@ -11,18 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -56,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/continuation2.mu'>https://github.com/akkartik/mu/blob/master/continuation2.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Example program showing that a 'paused' continuation can be 'resumed'</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># multiple times from the same point (but with changes to data).</span> diff --git a/html/continuation3.mu.html b/html/continuation3.mu.html index 2eae301f..2c244a36 100644 --- a/html/continuation3.mu.html +++ b/html/continuation3.mu.html @@ -11,17 +11,19 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -55,6 +57,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/continuation3.mu'>https://github.com/akkartik/mu/blob/master/continuation3.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Example program showing that a function call can be 'paused' multiple times,</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># creating different continuation values.</span> diff --git a/html/continuation4.mu.html b/html/continuation4.mu.html index 84e000c1..928260c0 100644 --- a/html/continuation4.mu.html +++ b/html/continuation4.mu.html @@ -11,18 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -56,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/continuation4.mu'>https://github.com/akkartik/mu/blob/master/continuation4.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Example program showing 'return-continuation-until-mark' return other values</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># alongside continuations.</span> diff --git a/html/continuation5.mu.html b/html/continuation5.mu.html index 2d3cf494..0d0fdf49 100644 --- a/html/continuation5.mu.html +++ b/html/continuation5.mu.html @@ -11,18 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -56,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/continuation5.mu'>https://github.com/akkartik/mu/blob/master/continuation5.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Example program showing that a 'paused' continuation can be 'resumed' with</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># inputs.</span> diff --git a/html/counters.mu.html b/html/counters.mu.html index fcd14576..530eec3c 100644 --- a/html/counters.mu.html +++ b/html/counters.mu.html @@ -11,16 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -54,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/counters.mu'>https://github.com/akkartik/mu/blob/master/counters.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># example program: maintain multiple counters with isolated lexical scopes</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># (spaces)</span> diff --git a/html/display.mu.html b/html/display.mu.html index 255c43fc..13ae0e6e 100644 --- a/html/display.mu.html +++ b/html/display.mu.html @@ -11,16 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -54,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/display.mu'>https://github.com/akkartik/mu/blob/master/display.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># example program: managing the display</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/edit/001-editor.mu.html b/html/edit/001-editor.mu.html index 09d025f3..2646fefc 100644 --- a/html/edit/001-editor.mu.html +++ b/html/edit/001-editor.mu.html @@ -61,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/edit/001-editor.mu'>https://github.com/akkartik/mu/blob/master/edit/001-editor.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">## the basic editor data structure, and how it displays text to the screen</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/edit/002-typing.mu.html b/html/edit/002-typing.mu.html index 1310d6a1..518644c2 100644 --- a/html/edit/002-typing.mu.html +++ b/html/edit/002-typing.mu.html @@ -61,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/edit/002-typing.mu'>https://github.com/akkartik/mu/blob/master/edit/002-typing.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">## handling events from the keyboard, mouse, touch screen, ...</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/edit/003-shortcuts.mu.html b/html/edit/003-shortcuts.mu.html index b255b58d..e4bb3480 100644 --- a/html/edit/003-shortcuts.mu.html +++ b/html/edit/003-shortcuts.mu.html @@ -60,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/edit/003-shortcuts.mu'>https://github.com/akkartik/mu/blob/master/edit/003-shortcuts.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">## special shortcuts for manipulating the editor</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># Some keys on the keyboard generate unicode characters, others generate</span> diff --git a/html/edit/004-programming-environment.mu.html b/html/edit/004-programming-environment.mu.html index 338e556e..f84126d0 100644 --- a/html/edit/004-programming-environment.mu.html +++ b/html/edit/004-programming-environment.mu.html @@ -61,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/edit/004-programming-environment.mu'>https://github.com/akkartik/mu/blob/master/edit/004-programming-environment.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">## putting the environment together out of editors</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">#</span> diff --git a/html/edit/005-sandbox.mu.html b/html/edit/005-sandbox.mu.html index 10a888c3..fd7ce4a1 100644 --- a/html/edit/005-sandbox.mu.html +++ b/html/edit/005-sandbox.mu.html @@ -61,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/edit/005-sandbox.mu'>https://github.com/akkartik/mu/blob/master/edit/005-sandbox.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">## running code from the editor and creating sandboxes</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">#</span> diff --git a/html/edit/006-sandbox-copy.mu.html b/html/edit/006-sandbox-copy.mu.html index 485bc72b..c80bcf91 100644 --- a/html/edit/006-sandbox-copy.mu.html +++ b/html/edit/006-sandbox-copy.mu.html @@ -60,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/edit/006-sandbox-copy.mu'>https://github.com/akkartik/mu/blob/master/edit/006-sandbox-copy.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">## the 'copy' button makes it easy to duplicate a sandbox, and thence to</span> <span id="L2" class="LineNr"> 2 </span><span class="SalientComment">## see code operate in multiple situations</span> diff --git a/html/edit/007-sandbox-delete.mu.html b/html/edit/007-sandbox-delete.mu.html index 35d6c06e..cdfaf71c 100644 --- a/html/edit/007-sandbox-delete.mu.html +++ b/html/edit/007-sandbox-delete.mu.html @@ -60,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/edit/007-sandbox-delete.mu'>https://github.com/akkartik/mu/blob/master/edit/007-sandbox-delete.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">## deleting sandboxes</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/edit/008-sandbox-edit.mu.html b/html/edit/008-sandbox-edit.mu.html index ce3d9469..ded40eeb 100644 --- a/html/edit/008-sandbox-edit.mu.html +++ b/html/edit/008-sandbox-edit.mu.html @@ -60,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/edit/008-sandbox-edit.mu'>https://github.com/akkartik/mu/blob/master/edit/008-sandbox-edit.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">## editing sandboxes after they've been created</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/edit/009-sandbox-test.mu.html b/html/edit/009-sandbox-test.mu.html index ab6dc4ff..7d8b5d8d 100644 --- a/html/edit/009-sandbox-test.mu.html +++ b/html/edit/009-sandbox-test.mu.html @@ -61,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/edit/009-sandbox-test.mu'>https://github.com/akkartik/mu/blob/master/edit/009-sandbox-test.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">## clicking on sandbox results to 'fix' them and turn sandboxes into tests</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/edit/010-sandbox-trace.mu.html b/html/edit/010-sandbox-trace.mu.html index c8c994b2..1507f1f8 100644 --- a/html/edit/010-sandbox-trace.mu.html +++ b/html/edit/010-sandbox-trace.mu.html @@ -61,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/edit/010-sandbox-trace.mu'>https://github.com/akkartik/mu/blob/master/edit/010-sandbox-trace.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">## clicking on the code typed into a sandbox toggles its trace</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/edit/011-errors.mu.html b/html/edit/011-errors.mu.html index a22b2860..1bf4330a 100644 --- a/html/edit/011-errors.mu.html +++ b/html/edit/011-errors.mu.html @@ -61,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/edit/011-errors.mu'>https://github.com/akkartik/mu/blob/master/edit/011-errors.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">## handling malformed programs</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/edit/012-editor-undo.mu.html b/html/edit/012-editor-undo.mu.html index 48cae722..7a9143bf 100644 --- a/html/edit/012-editor-undo.mu.html +++ b/html/edit/012-editor-undo.mu.html @@ -61,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/edit/012-editor-undo.mu'>https://github.com/akkartik/mu/blob/master/edit/012-editor-undo.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">## undo/redo</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/example1.mu.html b/html/example1.mu.html index f0cecdae..55b307fa 100644 --- a/html/example1.mu.html +++ b/html/example1.mu.html @@ -11,16 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -54,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/example1.mu'>https://github.com/akkartik/mu/blob/master/example1.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr">1 </span><span class="muRecipe">def</span> <a href='example1.mu.html#L1'>main</a> [ <span id="L2" class="LineNr">2 </span> <span class="Constant">local-scope</span> diff --git a/html/exception1.mu.html b/html/exception1.mu.html index 14cbf377..a7fa5d3e 100644 --- a/html/exception1.mu.html +++ b/html/exception1.mu.html @@ -11,18 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -56,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/exception1.mu'>https://github.com/akkartik/mu/blob/master/exception1.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Example program showing exceptions built out of delimited continuations.</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/exception2.mu.html b/html/exception2.mu.html index d3d8c3a3..b55cc547 100644 --- a/html/exception2.mu.html +++ b/html/exception2.mu.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -57,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/exception2.mu'>https://github.com/akkartik/mu/blob/master/exception2.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Example program showing exceptions built out of delimited continuations.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># Slightly less klunky than exception1.mu.</span> diff --git a/html/factorial.mu.html b/html/factorial.mu.html index 25bb9120..c7f1393d 100644 --- a/html/factorial.mu.html +++ b/html/factorial.mu.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -57,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/factorial.mu'>https://github.com/akkartik/mu/blob/master/factorial.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># example program: compute the factorial of 5</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/filesystem.mu.html b/html/filesystem.mu.html index 1cddb957..e0c25e71 100644 --- a/html/filesystem.mu.html +++ b/html/filesystem.mu.html @@ -11,18 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -56,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/filesystem.mu'>https://github.com/akkartik/mu/blob/master/filesystem.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># example program: copy one file into another, character by character</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># BEWARE: this will modify your file system</span> diff --git a/html/fork.mu.html b/html/fork.mu.html index 51524616..474c45b6 100644 --- a/html/fork.mu.html +++ b/html/fork.mu.html @@ -11,17 +11,19 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Comment { color: #8080ff; } --> </style> @@ -55,6 +57,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/fork.mu'>https://github.com/akkartik/mu/blob/master/fork.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># example program: running multiple routines</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/http-client.mu.html b/html/http-client.mu.html index 4dcba47e..2fadc54b 100644 --- a/html/http-client.mu.html +++ b/html/http-client.mu.html @@ -11,18 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -56,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/http-client.mu'>https://github.com/akkartik/mu/blob/master/http-client.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># example program: reading a URL over HTTP</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/http-server.mu.html b/html/http-server.mu.html index 89d19613..a8673975 100644 --- a/html/http-server.mu.html +++ b/html/http-server.mu.html @@ -11,17 +11,19 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -55,6 +57,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/http-server.mu'>https://github.com/akkartik/mu/blob/master/http-server.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># example program: a single-request HTTP server</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># listen for connections from clients on a server socket</span> diff --git a/html/immutable-error.mu.html b/html/immutable-error.mu.html index 5beae585..1f52693f 100644 --- a/html/immutable-error.mu.html +++ b/html/immutable-error.mu.html @@ -11,16 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -54,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/immutable-error.mu'>https://github.com/akkartik/mu/blob/master/immutable-error.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># compare mutable.mu</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/lambda-to-mu.mu.html b/html/lambda-to-mu.mu.html index 089e3339..6e3554d0 100644 --- a/html/lambda-to-mu.mu.html +++ b/html/lambda-to-mu.mu.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } -.muControl { color: #c0a020; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } .muScenario { color: #00af00; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } --> </style> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/lambda-to-mu.mu'>https://github.com/akkartik/mu/blob/master/lambda-to-mu.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">## experimental compiler to translate programs written in a generic</span> <span id="L2" class="LineNr"> 2 </span><span class="SalientComment">## expression-oriented language called 'lambda' into Mu</span> diff --git a/html/mutable.mu.html b/html/mutable.mu.html index e95e071d..9992c26d 100644 --- a/html/mutable.mu.html +++ b/html/mutable.mu.html @@ -11,16 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -54,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/mutable.mu'>https://github.com/akkartik/mu/blob/master/mutable.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># compare immutable-error.mu</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/nqueens.mu.html b/html/nqueens.mu.html index 50d534b8..f427f7fe 100644 --- a/html/nqueens.mu.html +++ b/html/nqueens.mu.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -57,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/nqueens.mu'>https://github.com/akkartik/mu/blob/master/nqueens.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># <a href="http://rosettacode.org/wiki/N-queens_problem">http://rosettacode.org/wiki/N-queens_problem</a></span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># port of the Arc solution at <a href="http://arclanguage.org/item?id=19743">http://arclanguage.org/item?id=19743</a></span> diff --git a/html/real-files.mu.html b/html/real-files.mu.html index ebcf15d2..10d67c90 100644 --- a/html/real-files.mu.html +++ b/html/real-files.mu.html @@ -11,16 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -54,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/real-files.mu'>https://github.com/akkartik/mu/blob/master/real-files.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># example program: read a character from one file and write it to another</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># BEWARE: this will modify your file system</span> diff --git a/html/same-fringe.mu.html b/html/same-fringe.mu.html index 6a486e2f..8308a150 100644 --- a/html/same-fringe.mu.html +++ b/html/same-fringe.mu.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .muData { color: #ffff00; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -57,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/same-fringe.mu'>https://github.com/akkartik/mu/blob/master/same-fringe.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># The 'same fringe' problem: <a href="http://wiki.c2.com/?SameFringeProblem">http://wiki.c2.com/?SameFringeProblem</a></span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># Example program demonstrating coroutines using Mu's delimited continuations.</span> diff --git a/html/screen.mu.html b/html/screen.mu.html index 16366e39..0fbb3956 100644 --- a/html/screen.mu.html +++ b/html/screen.mu.html @@ -11,16 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -54,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/screen.mu'>https://github.com/akkartik/mu/blob/master/screen.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># example program: managing the display using 'screen' objects</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/static-dispatch.mu.html b/html/static-dispatch.mu.html index 17061e69..dd0e9e76 100644 --- a/html/static-dispatch.mu.html +++ b/html/static-dispatch.mu.html @@ -11,16 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -54,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/static-dispatch.mu'>https://github.com/akkartik/mu/blob/master/static-dispatch.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># Example program showing how multiple functions with the same name can</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># coexist, and how we select between them.</span> diff --git a/html/subx/000organization.cc.html b/html/subx/000organization.cc.html index 056519bd..f367ee9e 100644 --- a/html/subx/000organization.cc.html +++ b/html/subx/000organization.cc.html @@ -11,17 +11,19 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Identifier { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } --> </style> @@ -55,6 +57,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/000organization.cc'>https://github.com/akkartik/mu/blob/master/subx/000organization.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: You guessed right: the '000' prefix means you should start reading here.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//:</span> diff --git a/html/subx/001help.cc.html b/html/subx/001help.cc.html index 1a3fe7ed..aa899790 100644 --- a/html/subx/001help.cc.html +++ b/html/subx/001help.cc.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -58,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/001help.cc'>https://github.com/akkartik/mu/blob/master/subx/001help.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Everything this project/binary supports.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: This should give you a sense for what to look forward to in later layers.</span> diff --git a/html/subx/002test.cc.html b/html/subx/002test.cc.html index 5ae00cdf..6927f559 100644 --- a/html/subx/002test.cc.html +++ b/html/subx/002test.cc.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -58,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/002test.cc'>https://github.com/akkartik/mu/blob/master/subx/002test.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: A simple test harness. To create new tests, define functions starting with</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: 'test_'. To run all tests so defined, run:</span> diff --git a/html/subx/003trace.cc.html b/html/subx/003trace.cc.html index 1abc6fe9..860b3575 100644 --- a/html/subx/003trace.cc.html +++ b/html/subx/003trace.cc.html @@ -11,18 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -57,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/003trace.cc'>https://github.com/akkartik/mu/blob/master/subx/003trace.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: The goal of layers is to make programs more easy to understand and more</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: malleable, easy to rewrite in radical ways without accidentally breaking</span> diff --git a/html/subx/003trace.test.cc.html b/html/subx/003trace.test.cc.html index 243c5075..caaace9f 100644 --- a/html/subx/003trace.test.cc.html +++ b/html/subx/003trace.test.cc.html @@ -11,16 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } --> </style> @@ -54,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/003trace.test.cc'>https://github.com/akkartik/mu/blob/master/subx/003trace.test.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Normal">void</span> <a href='003trace.test.cc.html#L1'>test_trace_check_compares</a><span class="Delimiter">()</span> <span class="Delimiter">{</span> <span id="L2" class="LineNr"> 2 </span> <a href='003trace.cc.html#L203'>trace</a><span class="Delimiter">(</span><span class="Constant">"test layer"</span><span class="Delimiter">)</span> << <span class="Constant">"foo"</span> << end<span class="Delimiter">();</span> diff --git a/html/subx/010---vm.cc.html b/html/subx/010---vm.cc.html index 6ae23a23..c95cb76b 100644 --- a/html/subx/010---vm.cc.html +++ b/html/subx/010---vm.cc.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .CommentedCode { color: #6c6c6c; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } --> </style> @@ -59,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/010---vm.cc'>https://github.com/akkartik/mu/blob/master/subx/010---vm.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Core data structures for simulating the SubX VM (subset of an x86 processor)</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//:</span> diff --git a/html/subx/011run.cc.html b/html/subx/011run.cc.html index c06a3b32..99ff7ec9 100644 --- a/html/subx/011run.cc.html +++ b/html/subx/011run.cc.html @@ -11,22 +11,24 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } .traceContains { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .SalientComment { color: #00ffff; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.PreProc { color: #800080; } +.Comment { color: #8080ff; } +.PreProc { color:#800080; } --> </style> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/011run.cc'>https://github.com/akkartik/mu/blob/master/subx/011run.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Running SubX programs on the VM.</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/subx/012elf.cc.html b/html/subx/012elf.cc.html index 06a6ed4c..88b0ffac 100644 --- a/html/subx/012elf.cc.html +++ b/html/subx/012elf.cc.html @@ -11,18 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -57,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/012elf.cc'>https://github.com/akkartik/mu/blob/master/subx/012elf.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Generating ELF binaries for SubX programs.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: This will allow us to run them natively on a Linux kernel.</span> diff --git a/html/subx/013direct_addressing.cc.html b/html/subx/013direct_addressing.cc.html index 504d7809..7fc2052c 100644 --- a/html/subx/013direct_addressing.cc.html +++ b/html/subx/013direct_addressing.cc.html @@ -11,24 +11,26 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } .traceContains { color: #008000; } .Error { color: #ffffff; background-color: #ff6060; padding-bottom: 1px; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .SalientComment { color: #00ffff; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .CommentedCode { color: #6c6c6c; } -.PreProc { color: #800080; } +.PreProc { color:#800080; } --> </style> @@ -62,6 +64,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/013direct_addressing.cc'>https://github.com/akkartik/mu/blob/master/subx/013direct_addressing.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: operating directly on a register</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/subx/014indirect_addressing.cc.html b/html/subx/014indirect_addressing.cc.html index 4b0eb7fc..433dce9e 100644 --- a/html/subx/014indirect_addressing.cc.html +++ b/html/subx/014indirect_addressing.cc.html @@ -11,23 +11,25 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .Error { color: #ffffff; background-color: #ff6060; padding-bottom: 1px; } .traceContains { color: #008000; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .traceAbsent { color: #c00000; } -.Constant { color: #00a0a0; } +.Constant { color:#00a0a0; } .SalientComment { color: #00ffff; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.PreProc { color: #800080; } +.Comment { color: #8080ff; } +.PreProc { color:#800080; } --> </style> @@ -61,6 +63,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/014indirect_addressing.cc'>https://github.com/akkartik/mu/blob/master/subx/014indirect_addressing.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: operating on memory at the address provided by some register</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: we'll now start providing data in a separate segment</span> diff --git a/html/subx/015immediate_addressing.cc.html b/html/subx/015immediate_addressing.cc.html index d2d6a059..5fd4d6c7 100644 --- a/html/subx/015immediate_addressing.cc.html +++ b/html/subx/015immediate_addressing.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.PreProc { color: #800080; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.PreProc { color:#800080; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .SalientComment { color: #00ffff; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .CommentedCode { color: #6c6c6c; } .traceContains { color: #008000; } --> @@ -61,6 +63,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/015immediate_addressing.cc'>https://github.com/akkartik/mu/blob/master/subx/015immediate_addressing.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: instructions that (immediately) contain an argument to act with</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/subx/016index_addressing.cc.html b/html/subx/016index_addressing.cc.html index 74d09f0d..b4707946 100644 --- a/html/subx/016index_addressing.cc.html +++ b/html/subx/016index_addressing.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .Error { color: #ffffff; background-color: #ff6060; padding-bottom: 1px; } .traceContains { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.PreProc { color: #800080; } +.Comment { color: #8080ff; } +.PreProc { color:#800080; } --> </style> @@ -59,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/016index_addressing.cc'>https://github.com/akkartik/mu/blob/master/subx/016index_addressing.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: operating on memory at the address provided by some register plus optional scale and offset</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/subx/017jump_disp8.cc.html b/html/subx/017jump_disp8.cc.html index 358100f2..39c5a3e8 100644 --- a/html/subx/017jump_disp8.cc.html +++ b/html/subx/017jump_disp8.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .traceAbsent { color: #c00000; } .traceContains { color: #008000; } -.PreProc { color: #800080; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.PreProc { color:#800080; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } --> </style> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/017jump_disp8.cc'>https://github.com/akkartik/mu/blob/master/subx/017jump_disp8.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: jump to 8-bit offset</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/subx/018jump_disp32.cc.html b/html/subx/018jump_disp32.cc.html index 3363fe0a..cb829dc6 100644 --- a/html/subx/018jump_disp32.cc.html +++ b/html/subx/018jump_disp32.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .traceAbsent { color: #c00000; } .traceContains { color: #008000; } -.PreProc { color: #800080; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.PreProc { color:#800080; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } --> </style> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/018jump_disp32.cc'>https://github.com/akkartik/mu/blob/master/subx/018jump_disp32.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: jump to 32-bit offset</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/subx/019functions.cc.html b/html/subx/019functions.cc.html index 2cab5df7..9295ee02 100644 --- a/html/subx/019functions.cc.html +++ b/html/subx/019functions.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } .traceContains { color: #008000; } -.PreProc { color: #800080; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.PreProc { color:#800080; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } --> </style> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/019functions.cc'>https://github.com/akkartik/mu/blob/master/subx/019functions.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">//:: call</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/subx/020syscalls.cc.html b/html/subx/020syscalls.cc.html index efbd687c..32b7580a 100644 --- a/html/subx/020syscalls.cc.html +++ b/html/subx/020syscalls.cc.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.PreProc { color: #800080; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.PreProc { color:#800080; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -58,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/020syscalls.cc'>https://github.com/akkartik/mu/blob/master/subx/020syscalls.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Delimiter">:(before "End Initialize Op Names")</span> <span id="L2" class="LineNr"> 2 </span><a href='001help.cc.html#L253'>put_new</a><span class="Delimiter">(</span><span class="Special"><a href='010---vm.cc.html#L378'>Name</a></span><span class="Delimiter">,</span> <span class="Constant">"cd"</span><span class="Delimiter">,</span> <span class="Constant">"software interrupt (int)"</span><span class="Delimiter">);</span> diff --git a/html/subx/021byte_addressing.cc.html b/html/subx/021byte_addressing.cc.html index f9f9e055..e339fd4f 100644 --- a/html/subx/021byte_addressing.cc.html +++ b/html/subx/021byte_addressing.cc.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .traceContains { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -58,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/021byte_addressing.cc'>https://github.com/akkartik/mu/blob/master/subx/021byte_addressing.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: SubX mostly deals with instructions operating on 32-bit operands, but we</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: still need to deal with raw bytes for strings and so on.</span> diff --git a/html/subx/028translate.cc.html b/html/subx/028translate.cc.html index ccd31900..67a910de 100644 --- a/html/subx/028translate.cc.html +++ b/html/subx/028translate.cc.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Delimiter { color: #800080; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Delimiter { color:#800080; } .SalientComment { color: #00ffff; } -.Identifier { color: #c0a020; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .cSpecial { color: #008000; } --> </style> @@ -58,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/028translate.cc'>https://github.com/akkartik/mu/blob/master/subx/028translate.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: The bedrock level 1 of abstraction is now done, and we're going to start</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: building levels above it that make programming in x86 machine code a</span> diff --git a/html/subx/029transforms.cc.html b/html/subx/029transforms.cc.html index 0a9ed032..7a72cec6 100644 --- a/html/subx/029transforms.cc.html +++ b/html/subx/029transforms.cc.html @@ -11,14 +11,16 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } +.Comment { color: #8080ff; } --> </style> @@ -52,6 +54,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/029transforms.cc'>https://github.com/akkartik/mu/blob/master/subx/029transforms.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Ordering transforms is a well-known hard problem when building compilers.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: In our case we also have the additional notion of layers. The ordering of</span> diff --git a/html/subx/030---operands.cc.html b/html/subx/030---operands.cc.html index cf670140..afe9e115 100644 --- a/html/subx/030---operands.cc.html +++ b/html/subx/030---operands.cc.html @@ -11,19 +11,21 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.Identifier { color: #c0a020; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.Identifier { color:#c0a020; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } .SalientComment { color: #00ffff; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -58,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/030---operands.cc'>https://github.com/akkartik/mu/blob/master/subx/030---operands.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Beginning of "level 2": tagging bytes with metadata around what field of</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: an x86 instruction they're for.</span> diff --git a/html/subx/031check_operands.cc.html b/html/subx/031check_operands.cc.html index 8d06d539..e6302677 100644 --- a/html/subx/031check_operands.cc.html +++ b/html/subx/031check_operands.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .CommentedCode { color: #6c6c6c; } -.PreProc { color: #800080; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.PreProc { color:#800080; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .SalientComment { color: #00ffff; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/031check_operands.cc'>https://github.com/akkartik/mu/blob/master/subx/031check_operands.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Since we're tagging operands with their types, let's start checking these</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: operand types for each instruction.</span> diff --git a/html/subx/032check_operand_bounds.cc.html b/html/subx/032check_operand_bounds.cc.html index e21d0265..ca3d7ed9 100644 --- a/html/subx/032check_operand_bounds.cc.html +++ b/html/subx/032check_operand_bounds.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } .cSpecial { color: #008000; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.PreProc { color: #800080; } +.PreProc { color:#800080; } .SalientComment { color: #00ffff; } --> </style> @@ -60,6 +62,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/032check_operand_bounds.cc'>https://github.com/akkartik/mu/blob/master/subx/032check_operand_bounds.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="SalientComment">//:: Check that the different operands of an instruction aren't too large for their bitfields.</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/subx/034compute_segment_address.cc.html b/html/subx/034compute_segment_address.cc.html index 3a46ee38..53c3ddaa 100644 --- a/html/subx/034compute_segment_address.cc.html +++ b/html/subx/034compute_segment_address.cc.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .traceContains { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.PreProc { color: #800080; } +.Comment { color: #8080ff; } +.PreProc { color:#800080; } --> </style> @@ -58,6 +60,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/034compute_segment_address.cc'>https://github.com/akkartik/mu/blob/master/subx/034compute_segment_address.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Start allowing us to not specify precise addresses for the start of each</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: segment.</span> diff --git a/html/subx/035labels.cc.html b/html/subx/035labels.cc.html index 2e388d80..6c5f4220 100644 --- a/html/subx/035labels.cc.html +++ b/html/subx/035labels.cc.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.PreProc { color: #800080; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.PreProc { color:#800080; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -59,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/035labels.cc'>https://github.com/akkartik/mu/blob/master/subx/035labels.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Labels are defined by ending names with a ':'. This layer will compute</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: displacements for labels, and compute the offset for instructions using them.</span> diff --git a/html/subx/036global_variables.cc.html b/html/subx/036global_variables.cc.html index 24e8a9ee..d4b2a869 100644 --- a/html/subx/036global_variables.cc.html +++ b/html/subx/036global_variables.cc.html @@ -11,23 +11,25 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } .traceContains { color: #008000; } .CommentedCode { color: #6c6c6c; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .SalientComment { color: #00ffff; } -.PreProc { color: #800080; } +.PreProc { color:#800080; } --> </style> @@ -61,6 +63,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/036global_variables.cc'>https://github.com/akkartik/mu/blob/master/subx/036global_variables.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Global variables.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//:</span> diff --git a/html/subx/038---literal_strings.cc.html b/html/subx/038---literal_strings.cc.html index 5beff626..4c9a0391 100644 --- a/html/subx/038---literal_strings.cc.html +++ b/html/subx/038---literal_strings.cc.html @@ -11,20 +11,22 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } -.LineNr { color: #444444; } +.LineNr { color:#444444; } .traceAbsent { color: #c00000; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } .traceContains { color: #008000; } --> </style> @@ -59,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/038---literal_strings.cc'>https://github.com/akkartik/mu/blob/master/subx/038---literal_strings.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Allow instructions to mention literals directly.</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//:</span> diff --git a/html/subx/039debug.cc.html b/html/subx/039debug.cc.html index c52eece9..7e66bad2 100644 --- a/html/subx/039debug.cc.html +++ b/html/subx/039debug.cc.html @@ -11,17 +11,19 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.Comment { color: #8080ff; } --> </style> @@ -55,6 +57,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/039debug.cc'>https://github.com/akkartik/mu/blob/master/subx/039debug.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Some helpers for debugging.</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/subx/040---tests.cc.html b/html/subx/040---tests.cc.html index 14ae7ce0..f00d27e4 100644 --- a/html/subx/040---tests.cc.html +++ b/html/subx/040---tests.cc.html @@ -11,21 +11,23 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .cSpecial { color: #008000; } .traceContains { color: #008000; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Delimiter { color: #800080; } -.Special { color: #c00000; } -.Identifier { color: #c0a020; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Delimiter { color:#800080; } +.Special { color:#c00000; } +.Identifier { color:#c0a020; } .Normal { color: #aaaaaa; background-color: #080808; padding-bottom: 1px; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } -.PreProc { color: #800080; } +.Comment { color: #8080ff; } +.PreProc { color:#800080; } --> </style> @@ -59,6 +61,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/040---tests.cc'>https://github.com/akkartik/mu/blob/master/subx/040---tests.cc</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment">//: Automatically aggregate functions starting with 'test-' into a test suite</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">//: called 'run-tests'. Running this function will run all tests.</span> diff --git a/html/subx/050_write.subx.html b/html/subx/050_write.subx.html index 369c7b33..0dfa8594 100644 --- a/html/subx/050_write.subx.html +++ b/html/subx/050_write.subx.html @@ -56,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/050_write.subx'>https://github.com/akkartik/mu/blob/master/subx/050_write.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># _write: write to a file descriptor</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/subx/051test.subx.html b/html/subx/051test.subx.html index cf87bbb0..89ebfd20 100644 --- a/html/subx/051test.subx.html +++ b/html/subx/051test.subx.html @@ -58,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/051test.subx'>https://github.com/akkartik/mu/blob/master/subx/051test.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Rudimentary test harness</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/subx/052kernel_string_equal.subx.html b/html/subx/052kernel_string_equal.subx.html index ae0840b8..e35b1aa3 100644 --- a/html/subx/052kernel_string_equal.subx.html +++ b/html/subx/052kernel_string_equal.subx.html @@ -59,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/052kernel_string_equal.subx'>https://github.com/akkartik/mu/blob/master/subx/052kernel_string_equal.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Checking null-terminated ascii strings.</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> diff --git a/html/subx/053new_segment.subx.html b/html/subx/053new_segment.subx.html index 0290b2f9..cc8a1748 100644 --- a/html/subx/053new_segment.subx.html +++ b/html/subx/053new_segment.subx.html @@ -57,6 +57,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/053new_segment.subx'>https://github.com/akkartik/mu/blob/master/subx/053new_segment.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Create a new segment (for data) using mmap().</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/subx/054string_equal.subx.html b/html/subx/054string_equal.subx.html index 657cce79..5b6504d2 100644 --- a/html/subx/054string_equal.subx.html +++ b/html/subx/054string_equal.subx.html @@ -59,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/054string_equal.subx'>https://github.com/akkartik/mu/blob/master/subx/054string_equal.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Comparing 'regular' length-prefixed strings.</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/subx/055trace.subx.html b/html/subx/055trace.subx.html index b46b0a11..bd3ec9c0 100644 --- a/html/subx/055trace.subx.html +++ b/html/subx/055trace.subx.html @@ -59,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/055trace.subx'>https://github.com/akkartik/mu/blob/master/subx/055trace.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># primitives for emitting traces to a trace stream, and for tests to check the trace stream</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> diff --git a/html/subx/056write.subx.html b/html/subx/056write.subx.html index e92b59bb..d21a4bfb 100644 --- a/html/subx/056write.subx.html +++ b/html/subx/056write.subx.html @@ -58,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/056write.subx'>https://github.com/akkartik/mu/blob/master/subx/056write.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># write: like _write, but also support in-memory streams in addition to file</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment"># descriptors.</span> diff --git a/html/subx/057stop.subx.html b/html/subx/057stop.subx.html index 1f859d12..bd4dec2c 100644 --- a/html/subx/057stop.subx.html +++ b/html/subx/057stop.subx.html @@ -58,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/057stop.subx'>https://github.com/akkartik/mu/blob/master/subx/057stop.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># stop: dependency-injected wrapper around the exit() syscall</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> diff --git a/html/subx/058read.subx.html b/html/subx/058read.subx.html index b464068c..9f17a3ed 100644 --- a/html/subx/058read.subx.html +++ b/html/subx/058read.subx.html @@ -59,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/058read.subx'>https://github.com/akkartik/mu/blob/master/subx/058read.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># read: analogously to write, support reading from in-memory streams in</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment"># addition to file descriptors.</span> diff --git a/html/subx/059read-byte.subx.html b/html/subx/059read-byte.subx.html index 6573c8c5..eb760dd4 100644 --- a/html/subx/059read-byte.subx.html +++ b/html/subx/059read-byte.subx.html @@ -59,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/059read-byte.subx'>https://github.com/akkartik/mu/blob/master/subx/059read-byte.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># read-byte: one higher-level abstraction atop 'read'.</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> diff --git a/html/subx/060write-stream.subx.html b/html/subx/060write-stream.subx.html index ba6ed457..d8425da4 100644 --- a/html/subx/060write-stream.subx.html +++ b/html/subx/060write-stream.subx.html @@ -58,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/060write-stream.subx'>https://github.com/akkartik/mu/blob/master/subx/060write-stream.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># write-stream: like write, but write streams rather than strings</span> <span id="L2" class="LineNr"> 2 </span> diff --git a/html/subx/apps/crenshaw2-1.subx.html b/html/subx/apps/crenshaw2-1.subx.html index 348defea..b4e300ad 100644 --- a/html/subx/apps/crenshaw2-1.subx.html +++ b/html/subx/apps/crenshaw2-1.subx.html @@ -59,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/apps/crenshaw2-1.subx'>https://github.com/akkartik/mu/blob/master/subx/apps/crenshaw2-1.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Port of <a href="https://github.com/akkartik/crenshaw/blob/master/tutor2.1.pas">https://github.com/akkartik/crenshaw/blob/master/tutor2.1.pas</a></span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment"># which corresponds to the section "single digits" in <a href="https://compilers.iecc.com/crenshaw/tutor2.txt">https://compilers.iecc.com/crenshaw/tutor2.txt</a></span> diff --git a/html/subx/apps/crenshaw2-1b.subx.html b/html/subx/apps/crenshaw2-1b.subx.html index d6e00742..f38703f0 100644 --- a/html/subx/apps/crenshaw2-1b.subx.html +++ b/html/subx/apps/crenshaw2-1b.subx.html @@ -59,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/apps/crenshaw2-1b.subx'>https://github.com/akkartik/mu/blob/master/subx/apps/crenshaw2-1b.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Port of <a href="https://github.com/akkartik/crenshaw/blob/master/tutor2.1.pas">https://github.com/akkartik/crenshaw/blob/master/tutor2.1.pas</a></span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment"># which corresponds to the section "single digits" in <a href="https://compilers.iecc.com/crenshaw/tutor2.txt">https://compilers.iecc.com/crenshaw/tutor2.txt</a></span> diff --git a/html/subx/apps/factorial.subx.html b/html/subx/apps/factorial.subx.html index 61c6854a..7e43deaf 100644 --- a/html/subx/apps/factorial.subx.html +++ b/html/subx/apps/factorial.subx.html @@ -59,12 +59,13 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/apps/factorial.subx'>https://github.com/akkartik/mu/blob/master/subx/apps/factorial.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment">## compute the factorial of 5, and return the result in the exit code</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> <span id="L3" class="LineNr"> 3 </span><span class="subxComment"># To run (from the subx directory):</span> -<span id="L4" class="LineNr"> 4 </span><span class="subxComment"># $ subx translate apps/factorial.subx -o apps/factorial</span> -<span id="L5" class="LineNr"> 5 </span><span class="subxComment"># $ subx run apps/factorial</span> +<span id="L4" class="LineNr"> 4 </span><span class="subxComment"># $ ./subx translate apps/factorial.subx -o apps/factorial</span> +<span id="L5" class="LineNr"> 5 </span><span class="subxComment"># $ ./subx run apps/factorial</span> <span id="L6" class="LineNr"> 6 </span><span class="subxComment"># Expected result:</span> <span id="L7" class="LineNr"> 7 </span><span class="subxComment"># $ echo $?</span> <span id="L8" class="LineNr"> 8 </span><span class="subxComment"># 120</span> diff --git a/html/subx/examples/ex1.subx.html b/html/subx/examples/ex1.subx.html index 2c8d9fee..b72d5054 100644 --- a/html/subx/examples/ex1.subx.html +++ b/html/subx/examples/ex1.subx.html @@ -54,6 +54,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/examples/ex1.subx'>https://github.com/akkartik/mu/blob/master/subx/examples/ex1.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># First program: same as <a href="https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html">https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html</a></span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment"># Just return 42.</span> diff --git a/html/subx/examples/ex10.subx.html b/html/subx/examples/ex10.subx.html index 132958ec..f0f582f2 100644 --- a/html/subx/examples/ex10.subx.html +++ b/html/subx/examples/ex10.subx.html @@ -56,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/examples/ex10.subx'>https://github.com/akkartik/mu/blob/master/subx/examples/ex10.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># String comparison: return 1 iff the two args passed in at the commandline are equal.</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> diff --git a/html/subx/examples/ex11.subx.html b/html/subx/examples/ex11.subx.html index 56377403..9749967e 100644 --- a/html/subx/examples/ex11.subx.html +++ b/html/subx/examples/ex11.subx.html @@ -59,6 +59,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/examples/ex11.subx'>https://github.com/akkartik/mu/blob/master/subx/examples/ex11.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Null-terminated vs length-prefixed ascii strings.</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> diff --git a/html/subx/examples/ex12.subx.html b/html/subx/examples/ex12.subx.html index 35235c57..e2dfc4e0 100644 --- a/html/subx/examples/ex12.subx.html +++ b/html/subx/examples/ex12.subx.html @@ -58,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/examples/ex12.subx'>https://github.com/akkartik/mu/blob/master/subx/examples/ex12.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Example showing mmap syscall.</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment"># Create a new segment using mmap, save the address, write to it.</span> diff --git a/html/subx/examples/ex2.subx.html b/html/subx/examples/ex2.subx.html index 42a590f1..04e1e9c4 100644 --- a/html/subx/examples/ex2.subx.html +++ b/html/subx/examples/ex2.subx.html @@ -54,6 +54,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/examples/ex2.subx'>https://github.com/akkartik/mu/blob/master/subx/examples/ex2.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Add 1 and 1, and return the result in the exit code.</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> diff --git a/html/subx/examples/ex3.subx.html b/html/subx/examples/ex3.subx.html index fb098a31..533bea07 100644 --- a/html/subx/examples/ex3.subx.html +++ b/html/subx/examples/ex3.subx.html @@ -56,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/examples/ex3.subx'>https://github.com/akkartik/mu/blob/master/subx/examples/ex3.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Add the first 10 numbers, and return the result in the exit code.</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> diff --git a/html/subx/examples/ex4.subx.html b/html/subx/examples/ex4.subx.html index dab870b9..db75131c 100644 --- a/html/subx/examples/ex4.subx.html +++ b/html/subx/examples/ex4.subx.html @@ -56,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/examples/ex4.subx'>https://github.com/akkartik/mu/blob/master/subx/examples/ex4.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Read a character from stdin, save it to a global, write it to stdout.</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> diff --git a/html/subx/examples/ex5.subx.html b/html/subx/examples/ex5.subx.html index 917a55d6..5364e97f 100644 --- a/html/subx/examples/ex5.subx.html +++ b/html/subx/examples/ex5.subx.html @@ -56,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/examples/ex5.subx'>https://github.com/akkartik/mu/blob/master/subx/examples/ex5.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Read a character from stdin, save it to a local on the stack, write it to stdout.</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> diff --git a/html/subx/examples/ex6.subx.html b/html/subx/examples/ex6.subx.html index 092685e2..fb8b5bd7 100644 --- a/html/subx/examples/ex6.subx.html +++ b/html/subx/examples/ex6.subx.html @@ -57,6 +57,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/examples/ex6.subx'>https://github.com/akkartik/mu/blob/master/subx/examples/ex6.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Print out a (global variable) string to stdout.</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> diff --git a/html/subx/examples/ex7.subx.html b/html/subx/examples/ex7.subx.html index e20ebc88..f22f852f 100644 --- a/html/subx/examples/ex7.subx.html +++ b/html/subx/examples/ex7.subx.html @@ -57,6 +57,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/examples/ex7.subx'>https://github.com/akkartik/mu/blob/master/subx/examples/ex7.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Example showing file syscalls.</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> diff --git a/html/subx/examples/ex8.subx.html b/html/subx/examples/ex8.subx.html index ed29f0b4..50f28a7c 100644 --- a/html/subx/examples/ex8.subx.html +++ b/html/subx/examples/ex8.subx.html @@ -56,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/examples/ex8.subx'>https://github.com/akkartik/mu/blob/master/subx/examples/ex8.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Example reading commandline arguments: compute length of first arg.</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> diff --git a/html/subx/examples/ex9.subx.html b/html/subx/examples/ex9.subx.html index 578c7cd7..23e35839 100644 --- a/html/subx/examples/ex9.subx.html +++ b/html/subx/examples/ex9.subx.html @@ -56,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/examples/ex9.subx'>https://github.com/akkartik/mu/blob/master/subx/examples/ex9.subx</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Example showing arg order on the stack.</span> <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span> diff --git a/html/tangle.mu.html b/html/tangle.mu.html index 2dbb66d5..e02280a9 100644 --- a/html/tangle.mu.html +++ b/html/tangle.mu.html @@ -11,18 +11,20 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } -.muControl { color: #c0a020; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.muControl { color:#c0a020; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Delimiter { color: #800080; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Delimiter { color:#800080; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -56,6 +58,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/tangle.mu'>https://github.com/akkartik/mu/blob/master/tangle.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># example program: constructing functions out of order</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment">#</span> diff --git a/html/x.mu.html b/html/x.mu.html index 022c3a6f..d2bb04ae 100644 --- a/html/x.mu.html +++ b/html/x.mu.html @@ -11,16 +11,18 @@ <style type="text/css"> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } -body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } -a { color:#eeeeee; text-decoration: none; } -a:hover { text-decoration: underline; } -* { font-size: 12pt; font-size: 1em; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } .muRecipe { color: #ff8700; } -.LineNr { color: #444444; } -.Constant { color: #00a0a0; } -.Special { color: #c00000; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } +.LineNr { color:#444444; } +.Constant { color:#00a0a0; } +.Special { color:#c00000; } +.Comment { color: #8080ff; } --> </style> @@ -54,6 +56,7 @@ if ('onhashchange' in window) { </script> </head> <body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/x.mu'>https://github.com/akkartik/mu/blob/master/x.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr">1 </span><span class="Comment"># example program: add two numbers</span> <span id="L2" class="LineNr">2 </span> |