about summary refs log blame commit diff stats
path: root/html/031address.cc.html
blob: 54b8edd3fb6d9019dfec320b6dfa3ff84810fc68 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12



                                                                                          
                                 






                                                                                         

                                                                                                 
                        
                                
                                  
                             
                                   

                              
                            
                               
                             











                                                                                                           
                                                   


                                                        
                                                                                                                               
                                                                                                                 
                                                                                                  
                                                                                                                                      
 

                                                                 
                                                                                                                                                   
                                                                          

                                                                                                    
                                                  

                                                         
                                                                                                                               
                                                                                                                                
 

                                                                 
                                                                                                                                                               
                                                                          
                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                                                                                         



                                                                        

                                                           




                                                                                                                                
                                                                                                               

                                      




                                                                                                                                                                                                       

                                


                                                                                                                                                                                                                                                                                                                                                                                                                                           
                                                                          
                                  
                                               
                                                                                                                                                                               
                                                                                                                                                                                                                                                                                                      
                                                                          
                                  

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             

                                                                                                                                                                    


                                                                                   






                                                                                                                                           


                                                                                                                                                                                                                                   









                                                                                                                                                                                                                                


                                                                                                                                                                                                  



                                                                                                                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                                                                                                                                                                            

                                                                                                                

                                                                                                                                                                      




                                                                                                           
                                                                                                                                                                                       
                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                              

                                                                          

                                                                                                                                                                                                                                                                                                                                               

                                                                          



                                                                                                                      







                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                  
                                                                                                            




                                                                              



                                                                                                                                                                                                           
 

                                                                 




                                                                                                                 
                                                                                                                               



                                                                                                                                                                                                                    
                                                                       
             



                                                                                                                                                                                                               
 

                                                                 





                                                                                                                                                                                               



                                                                    


                                                                                                                 
                                                                                                                                                                                                                           
 
                                                                
 





                                                                                                                                                                                            
 
                                                                                 
 

                                                              
                                                                                                                               


                                                                                                                                
                                                                                                                            
                                                                 
 

                                                                        
                                                                                                                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                                                           
                                  
                                                                                                                
                                                                                                                                                                                                    

                                
                                                              



                                                                                      
                                                                                                                                                                                                        
                                                                                         
                                            


                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              



                                                                                      
                                                                                                                 
                                                                
                                                                                    


                                                                                      
                                                                                                                                                                                                      
                                                                                         

                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                                                                                                                                                                 
                                                                                         
                                  
                                       


                                                                                                                                                                                                                    
                                  
                                                                       




                                     
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Mu - 031address.cc</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="cpp">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="minimal">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; }
body { font-family: monospace; color: #eeeeee; background-color: #080808; }
* { font-size: 1.05em; }
.traceAbsent { color: #c00000; }
.traceContains { color: #008000; }
.cSpecial { color: #008000; }
.SalientComment { color: #00ffff; }
.Comment { color: #9090ff; }
.Delimiter { color: #a04060; }
.Special { color: #ff6060; }
.Identifier { color: #804000; }
.Constant { color: #00a0a0; }
-->
</style>

<script type='text/javascript'>
<!--

-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Comment">//: Instructions can read from addresses pointing at other locations using the</span>
<span class="Comment">//: 'lookup' property.</span>

<span class="Delimiter">:(scenario copy_indirect)</span>
recipe main [
  <span class="Constant">1</span>:address:number<span class="Special"> &lt;- </span>copy <span class="Constant">2</span>/unsafe
  <span class="Constant">2</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
  <span class="Comment"># This loads location 1 as an address and looks up *that* location.</span>
  <span class="Constant">3</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">1</span>:address:number/lookup
]
<span class="traceContains">+mem: storing 34 in location 3</span>

<span class="Delimiter">:(before &quot;long long int base = x.value&quot; following &quot;vector&lt;double&gt; read_memory(reagent x)&quot;)</span>
canonize<span class="Delimiter">(</span>x<span class="Delimiter">);</span>

<span class="Comment">//: similarly, write to addresses pointing at other locations using the</span>
<span class="Comment">//: 'lookup' property</span>
<span class="Delimiter">:(scenario store_indirect)</span>
recipe main [
  <span class="Constant">1</span>:address:number<span class="Special"> &lt;- </span>copy <span class="Constant">2</span>/unsafe
  <span class="Constant">1</span>:address:number/lookup<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
]
<span class="traceContains">+mem: storing 34 in location 2</span>

<span class="Delimiter">:(before &quot;long long int base = x.value&quot; following &quot;void write_memory(reagent x, vector&lt;double&gt; data)&quot;)</span>
canonize<span class="Delimiter">(</span>x<span class="Delimiter">);</span>
if <span class="Delimiter">(</span>x<span class="Delimiter">.</span>value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
  raise_error &lt;&lt; <span class="Constant">&quot;can't write to location 0 in '&quot;</span> &lt;&lt; to_string<span class="Delimiter">(</span>current_instruction<span class="Delimiter">())</span> &lt;&lt; <span class="Constant">&quot;'</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
  <span class="Identifier">return</span><span class="Delimiter">;</span>
<span class="Delimiter">}</span>

<span class="Comment">//: writes to address 0 always loudly fail</span>
<span class="Delimiter">:(scenario store_to_0_fails)</span>
<span class="Special">% Hide_errors = true;</span>
recipe main [
  <span class="Constant">1</span>:address:number<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
  <span class="Constant">1</span>:address:number/lookup<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
]
<span class="traceAbsent">-mem: storing 34 in location 0</span>
<span class="traceContains">+error: can't write to location 0 in '1:address:number/lookup &lt;- copy 34'</span>

<span class="Delimiter">:(code)</span>
void canonize<span class="Delimiter">(</span>reagent&amp; x<span class="Delimiter">)</span> <span class="Delimiter">{</span>
  if <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 class="Comment">// End canonize(x) Special-cases</span>
  while <span class="Delimiter">(</span>has_property<span class="Delimiter">(</span>x<span class="Delimiter">,</span> <span class="Constant">&quot;lookup&quot;</span><span class="Delimiter">))</span>
    lookup_memory<span class="Delimiter">(</span>x<span class="Delimiter">);</span>
<span class="Delimiter">}</span>

void lookup_memory<span class="Delimiter">(</span>reagent&amp; x<span class="Delimiter">)</span> <span class="Delimiter">{</span>
  if <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type || x<span class="Delimiter">.</span>type<span class="Delimiter">-&gt;</span>value != get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">&quot;address&quot;</span><span class="Delimiter">))</span> <span class="Delimiter">{</span>
    raise_error &lt;&lt; maybe<span class="Delimiter">(</span>current_recipe_name<span class="Delimiter">())</span> &lt;&lt; <span class="Constant">&quot;tried to /lookup &quot;</span> &lt;&lt; x<span class="Delimiter">.</span>original_string &lt;&lt; <span class="Constant">&quot; but it isn't an address</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
    <span class="Identifier">return</span><span class="Delimiter">;</span>
  <span class="Delimiter">}</span>
  <span class="Comment">// compute value</span>
  if <span class="Delimiter">(</span>x<span class="Delimiter">.</span>value == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
    raise_error &lt;&lt; maybe<span class="Delimiter">(</span>current_recipe_name<span class="Delimiter">())</span> &lt;&lt; <span class="Constant">&quot;tried to /lookup 0</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
    <span class="Identifier">return</span><span class="Delimiter">;</span>
  <span class="Delimiter">}</span>
  trace<span class="Delimiter">(</span><span class="Constant">9999</span><span class="Delimiter">,</span> <span class="Constant">&quot;mem&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;location &quot;</span> &lt;&lt; x<span class="Delimiter">.</span>value &lt;&lt; <span class="Constant">&quot; is &quot;</span> &lt;&lt; no_scientific<span class="Delimiter">(</span>get_or_insert<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> x<span class="Delimiter">.</span>value<span class="Delimiter">))</span> &lt;&lt; end<span class="Delimiter">();</span>
  x<span class="Delimiter">.</span>set_value<span class="Delimiter">(</span>get_or_insert<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> x<span class="Delimiter">.</span>value<span class="Delimiter">));</span>
  drop_from_type<span class="Delimiter">(</span>x<span class="Delimiter">,</span> <span class="Constant">&quot;address&quot;</span><span class="Delimiter">);</span>
  <span class="Comment">// End Drop Address In lookup_memory(x)</span>
  drop_one_lookup<span class="Delimiter">(</span>x<span class="Delimiter">);</span>
<span class="Delimiter">}</span>

<span class="Delimiter">:(scenario canonize_non_pointer_fails_without_crashing)</span>
<span class="Special">% Hide_errors = true;</span>
recipe foo [
  <span class="Constant">1</span>:address:number<span class="Special"> &lt;- </span>get-address *p<span class="Delimiter">,</span> x:offset
]
<span class="Comment"># don't crash</span>

<span class="Delimiter">:(after &quot;bool types_strictly_match(reagent to, reagent from)&quot;)</span>
  if <span class="Delimiter">(</span>!canonize_type<span class="Delimiter">(</span>to<span class="Delimiter">))</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span>
  if <span class="Delimiter">(</span>!canonize_type<span class="Delimiter">(</span>from<span class="Delimiter">))</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span>

<span class="Delimiter">:(after &quot;bool is_mu_array(reagent r)&quot;)</span>
  if <span class="Delimiter">(</span>!canonize_type<span class="Delimiter">(</span>r<span class="Delimiter">))</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span>

<span class="Delimiter">:(after &quot;bool is_mu_address(reagent r)&quot;)</span>
  if <span class="Delimiter">(</span>!canonize_type<span class="Delimiter">(</span>r<span class="Delimiter">))</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span>

<span class="Delimiter">:(after &quot;bool is_mu_number(reagent r)&quot;)</span>
  if <span class="Delimiter">(</span>!canonize_type<span class="Delimiter">(</span>r<span class="Delimiter">))</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span>

<span class="Delimiter">:(after &quot;Update product While Type-checking Merge&quot;)</span>
if <span class="Delimiter">(</span>!canonize_type<span class="Delimiter">(</span>product<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span>

<span class="Delimiter">:(code)</span>
bool canonize_type<span class="Delimiter">(</span>reagent&amp; r<span class="Delimiter">)</span> <span class="Delimiter">{</span>
  while <span class="Delimiter">(</span>has_property<span class="Delimiter">(</span>r<span class="Delimiter">,</span> <span class="Constant">&quot;lookup&quot;</span><span class="Delimiter">))</span> <span class="Delimiter">{</span>
    if <span class="Delimiter">(</span>!r<span class="Delimiter">.</span>type || r<span class="Delimiter">.</span>type<span class="Delimiter">-&gt;</span>value != get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">&quot;address&quot;</span><span class="Delimiter">))</span> <span class="Delimiter">{</span>
      raise_error &lt;&lt; <span class="Constant">&quot;can't lookup non-address: &quot;</span> &lt;&lt; to_string<span class="Delimiter">(</span>r<span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;: &quot;</span> &lt;&lt; to_string<span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">)</span> &lt;&lt; <span class="cSpecial">'\n'</span> &lt;&lt; end<span class="Delimiter">();</span>
      <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span>
    <span class="Delimiter">}</span>
    drop_from_type<span class="Delimiter">(</span>r<span class="Delimiter">,</span> <span class="Constant">&quot;address&quot;</span><span class="Delimiter">);</span>
    <span class="Comment">// End Drop Address In canonize_type(r)</span>
    drop_one_lookup<span class="Delimiter">(</span>r<span class="Delimiter">);</span>
  <span class="Delimiter">}</span>
  <span class="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span>
<span class="Delimiter">}</span>

void drop_from_type<span class="Delimiter">(</span>reagent&amp; r<span class="Delimiter">,</span> string expected_type<span class="Delimiter">)</span> <span class="Delimiter">{</span>
  if <span class="Delimiter">(</span>!r<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Delimiter">{</span>
    raise_error &lt;&lt; <span class="Constant">&quot;can't drop &quot;</span> &lt;&lt; expected_type &lt;&lt; <span class="Constant">&quot; from &quot;</span> &lt;&lt; to_string<span class="Delimiter">(</span>r<span class="Delimiter">)</span> &lt;&lt; <span class="cSpecial">'\n'</span> &lt;&lt; end<span class="Delimiter">();</span>
    <span class="Identifier">return</span><span class="Delimiter">;</span>
  <span class="Delimiter">}</span>
  if <span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">-&gt;</span>name != expected_type<span class="Delimiter">)</span> <span class="Delimiter">{</span>
    raise_error &lt;&lt; <span class="Constant">&quot;can't drop2 &quot;</span> &lt;&lt; expected_type &lt;&lt; <span class="Constant">&quot; from &quot;</span> &lt;&lt; to_string<span class="Delimiter">(</span>r<span class="Delimiter">)</span> &lt;&lt; <span class="cSpecial">'\n'</span> &lt;&lt; end<span class="Delimiter">();</span>
    <span class="Identifier">return</span><span class="Delimiter">;</span>
  <span class="Delimiter">}</span>
  type_tree* tmp = r<span class="Delimiter">.</span>type<span class="Delimiter">;</span>
  r<span class="Delimiter">.</span>type = tmp<span class="Delimiter">-&gt;</span>right<span class="Delimiter">;</span>
  tmp<span class="Delimiter">-&gt;</span>right = <span class="Constant">NULL</span><span class="Delimiter">;</span>
  delete tmp<span class="Delimiter">;</span>
<span class="Delimiter">}</span>

void drop_one_lookup<span class="Delimiter">(</span>reagent&amp; r<span class="Delimiter">)</span> <span class="Delimiter">{</span>
  for <span class="Delimiter">(</span>vector&lt;pair&lt;string<span class="Delimiter">,</span> string_tree*&gt; &gt;::iterator p = r<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>begin<span class="Delimiter">();</span> p != r<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>end<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span>
    if <span class="Delimiter">(</span>p<span class="Delimiter">-&gt;</span>first == <span class="Constant">&quot;lookup&quot;</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
      r<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>p<span class="Delimiter">);</span>
      <span class="Identifier">return</span><span class="Delimiter">;</span>
    <span class="Delimiter">}</span>
  <span class="Delimiter">}</span>
  assert<span class="Delimiter">(</span><span class="Constant">false</span><span class="Delimiter">);</span>
<span class="Delimiter">}</span>

<span class="SalientComment">//:: 'get' can read from container address</span>
<span class="Delimiter">:(scenario get_indirect)</span>
recipe main [
  <span class="Constant">1</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">2</span>
  <span class="Constant">2</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
  <span class="Constant">3</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">35</span>
  <span class="Constant">4</span>:number<span class="Special"> &lt;- </span>get <span class="Constant">1</span>:address:point/lookup<span class="Delimiter">,</span> <span class="Constant">0</span>:offset
]
<span class="traceContains">+mem: storing 34 in location 4</span>

<span class="Delimiter">:(scenario get_indirect2)</span>
recipe main [
  <span class="Constant">1</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">2</span>
  <span class="Constant">2</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
  <span class="Constant">3</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">35</span>
  <span class="Constant">4</span>:address:number<span class="Special"> &lt;- </span>copy <span class="Constant">5</span>/unsafe
  *<span class="Constant">4</span>:address:number<span class="Special"> &lt;- </span>get <span class="Constant">1</span>:address:point/lookup<span class="Delimiter">,</span> <span class="Constant">0</span>:offset
]
<span class="traceContains">+mem: storing 34 in location 5</span>

<span class="Delimiter">:(scenario include_nonlookup_properties)</span>
recipe main [
  <span class="Constant">1</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">2</span>
  <span class="Constant">2</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
  <span class="Constant">3</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">35</span>
  <span class="Constant">4</span>:number<span class="Special"> &lt;- </span>get <span class="Constant">1</span>:address:point/lookup/foo<span class="Delimiter">,</span> <span class="Constant">0</span>:offset
]
<span class="traceContains">+mem: storing 34 in location 4</span>

<span class="Delimiter">:(after &quot;Update GET base in Check&quot;)</span>
if <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 class="Delimiter">:(after &quot;Update GET product in Check&quot;)</span>
if <span class="Delimiter">(</span>!canonize_type<span class="Delimiter">(</span>product<span class="Delimiter">))</span> <span class="Identifier">break</span><span class="Delimiter">;</span>
<span class="Delimiter">:(after &quot;Update GET base in Run&quot;)</span>
canonize<span class="Delimiter">(</span>base<span class="Delimiter">);</span>

<span class="Delimiter">:(scenario get_address_indirect)</span>
<span class="Comment"># 'get' can read from container address</span>
recipe main [
  <span class="Constant">1</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">2</span>
  <span class="Constant">2</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
  <span class="Constant">3</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">35</span>
  <span class="Constant">4</span>:address:number<span class="Special"> &lt;- </span>get-address <span class="Constant">1</span>:address:point/lookup<span class="Delimiter">,</span> <span class="Constant">0</span>:offset
]
<span class="traceContains">+mem: storing 2 in location 4</span>

<span class="Delimiter">:(after &quot;Update GET_ADDRESS base in Check&quot;)</span>
if <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 class="Delimiter">:(after &quot;Update GET_ADDRESS product in Check&quot;)</span>
if <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 class="Delimiter">:(after &quot;Update GET_ADDRESS base in Run&quot;)</span>
canonize<span class="Delimiter">(</span>base<span class="Delimiter">);</span>

<span class="SalientComment">//:: abbreviation for '/lookup': a prefix '*'</span>

<span class="Delimiter">:(scenario lookup_abbreviation)</span>
recipe main [
  <span class="Constant">1</span>:address:number<span class="Special"> &lt;- </span>copy <span class="Constant">2</span>/unsafe
  <span class="Constant">2</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">34</span>
  <span class="Constant">3</span>:number<span class="Special"> &lt;- </span>copy *<span class="Constant">1</span>:address:number
]
<span class="traceContains">+parse: ingredient: 1: (&quot;address&quot; &quot;number&quot;), {&quot;lookup&quot;: ()}</span>
<span class="traceContains">+mem: storing 34 in location 3</span>

<span class="Delimiter">:(before &quot;End Parsing reagent&quot;)</span>
<span class="Delimiter">{</span>
  while <span class="Delimiter">(</span>!name<span class="Delimiter">.</span>empty<span class="Delimiter">()</span> &amp;&amp; name<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> == <span class="Constant">'*'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
    name<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>
    properties<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>pair&lt;string<span class="Delimiter">,</span> string_tree*&gt;<span class="Delimiter">(</span><span class="Constant">&quot;lookup&quot;</span><span class="Delimiter">,</span> <span class="Constant">NULL</span><span class="Delimiter">));</span>
  <span class="Delimiter">}</span>
  if <span class="Delimiter">(</span>name<span class="Delimiter">.</span>empty<span class="Delimiter">())</span>
    raise_error &lt;&lt; <span class="Constant">&quot;illegal name &quot;</span> &lt;&lt; original_string &lt;&lt; <span class="cSpecial">'\n'</span> &lt;&lt; end<span class="Delimiter">();</span>
<span class="Delimiter">}</span>

<span class="SalientComment">//:: helpers for debugging</span>

<span class="Delimiter">:(before &quot;End Primitive Recipe Declarations&quot;)</span>
_DUMP<span class="Delimiter">,</span>
<span class="Delimiter">:(before &quot;End Primitive Recipe Numbers&quot;)</span>
put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">&quot;$dump&quot;</span><span class="Delimiter">,</span> _DUMP<span class="Delimiter">);</span>
<span class="Delimiter">:(before &quot;End Primitive Recipe Implementations&quot;)</span>
case _DUMP: <span class="Delimiter">{</span>
  reagent after_canonize = 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>
  canonize<span class="Delimiter">(</span>after_canonize<span class="Delimiter">);</span>
  cerr &lt;&lt; maybe<span class="Delimiter">(</span>current_recipe_name<span class="Delimiter">())</span> &lt;&lt; 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>name &lt;&lt; <span class="Constant">' '</span> &lt;&lt; no_scientific<span class="Delimiter">(</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>value<span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot; =&gt; &quot;</span> &lt;&lt; no_scientific<span class="Delimiter">(</span>after_canonize<span class="Delimiter">.</span>value<span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot; =&gt; &quot;</span> &lt;&lt; no_scientific<span class="Delimiter">(</span>get_or_insert<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> after_canonize<span class="Delimiter">.</span>value<span class="Delimiter">))</span> &lt;&lt; <span class="cSpecial">'\n'</span><span class="Delimiter">;</span>
  <span class="Identifier">break</span><span class="Delimiter">;</span>
<span class="Delimiter">}</span>

<span class="Comment">//: grab an address, and then dump its value at intervals</span>
<span class="Comment">//: useful for tracking down memory corruption (writing to an out-of-bounds address)</span>
<span class="Delimiter">:(before &quot;End Globals&quot;)</span>
long long int foo = -<span class="Constant">1</span><span class="Delimiter">;</span>
<span class="Delimiter">:(before &quot;End Primitive Recipe Declarations&quot;)</span>
_FOO<span class="Delimiter">,</span>
<span class="Delimiter">:(before &quot;End Primitive Recipe Numbers&quot;)</span>
put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">&quot;$foo&quot;</span><span class="Delimiter">,</span> _FOO<span class="Delimiter">);</span>
<span class="Delimiter">:(before &quot;End Primitive Recipe Implementations&quot;)</span>
case _FOO: <span class="Delimiter">{</span>
  if <span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span>
    if <span class="Delimiter">(</span>foo != -<span class="Constant">1</span><span class="Delimiter">)</span> cerr &lt;&lt; foo &lt;&lt; <span class="Constant">&quot;: &quot;</span> &lt;&lt; no_scientific<span class="Delimiter">(</span>get_or_insert<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> foo<span class="Delimiter">))</span> &lt;&lt; <span class="cSpecial">'\n'</span><span class="Delimiter">;</span>
    else cerr &lt;&lt; <span class="cSpecial">'\n'</span><span class="Delimiter">;</span>
  <span class="Delimiter">}</span>
  else <span class="Delimiter">{</span>
    reagent tmp = 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>
    canonize<span class="Delimiter">(</span>tmp<span class="Delimiter">);</span>
    foo = tmp<span class="Delimiter">.</span>value<span class="Delimiter">;</span>
  <span class="Delimiter">}</span>
  <span class="Identifier">break</span><span class="Delimiter">;</span>
<span class="Delimiter">}</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->