diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-05-06 22:48:37 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-05-06 22:48:37 -0700 |
commit | a97a00df51316a9246a13f6efb17a8a8f97bbd51 (patch) | |
tree | 7c9452c66b103ac7e0514206fd7ddab1670ece08 /html | |
parent | 2c91ac0c6a4b77f268e119eb2366dbc440cbc61f (diff) | |
download | mu-a97a00df51316a9246a13f6efb17a8a8f97bbd51.tar.gz |
3848
Improve an error message. Still lots of room for improving how we render reagents in errors.
Diffstat (limited to 'html')
-rw-r--r-- | html/010vm.cc.html | 295 | ||||
-rw-r--r-- | html/035lookup.cc.html | 2 |
2 files changed, 147 insertions, 150 deletions
diff --git a/html/010vm.cc.html b/html/010vm.cc.html index 6d967836..eed4d75a 100644 --- a/html/010vm.cc.html +++ b/html/010vm.cc.html @@ -770,155 +770,152 @@ if ('onhashchange' in window) { <span id="L706" class="LineNr">706 </span><span class="Delimiter">}</span> <span id="L707" class="LineNr">707 </span> <span id="L708" class="LineNr">708 </span>string <a href='028call_return.cc.html#L158'>to_string</a><span class="Delimiter">(</span><span class="Normal">const</span> type_tree* type<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L709" class="LineNr">709 </span> <span class="Comment">// abbreviate a single-node tree to just its contents</span> -<span id="L710" class="LineNr">710 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">"NULLNULLNULL"</span><span class="Delimiter">;</span> <span class="Comment">// should never happen</span> -<span id="L711" class="LineNr">711 </span> ostringstream out<span class="Delimiter">;</span> -<span id="L712" class="LineNr">712 </span> dump<span class="Delimiter">(</span>type<span class="Delimiter">,</span> out<span class="Delimiter">);</span> -<span id="L713" class="LineNr">713 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> -<span id="L714" class="LineNr">714 </span><span class="Delimiter">}</span> -<span id="L715" class="LineNr">715 </span> -<span id="L716" class="LineNr">716 </span><span class="Normal">void</span> dump<span class="Delimiter">(</span><span class="Normal">const</span> type_tree* x<span class="Delimiter">,</span> ostream& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L717" class="LineNr">717 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L718" class="LineNr">718 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L719" class="LineNr">719 </span> <span class="Conceal">¦</span> dump<span class="Delimiter">(</span>x<span class="Delimiter">-></span>value<span class="Delimiter">,</span> out<span class="Delimiter">);</span> -<span id="L720" class="LineNr">720 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L721" class="LineNr">721 </span> <span class="Delimiter">}</span> -<span id="L722" class="LineNr">722 </span> out << <span class="Constant">'('</span><span class="Delimiter">;</span> -<span id="L723" class="LineNr">723 </span> <span class="Normal">const</span> type_tree* curr = x<span class="Delimiter">;</span> -<span id="L724" class="LineNr">724 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>curr && !curr<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L725" class="LineNr">725 </span> <span class="Conceal">¦</span> dump<span class="Delimiter">(</span>curr<span class="Delimiter">-></span>left<span class="Delimiter">,</span> out<span class="Delimiter">);</span> -<span id="L726" class="LineNr">726 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">-></span>right<span class="Delimiter">)</span> out << <span class="Constant">' '</span><span class="Delimiter">;</span> -<span id="L727" class="LineNr">727 </span> <span class="Conceal">¦</span> curr = curr<span class="Delimiter">-></span>right<span class="Delimiter">;</span> -<span id="L728" class="LineNr">728 </span> <span class="Delimiter">}</span> -<span id="L729" class="LineNr">729 </span> <span class="Comment">// check for dotted list; should never happen</span> -<span id="L730" class="LineNr">730 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L731" class="LineNr">731 </span> <span class="Conceal">¦</span> out << <span class="Constant">". "</span><span class="Delimiter">;</span> -<span id="L732" class="LineNr">732 </span> <span class="Conceal">¦</span> dump<span class="Delimiter">(</span>curr<span class="Delimiter">,</span> out<span class="Delimiter">);</span> -<span id="L733" class="LineNr">733 </span> <span class="Delimiter">}</span> -<span id="L734" class="LineNr">734 </span> out << <span class="Constant">')'</span><span class="Delimiter">;</span> -<span id="L735" class="LineNr">735 </span><span class="Delimiter">}</span> -<span id="L736" class="LineNr">736 </span> -<span id="L737" class="LineNr">737 </span><span class="Normal">void</span> dump<span class="Delimiter">(</span><a href='010vm.cc.html#L123'>type_ordinal</a> type<span class="Delimiter">,</span> ostream& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L738" class="LineNr">738 </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> -<span id="L739" class="LineNr">739 </span> <span class="Conceal">¦</span> out << get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">).</span>name<span class="Delimiter">;</span> -<span id="L740" class="LineNr">740 </span> <span class="Normal">else</span> -<span id="L741" class="LineNr">741 </span> <span class="Conceal">¦</span> out << <span class="Constant">"?"</span> << type<span class="Delimiter">;</span> -<span id="L742" class="LineNr">742 </span><span class="Delimiter">}</span> -<span id="L743" class="LineNr">743 </span> -<span id="L744" class="LineNr">744 </span>string names_to_string<span class="Delimiter">(</span><span class="Normal">const</span> type_tree* type<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L745" class="LineNr">745 </span> <span class="Comment">// abbreviate a single-node tree to just its contents</span> -<span id="L746" class="LineNr">746 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">"()"</span><span class="Delimiter">;</span> <span class="Comment">// should never happen</span> -<span id="L747" class="LineNr">747 </span> ostringstream out<span class="Delimiter">;</span> -<span id="L748" class="LineNr">748 </span> dump_names<span class="Delimiter">(</span>type<span class="Delimiter">,</span> out<span class="Delimiter">);</span> -<span id="L749" class="LineNr">749 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> -<span id="L750" class="LineNr">750 </span><span class="Delimiter">}</span> -<span id="L751" class="LineNr">751 </span> -<span id="L752" class="LineNr">752 </span><span class="Normal">void</span> dump_names<span class="Delimiter">(</span><span class="Normal">const</span> type_tree* x<span class="Delimiter">,</span> ostream& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L753" class="LineNr">753 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L754" class="LineNr">754 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L755" class="LineNr">755 </span> <span class="Conceal">¦</span> out << <span class="Constant">'"'</span> << x<span class="Delimiter">-></span>name << <span class="Constant">'"'</span><span class="Delimiter">;</span> -<span id="L756" class="LineNr">756 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L757" class="LineNr">757 </span> <span class="Delimiter">}</span> -<span id="L758" class="LineNr">758 </span> out << <span class="Constant">'('</span><span class="Delimiter">;</span> -<span id="L759" class="LineNr">759 </span> <span class="Normal">const</span> type_tree* curr = x<span class="Delimiter">;</span> -<span id="L760" class="LineNr">760 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>curr && !curr<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L761" class="LineNr">761 </span> <span class="Conceal">¦</span> dump_names<span class="Delimiter">(</span>curr<span class="Delimiter">-></span>left<span class="Delimiter">,</span> out<span class="Delimiter">);</span> -<span id="L762" class="LineNr">762 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">-></span>right<span class="Delimiter">)</span> out << <span class="Constant">' '</span><span class="Delimiter">;</span> -<span id="L763" class="LineNr">763 </span> <span class="Conceal">¦</span> curr = curr<span class="Delimiter">-></span>right<span class="Delimiter">;</span> -<span id="L764" class="LineNr">764 </span> <span class="Delimiter">}</span> -<span id="L765" class="LineNr">765 </span> <span class="Comment">// check for dotted list; should never happen</span> -<span id="L766" class="LineNr">766 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L767" class="LineNr">767 </span> <span class="Conceal">¦</span> out << <span class="Constant">". "</span><span class="Delimiter">;</span> -<span id="L768" class="LineNr">768 </span> <span class="Conceal">¦</span> dump_names<span class="Delimiter">(</span>curr<span class="Delimiter">,</span> out<span class="Delimiter">);</span> -<span id="L769" class="LineNr">769 </span> <span class="Delimiter">}</span> -<span id="L770" class="LineNr">770 </span> out << <span class="Constant">')'</span><span class="Delimiter">;</span> -<span id="L771" class="LineNr">771 </span><span class="Delimiter">}</span> -<span id="L772" class="LineNr">772 </span> -<span id="L773" class="LineNr">773 </span>string names_to_string_without_quotes<span class="Delimiter">(</span><span class="Normal">const</span> type_tree* type<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L774" class="LineNr">774 </span> <span class="Comment">// abbreviate a single-node tree to just its contents</span> -<span id="L775" class="LineNr">775 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">"NULLNULLNULL"</span><span class="Delimiter">;</span> <span class="Comment">// should never happen</span> -<span id="L776" class="LineNr">776 </span> ostringstream out<span class="Delimiter">;</span> -<span id="L777" class="LineNr">777 </span> dump_names_without_quotes<span class="Delimiter">(</span>type<span class="Delimiter">,</span> out<span class="Delimiter">);</span> -<span id="L778" class="LineNr">778 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> -<span id="L779" class="LineNr">779 </span><span class="Delimiter">}</span> -<span id="L780" class="LineNr">780 </span> -<span id="L781" class="LineNr">781 </span><span class="Normal">void</span> dump_names_without_quotes<span class="Delimiter">(</span><span class="Normal">const</span> type_tree* x<span class="Delimiter">,</span> ostream& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L782" class="LineNr">782 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L783" class="LineNr">783 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L784" class="LineNr">784 </span> <span class="Conceal">¦</span> out << x<span class="Delimiter">-></span>name<span class="Delimiter">;</span> -<span id="L785" class="LineNr">785 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> -<span id="L786" class="LineNr">786 </span> <span class="Delimiter">}</span> -<span id="L787" class="LineNr">787 </span> out << <span class="Constant">'('</span><span class="Delimiter">;</span> -<span id="L788" class="LineNr">788 </span> <span class="Normal">const</span> type_tree* curr = x<span class="Delimiter">;</span> -<span id="L789" class="LineNr">789 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>curr && !curr<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L790" class="LineNr">790 </span> <span class="Conceal">¦</span> dump_names_without_quotes<span class="Delimiter">(</span>curr<span class="Delimiter">-></span>left<span class="Delimiter">,</span> out<span class="Delimiter">);</span> -<span id="L791" class="LineNr">791 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">-></span>right<span class="Delimiter">)</span> out << <span class="Constant">' '</span><span class="Delimiter">;</span> -<span id="L792" class="LineNr">792 </span> <span class="Conceal">¦</span> curr = curr<span class="Delimiter">-></span>right<span class="Delimiter">;</span> -<span id="L793" class="LineNr">793 </span> <span class="Delimiter">}</span> -<span id="L794" class="LineNr">794 </span> <span class="Comment">// check for dotted list; should never happen</span> -<span id="L795" class="LineNr">795 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L796" class="LineNr">796 </span> <span class="Conceal">¦</span> out << <span class="Constant">". "</span><span class="Delimiter">;</span> -<span id="L797" class="LineNr">797 </span> <span class="Conceal">¦</span> dump_names_without_quotes<span class="Delimiter">(</span>curr<span class="Delimiter">,</span> out<span class="Delimiter">);</span> -<span id="L798" class="LineNr">798 </span> <span class="Delimiter">}</span> -<span id="L799" class="LineNr">799 </span> out << <span class="Constant">')'</span><span class="Delimiter">;</span> -<span id="L800" class="LineNr">800 </span><span class="Delimiter">}</span> -<span id="L801" class="LineNr">801 </span> -<span id="L802" class="LineNr">802 </span><span class="Comment">//: helper to print numbers without excessive precision</span> -<span id="L803" class="LineNr">803 </span> -<span id="L804" class="LineNr">804 </span><span class="Delimiter">:(before "End Types")</span> -<span id="L805" class="LineNr">805 </span><span class="Normal">struct</span> no_scientific <span class="Delimiter">{</span> -<span id="L806" class="LineNr">806 </span> <span class="Normal">double</span> x<span class="Delimiter">;</span> -<span id="L807" class="LineNr">807 </span> <span class="Normal">explicit</span> no_scientific<span class="Delimiter">(</span><span class="Normal">double</span> y<span class="Delimiter">)</span> :x<span class="Delimiter">(</span>y<span class="Delimiter">)</span> <span class="Delimiter">{}</span> -<span id="L808" class="LineNr">808 </span><span class="Delimiter">};</span> -<span id="L809" class="LineNr">809 </span> -<span id="L810" class="LineNr">810 </span><span class="Delimiter">:(code)</span> -<span id="L811" class="LineNr">811 </span>ostream& <span class="Normal">operator</span><<<span class="Delimiter">(</span>ostream& os<span class="Delimiter">,</span> no_scientific x<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L812" class="LineNr">812 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!isfinite<span class="Delimiter">(</span>x<span class="Delimiter">.</span>x<span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L813" class="LineNr">813 </span> <span class="Conceal">¦</span> <span class="Comment">// Infinity or NaN</span> -<span id="L814" class="LineNr">814 </span> <span class="Conceal">¦</span> os << x<span class="Delimiter">.</span>x<span class="Delimiter">;</span> -<span id="L815" class="LineNr">815 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span> os<span class="Delimiter">;</span> -<span id="L816" class="LineNr">816 </span> <span class="Delimiter">}</span> -<span id="L817" class="LineNr">817 </span> ostringstream tmp<span class="Delimiter">;</span> -<span id="L818" class="LineNr">818 </span> <span class="Comment">// more accurate, but too slow</span> -<span id="L819" class="LineNr">819 </span><span class="CommentedCode">//? tmp.precision(308); // for 64-bit numbers</span> -<span id="L820" class="LineNr">820 </span> tmp << std::fixed << x<span class="Delimiter">.</span>x<span class="Delimiter">;</span> -<span id="L821" class="LineNr">821 </span> os << trim_floating_point<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>str<span class="Delimiter">());</span> -<span id="L822" class="LineNr">822 </span> <span class="Identifier">return</span> os<span class="Delimiter">;</span> -<span id="L823" class="LineNr">823 </span><span class="Delimiter">}</span> -<span id="L824" class="LineNr">824 </span> -<span id="L825" class="LineNr">825 </span>string trim_floating_point<span class="Delimiter">(</span><span class="Normal">const</span> string& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L826" class="LineNr">826 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span> <span class="Constant">""</span><span class="Delimiter">;</span> -<span id="L827" class="LineNr">827 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<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">return</span> in<span class="Delimiter">;</span> -<span id="L828" class="LineNr">828 </span> <span class="Normal">int</span> length = <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> -<span id="L829" class="LineNr">829 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>length > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> -<span id="L830" class="LineNr">830 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>at<span class="Delimiter">(</span>length-<span class="Constant">1</span><span class="Delimiter">)</span> != <span class="Constant">'0'</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> -<span id="L831" class="LineNr">831 </span> <span class="Conceal">¦</span> --length<span class="Delimiter">;</span> -<span id="L832" class="LineNr">832 </span> <span class="Delimiter">}</span> -<span id="L833" class="LineNr">833 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>at<span class="Delimiter">(</span>length-<span class="Constant">1</span><span class="Delimiter">)</span> == <span class="Constant">'.'</span><span class="Delimiter">)</span> --length<span class="Delimiter">;</span> -<span id="L834" class="LineNr">834 </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">"0"</span><span class="Delimiter">;</span> -<span id="L835" class="LineNr">835 </span> <span class="Identifier">return</span> in<span class="Delimiter">.</span>substr<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">,</span> length<span class="Delimiter">);</span> -<span id="L836" class="LineNr">836 </span><span class="Delimiter">}</span> -<span id="L837" class="LineNr">837 </span> -<span id="L838" class="LineNr">838 </span><span class="Normal">void</span> test_trim_floating_point<span class="Delimiter">()</span> <span class="Delimiter">{</span> -<span id="L839" class="LineNr">839 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">""</span><span class="Delimiter">),</span> <span class="Constant">""</span><span class="Delimiter">);</span> -<span id="L840" class="LineNr">840 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">".0"</span><span class="Delimiter">),</span> <span class="Constant">"0"</span><span class="Delimiter">);</span> -<span id="L841" class="LineNr">841 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"1.5000"</span><span class="Delimiter">),</span> <span class="Constant">"1.5"</span><span class="Delimiter">);</span> -<span id="L842" class="LineNr">842 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"1.000001"</span><span class="Delimiter">),</span> <span class="Constant">"1.000001"</span><span class="Delimiter">);</span> -<span id="L843" class="LineNr">843 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"23.000000"</span><span class="Delimiter">),</span> <span class="Constant">"23"</span><span class="Delimiter">);</span> -<span id="L844" class="LineNr">844 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"23.0"</span><span class="Delimiter">),</span> <span class="Constant">"23"</span><span class="Delimiter">);</span> -<span id="L845" class="LineNr">845 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"23."</span><span class="Delimiter">),</span> <span class="Constant">"23"</span><span class="Delimiter">);</span> -<span id="L846" class="LineNr">846 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"23"</span><span class="Delimiter">),</span> <span class="Constant">"23"</span><span class="Delimiter">);</span> -<span id="L847" class="LineNr">847 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"230"</span><span class="Delimiter">),</span> <span class="Constant">"230"</span><span class="Delimiter">);</span> -<span id="L848" class="LineNr">848 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"3.000000"</span><span class="Delimiter">),</span> <span class="Constant">"3"</span><span class="Delimiter">);</span> -<span id="L849" class="LineNr">849 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"3.0"</span><span class="Delimiter">),</span> <span class="Constant">"3"</span><span class="Delimiter">);</span> -<span id="L850" class="LineNr">850 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"3."</span><span class="Delimiter">),</span> <span class="Constant">"3"</span><span class="Delimiter">);</span> -<span id="L851" class="LineNr">851 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"3"</span><span class="Delimiter">),</span> <span class="Constant">"3"</span><span class="Delimiter">);</span> -<span id="L852" class="LineNr">852 </span><span class="Delimiter">}</span> -<span id="L853" class="LineNr">853 </span> -<span id="L854" class="LineNr">854 </span><span class="Delimiter">:(before "End Includes")</span> -<span id="L855" class="LineNr">855 </span><span class="PreProc">#include </span><span class="Constant"><utility></span> -<span id="L856" class="LineNr">856 </span><span class="Normal">using</span> std::pair<span class="Delimiter">;</span> -<span id="L857" class="LineNr">857 </span><span class="PreProc">#include </span><span class="Constant"><math.h></span> +<span id="L709" class="LineNr">709 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type == <span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">"()"</span><span class="Delimiter">;</span> +<span id="L710" class="LineNr">710 </span> ostringstream out<span class="Delimiter">;</span> +<span id="L711" class="LineNr">711 </span> dump<span class="Delimiter">(</span>type<span class="Delimiter">,</span> out<span class="Delimiter">);</span> +<span id="L712" class="LineNr">712 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> +<span id="L713" class="LineNr">713 </span><span class="Delimiter">}</span> +<span id="L714" class="LineNr">714 </span> +<span id="L715" class="LineNr">715 </span><span class="Normal">void</span> dump<span class="Delimiter">(</span><span class="Normal">const</span> type_tree* x<span class="Delimiter">,</span> ostream& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L716" class="LineNr">716 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L717" class="LineNr">717 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L718" class="LineNr">718 </span> <span class="Conceal">¦</span> dump<span class="Delimiter">(</span>x<span class="Delimiter">-></span>value<span class="Delimiter">,</span> out<span class="Delimiter">);</span> +<span id="L719" class="LineNr">719 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L720" class="LineNr">720 </span> <span class="Delimiter">}</span> +<span id="L721" class="LineNr">721 </span> out << <span class="Constant">'('</span><span class="Delimiter">;</span> +<span id="L722" class="LineNr">722 </span> <span class="Normal">const</span> type_tree* curr = x<span class="Delimiter">;</span> +<span id="L723" class="LineNr">723 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>curr && !curr<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L724" class="LineNr">724 </span> <span class="Conceal">¦</span> dump<span class="Delimiter">(</span>curr<span class="Delimiter">-></span>left<span class="Delimiter">,</span> out<span class="Delimiter">);</span> +<span id="L725" class="LineNr">725 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">-></span>right<span class="Delimiter">)</span> out << <span class="Constant">' '</span><span class="Delimiter">;</span> +<span id="L726" class="LineNr">726 </span> <span class="Conceal">¦</span> curr = curr<span class="Delimiter">-></span>right<span class="Delimiter">;</span> +<span id="L727" class="LineNr">727 </span> <span class="Delimiter">}</span> +<span id="L728" class="LineNr">728 </span> <span class="Comment">// check for dotted list; should never happen</span> +<span id="L729" class="LineNr">729 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L730" class="LineNr">730 </span> <span class="Conceal">¦</span> out << <span class="Constant">". "</span><span class="Delimiter">;</span> +<span id="L731" class="LineNr">731 </span> <span class="Conceal">¦</span> dump<span class="Delimiter">(</span>curr<span class="Delimiter">,</span> out<span class="Delimiter">);</span> +<span id="L732" class="LineNr">732 </span> <span class="Delimiter">}</span> +<span id="L733" class="LineNr">733 </span> out << <span class="Constant">')'</span><span class="Delimiter">;</span> +<span id="L734" class="LineNr">734 </span><span class="Delimiter">}</span> +<span id="L735" class="LineNr">735 </span> +<span id="L736" class="LineNr">736 </span><span class="Normal">void</span> dump<span class="Delimiter">(</span><a href='010vm.cc.html#L123'>type_ordinal</a> type<span class="Delimiter">,</span> ostream& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L737" class="LineNr">737 </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> +<span id="L738" class="LineNr">738 </span> <span class="Conceal">¦</span> out << get<span class="Delimiter">(</span>Type<span class="Delimiter">,</span> type<span class="Delimiter">).</span>name<span class="Delimiter">;</span> +<span id="L739" class="LineNr">739 </span> <span class="Normal">else</span> +<span id="L740" class="LineNr">740 </span> <span class="Conceal">¦</span> out << <span class="Constant">"?"</span> << type<span class="Delimiter">;</span> +<span id="L741" class="LineNr">741 </span><span class="Delimiter">}</span> +<span id="L742" class="LineNr">742 </span> +<span id="L743" class="LineNr">743 </span>string names_to_string<span class="Delimiter">(</span><span class="Normal">const</span> type_tree* type<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L744" class="LineNr">744 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type == <span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">"()"</span><span class="Delimiter">;</span> <span class="Comment">// should never happen</span> +<span id="L745" class="LineNr">745 </span> ostringstream out<span class="Delimiter">;</span> +<span id="L746" class="LineNr">746 </span> dump_names<span class="Delimiter">(</span>type<span class="Delimiter">,</span> out<span class="Delimiter">);</span> +<span id="L747" class="LineNr">747 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> +<span id="L748" class="LineNr">748 </span><span class="Delimiter">}</span> +<span id="L749" class="LineNr">749 </span> +<span id="L750" class="LineNr">750 </span><span class="Normal">void</span> dump_names<span class="Delimiter">(</span><span class="Normal">const</span> type_tree* x<span class="Delimiter">,</span> ostream& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L751" class="LineNr">751 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L752" class="LineNr">752 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L753" class="LineNr">753 </span> <span class="Conceal">¦</span> out << <span class="Constant">'"'</span> << x<span class="Delimiter">-></span>name << <span class="Constant">'"'</span><span class="Delimiter">;</span> +<span id="L754" class="LineNr">754 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L755" class="LineNr">755 </span> <span class="Delimiter">}</span> +<span id="L756" class="LineNr">756 </span> out << <span class="Constant">'('</span><span class="Delimiter">;</span> +<span id="L757" class="LineNr">757 </span> <span class="Normal">const</span> type_tree* curr = x<span class="Delimiter">;</span> +<span id="L758" class="LineNr">758 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>curr && !curr<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L759" class="LineNr">759 </span> <span class="Conceal">¦</span> dump_names<span class="Delimiter">(</span>curr<span class="Delimiter">-></span>left<span class="Delimiter">,</span> out<span class="Delimiter">);</span> +<span id="L760" class="LineNr">760 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">-></span>right<span class="Delimiter">)</span> out << <span class="Constant">' '</span><span class="Delimiter">;</span> +<span id="L761" class="LineNr">761 </span> <span class="Conceal">¦</span> curr = curr<span class="Delimiter">-></span>right<span class="Delimiter">;</span> +<span id="L762" class="LineNr">762 </span> <span class="Delimiter">}</span> +<span id="L763" class="LineNr">763 </span> <span class="Comment">// check for dotted list; should never happen</span> +<span id="L764" class="LineNr">764 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L765" class="LineNr">765 </span> <span class="Conceal">¦</span> out << <span class="Constant">". "</span><span class="Delimiter">;</span> +<span id="L766" class="LineNr">766 </span> <span class="Conceal">¦</span> dump_names<span class="Delimiter">(</span>curr<span class="Delimiter">,</span> out<span class="Delimiter">);</span> +<span id="L767" class="LineNr">767 </span> <span class="Delimiter">}</span> +<span id="L768" class="LineNr">768 </span> out << <span class="Constant">')'</span><span class="Delimiter">;</span> +<span id="L769" class="LineNr">769 </span><span class="Delimiter">}</span> +<span id="L770" class="LineNr">770 </span> +<span id="L771" class="LineNr">771 </span>string names_to_string_without_quotes<span class="Delimiter">(</span><span class="Normal">const</span> type_tree* type<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L772" class="LineNr">772 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>type == <span class="Constant">NULL</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">"()"</span><span class="Delimiter">;</span> +<span id="L773" class="LineNr">773 </span> ostringstream out<span class="Delimiter">;</span> +<span id="L774" class="LineNr">774 </span> dump_names_without_quotes<span class="Delimiter">(</span>type<span class="Delimiter">,</span> out<span class="Delimiter">);</span> +<span id="L775" class="LineNr">775 </span> <span class="Identifier">return</span> out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> +<span id="L776" class="LineNr">776 </span><span class="Delimiter">}</span> +<span id="L777" class="LineNr">777 </span> +<span id="L778" class="LineNr">778 </span><span class="Normal">void</span> dump_names_without_quotes<span class="Delimiter">(</span><span class="Normal">const</span> type_tree* x<span class="Delimiter">,</span> ostream& out<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L779" class="LineNr">779 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L780" class="LineNr">780 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L781" class="LineNr">781 </span> <span class="Conceal">¦</span> out << x<span class="Delimiter">-></span>name<span class="Delimiter">;</span> +<span id="L782" class="LineNr">782 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span><span class="Delimiter">;</span> +<span id="L783" class="LineNr">783 </span> <span class="Delimiter">}</span> +<span id="L784" class="LineNr">784 </span> out << <span class="Constant">'('</span><span class="Delimiter">;</span> +<span id="L785" class="LineNr">785 </span> <span class="Normal">const</span> type_tree* curr = x<span class="Delimiter">;</span> +<span id="L786" class="LineNr">786 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>curr && !curr<span class="Delimiter">-></span>atom<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L787" class="LineNr">787 </span> <span class="Conceal">¦</span> dump_names_without_quotes<span class="Delimiter">(</span>curr<span class="Delimiter">-></span>left<span class="Delimiter">,</span> out<span class="Delimiter">);</span> +<span id="L788" class="LineNr">788 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">-></span>right<span class="Delimiter">)</span> out << <span class="Constant">' '</span><span class="Delimiter">;</span> +<span id="L789" class="LineNr">789 </span> <span class="Conceal">¦</span> curr = curr<span class="Delimiter">-></span>right<span class="Delimiter">;</span> +<span id="L790" class="LineNr">790 </span> <span class="Delimiter">}</span> +<span id="L791" class="LineNr">791 </span> <span class="Comment">// check for dotted list; should never happen</span> +<span id="L792" class="LineNr">792 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>curr<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L793" class="LineNr">793 </span> <span class="Conceal">¦</span> out << <span class="Constant">". "</span><span class="Delimiter">;</span> +<span id="L794" class="LineNr">794 </span> <span class="Conceal">¦</span> dump_names_without_quotes<span class="Delimiter">(</span>curr<span class="Delimiter">,</span> out<span class="Delimiter">);</span> +<span id="L795" class="LineNr">795 </span> <span class="Delimiter">}</span> +<span id="L796" class="LineNr">796 </span> out << <span class="Constant">')'</span><span class="Delimiter">;</span> +<span id="L797" class="LineNr">797 </span><span class="Delimiter">}</span> +<span id="L798" class="LineNr">798 </span> +<span id="L799" class="LineNr">799 </span><span class="Comment">//: helper to print numbers without excessive precision</span> +<span id="L800" class="LineNr">800 </span> +<span id="L801" class="LineNr">801 </span><span class="Delimiter">:(before "End Types")</span> +<span id="L802" class="LineNr">802 </span><span class="Normal">struct</span> no_scientific <span class="Delimiter">{</span> +<span id="L803" class="LineNr">803 </span> <span class="Normal">double</span> x<span class="Delimiter">;</span> +<span id="L804" class="LineNr">804 </span> <span class="Normal">explicit</span> no_scientific<span class="Delimiter">(</span><span class="Normal">double</span> y<span class="Delimiter">)</span> :x<span class="Delimiter">(</span>y<span class="Delimiter">)</span> <span class="Delimiter">{}</span> +<span id="L805" class="LineNr">805 </span><span class="Delimiter">};</span> +<span id="L806" class="LineNr">806 </span> +<span id="L807" class="LineNr">807 </span><span class="Delimiter">:(code)</span> +<span id="L808" class="LineNr">808 </span>ostream& <span class="Normal">operator</span><<<span class="Delimiter">(</span>ostream& os<span class="Delimiter">,</span> no_scientific x<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L809" class="LineNr">809 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>!isfinite<span class="Delimiter">(</span>x<span class="Delimiter">.</span>x<span class="Delimiter">))</span> <span class="Delimiter">{</span> +<span id="L810" class="LineNr">810 </span> <span class="Conceal">¦</span> <span class="Comment">// Infinity or NaN</span> +<span id="L811" class="LineNr">811 </span> <span class="Conceal">¦</span> os << x<span class="Delimiter">.</span>x<span class="Delimiter">;</span> +<span id="L812" class="LineNr">812 </span> <span class="Conceal">¦</span> <span class="Identifier">return</span> os<span class="Delimiter">;</span> +<span id="L813" class="LineNr">813 </span> <span class="Delimiter">}</span> +<span id="L814" class="LineNr">814 </span> ostringstream tmp<span class="Delimiter">;</span> +<span id="L815" class="LineNr">815 </span> <span class="Comment">// more accurate, but too slow</span> +<span id="L816" class="LineNr">816 </span><span class="CommentedCode">//? tmp.precision(308); // for 64-bit numbers</span> +<span id="L817" class="LineNr">817 </span> tmp << std::fixed << x<span class="Delimiter">.</span>x<span class="Delimiter">;</span> +<span id="L818" class="LineNr">818 </span> os << trim_floating_point<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>str<span class="Delimiter">());</span> +<span id="L819" class="LineNr">819 </span> <span class="Identifier">return</span> os<span class="Delimiter">;</span> +<span id="L820" class="LineNr">820 </span><span class="Delimiter">}</span> +<span id="L821" class="LineNr">821 </span> +<span id="L822" class="LineNr">822 </span>string trim_floating_point<span class="Delimiter">(</span><span class="Normal">const</span> string& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L823" class="LineNr">823 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span> <span class="Constant">""</span><span class="Delimiter">;</span> +<span id="L824" class="LineNr">824 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<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">return</span> in<span class="Delimiter">;</span> +<span id="L825" class="LineNr">825 </span> <span class="Normal">int</span> length = <a href='001help.cc.html#L138'>SIZE</a><span class="Delimiter">(</span>in<span class="Delimiter">);</span> +<span id="L826" class="LineNr">826 </span> <span class="Normal">while</span> <span class="Delimiter">(</span>length > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span id="L827" class="LineNr">827 </span> <span class="Conceal">¦</span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>at<span class="Delimiter">(</span>length-<span class="Constant">1</span><span class="Delimiter">)</span> != <span class="Constant">'0'</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> +<span id="L828" class="LineNr">828 </span> <span class="Conceal">¦</span> --length<span class="Delimiter">;</span> +<span id="L829" class="LineNr">829 </span> <span class="Delimiter">}</span> +<span id="L830" class="LineNr">830 </span> <span class="Normal">if</span> <span class="Delimiter">(</span>in<span class="Delimiter">.</span>at<span class="Delimiter">(</span>length-<span class="Constant">1</span><span class="Delimiter">)</span> == <span class="Constant">'.'</span><span class="Delimiter">)</span> --length<span class="Delimiter">;</span> +<span id="L831" class="LineNr">831 </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">"0"</span><span class="Delimiter">;</span> +<span id="L832" class="LineNr">832 </span> <span class="Identifier">return</span> in<span class="Delimiter">.</span>substr<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">,</span> length<span class="Delimiter">);</span> +<span id="L833" class="LineNr">833 </span><span class="Delimiter">}</span> +<span id="L834" class="LineNr">834 </span> +<span id="L835" class="LineNr">835 </span><span class="Normal">void</span> test_trim_floating_point<span class="Delimiter">()</span> <span class="Delimiter">{</span> +<span id="L836" class="LineNr">836 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">""</span><span class="Delimiter">),</span> <span class="Constant">""</span><span class="Delimiter">);</span> +<span id="L837" class="LineNr">837 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">".0"</span><span class="Delimiter">),</span> <span class="Constant">"0"</span><span class="Delimiter">);</span> +<span id="L838" class="LineNr">838 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"1.5000"</span><span class="Delimiter">),</span> <span class="Constant">"1.5"</span><span class="Delimiter">);</span> +<span id="L839" class="LineNr">839 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"1.000001"</span><span class="Delimiter">),</span> <span class="Constant">"1.000001"</span><span class="Delimiter">);</span> +<span id="L840" class="LineNr">840 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"23.000000"</span><span class="Delimiter">),</span> <span class="Constant">"23"</span><span class="Delimiter">);</span> +<span id="L841" class="LineNr">841 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"23.0"</span><span class="Delimiter">),</span> <span class="Constant">"23"</span><span class="Delimiter">);</span> +<span id="L842" class="LineNr">842 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"23."</span><span class="Delimiter">),</span> <span class="Constant">"23"</span><span class="Delimiter">);</span> +<span id="L843" class="LineNr">843 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"23"</span><span class="Delimiter">),</span> <span class="Constant">"23"</span><span class="Delimiter">);</span> +<span id="L844" class="LineNr">844 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"230"</span><span class="Delimiter">),</span> <span class="Constant">"230"</span><span class="Delimiter">);</span> +<span id="L845" class="LineNr">845 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"3.000000"</span><span class="Delimiter">),</span> <span class="Constant">"3"</span><span class="Delimiter">);</span> +<span id="L846" class="LineNr">846 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"3.0"</span><span class="Delimiter">),</span> <span class="Constant">"3"</span><span class="Delimiter">);</span> +<span id="L847" class="LineNr">847 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"3."</span><span class="Delimiter">),</span> <span class="Constant">"3"</span><span class="Delimiter">);</span> +<span id="L848" class="LineNr">848 </span> <a href='002test.cc.html#L32'>CHECK_EQ</a><span class="Delimiter">(</span>trim_floating_point<span class="Delimiter">(</span><span class="Constant">"3"</span><span class="Delimiter">),</span> <span class="Constant">"3"</span><span class="Delimiter">);</span> +<span id="L849" class="LineNr">849 </span><span class="Delimiter">}</span> +<span id="L850" class="LineNr">850 </span> +<span id="L851" class="LineNr">851 </span><span class="Delimiter">:(before "End Includes")</span> +<span id="L852" class="LineNr">852 </span><span class="PreProc">#include </span><span class="Constant"><utility></span> +<span id="L853" class="LineNr">853 </span><span class="Normal">using</span> std::pair<span class="Delimiter">;</span> +<span id="L854" class="LineNr">854 </span><span class="PreProc">#include </span><span class="Constant"><math.h></span> </pre> </body> </html> diff --git a/html/035lookup.cc.html b/html/035lookup.cc.html index 20c3031d..09b9f4f6 100644 --- a/html/035lookup.cc.html +++ b/html/035lookup.cc.html @@ -239,7 +239,7 @@ if ('onhashchange' in window) { <span id="L174" class="LineNr">174 </span><span class="Normal">bool</span> canonize_type<span class="Delimiter">(</span>reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span id="L175" class="LineNr">175 </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="L176" class="LineNr">176 </span> <span class="Conceal">¦</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 != get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">"address"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> -<span id="L177" class="LineNr">177 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>raise</a> << <span class="Constant">"can't lookup non-address: '"</span> << <a href='028call_return.cc.html#L158'>to_string</a><span class="Delimiter">(</span>r<span class="Delimiter">)</span> << <span class="Constant">"': '"</span> << <a href='028call_return.cc.html#L158'>to_string</a><span class="Delimiter">(</span>r<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="L177" class="LineNr">177 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='003trace.cc.html#L168'>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#L158'>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#L185'>end</a><span class="Delimiter">();</span> <span id="L178" class="LineNr">178 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span id="L179" class="LineNr">179 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L180" class="LineNr">180 </span> <span class="Conceal">¦</span> drop_from_type<span class="Delimiter">(</span>r<span class="Delimiter">,</span> <span class="Constant">"address"</span><span class="Delimiter">);</span> |