diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-05-25 22:27:19 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-05-25 22:27:19 -0700 |
commit | c5ffb6e1cc9c5ff880d037c53b8ebc8562be0008 (patch) | |
tree | 2d05d987ec3c81bfbb0c1f598966d9d1b16e9b1f /html/031address.cc.html | |
parent | b2757892d553352feb59d70b1e7241ccdafa6905 (diff) | |
download | mu-c5ffb6e1cc9c5ff880d037c53b8ebc8562be0008.tar.gz |
1459
Diffstat (limited to 'html/031address.cc.html')
-rw-r--r-- | html/031address.cc.html | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/html/031address.cc.html b/html/031address.cc.html index e54f6df1..0b7759c3 100644 --- a/html/031address.cc.html +++ b/html/031address.cc.html @@ -2,7 +2,7 @@ <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> -<title>~/Desktop/s/mu/031address.cc</title> +<title>031address.cc</title> <meta name="Generator" content="Vim/7.4"> <meta name="plugin-version" content="vim7.4_v1"> <meta name="syntax" content="cpp"> @@ -42,12 +42,9 @@ recipe main [ <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"> <- </span>copy <span class="Constant">1</span>:address:number/deref ] -<span class="traceContains">+run: instruction main/2</span> -<span class="traceContains">+mem: location 1 is 2</span> -<span class="traceContains">+mem: location 2 is 34</span> <span class="traceContains">+mem: storing 34 in location 3</span> -<span class="Delimiter">:(before "index_t base = x.value" following "vector<double> read_memory(reagent x)")</span> +<span class="Delimiter">:(before "long long int base = x.value" following "vector<double> read_memory(reagent x)")</span> x = canonize<span class="Delimiter">(</span>x<span class="Delimiter">);</span> <span class="Comment">//: similarly, write to addresses pointing at other locations using the</span> @@ -57,11 +54,9 @@ recipe main [ <span class="Constant">1</span>:address:number<span class="Special"> <- </span>copy <span class="Constant">2</span>:literal <span class="Constant">1</span>:address:number/deref<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal ] -<span class="traceContains">+run: instruction main/1</span> -<span class="traceContains">+mem: location 1 is 2</span> <span class="traceContains">+mem: storing 34 in location 2</span> -<span class="Delimiter">:(before "index_t base = x.value" following "void write_memory(reagent x, vector<double> data)")</span> +<span class="Delimiter">:(before "long long int base = x.value" following "void write_memory(reagent x, vector<double> data)")</span> x = canonize<span class="Delimiter">(</span>x<span class="Delimiter">);</span> <span class="Delimiter">:(code)</span> @@ -83,14 +78,14 @@ reagent deref<span class="Delimiter">(</span>reagent x<span class="Delimiter">)< <span class="Comment">// compute value</span> result<span class="Delimiter">.</span>set_value<span class="Delimiter">(</span>Memory[x<span class="Delimiter">.</span>value]<span class="Delimiter">);</span> - trace<span class="Delimiter">(</span><span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"location "</span> << x<span class="Delimiter">.</span>value << <span class="Constant">" is "</span> << result<span class="Delimiter">.</span>value<span class="Delimiter">;</span> + trace<span class="Delimiter">(</span>Primitive_recipe_depth<span class="Delimiter">,</span> <span class="Constant">"mem"</span><span class="Delimiter">)</span> << <span class="Constant">"location "</span> << x<span class="Delimiter">.</span>value << <span class="Constant">" is "</span> << result<span class="Delimiter">.</span>value<span class="Delimiter">;</span> <span class="Comment">// populate types</span> copy<span class="Delimiter">(</span>++x<span class="Delimiter">.</span>types<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> x<span class="Delimiter">.</span>types<span class="Delimiter">.</span>end<span class="Delimiter">(),</span> inserter<span class="Delimiter">(</span>result<span class="Delimiter">.</span>types<span class="Delimiter">,</span> result<span class="Delimiter">.</span>types<span class="Delimiter">.</span>begin<span class="Delimiter">()));</span> <span class="Comment">// drop-one 'deref'</span> - index_t i = <span class="Constant">0</span><span class="Delimiter">;</span> - size_t len = x<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>size<span class="Delimiter">();</span> + long long int i = <span class="Constant">0</span><span class="Delimiter">;</span> + long long int len = SIZE<span class="Delimiter">(</span>x<span class="Delimiter">.</span>properties<span class="Delimiter">);</span> for <span class="Delimiter">(</span>i = <span class="Constant">0</span><span class="Delimiter">;</span> i < len<span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> if <span class="Delimiter">(</span>x<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>first == <span class="Constant">"deref"</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> result<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>x<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> @@ -110,9 +105,6 @@ recipe main [ <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">35</span>:literal <span class="Constant">4</span>:number<span class="Special"> <- </span>get <span class="Constant">1</span>:address:point/deref<span class="Delimiter">,</span> <span class="Constant">0</span>:offset ] -<span class="traceContains">+run: instruction main/3</span> -<span class="traceContains">+run: address to copy is 2</span> -<span class="traceContains">+run: product 0 is 4</span> <span class="traceContains">+mem: storing 34 in location 4</span> <span class="Delimiter">:(scenario include_nonderef_properties)</span> @@ -122,9 +114,6 @@ recipe main [ <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">35</span>:literal <span class="Constant">4</span>:number<span class="Special"> <- </span>get <span class="Constant">1</span>:address:point/deref/foo<span class="Delimiter">,</span> <span class="Constant">0</span>:offset ] -<span class="traceContains">+run: instruction main/3</span> -<span class="traceContains">+run: address to copy is 2</span> -<span class="traceContains">+run: product 0 is 4</span> <span class="traceContains">+mem: storing 34 in location 4</span> <span class="Delimiter">:(after "reagent base = " following "case GET:")</span> @@ -138,9 +127,7 @@ recipe main [ <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">35</span>:literal <span class="Constant">4</span>:number<span class="Special"> <- </span>get-address <span class="Constant">1</span>:address:point/deref<span class="Delimiter">,</span> <span class="Constant">0</span>:offset ] -<span class="traceContains">+run: instruction main/3</span> -<span class="traceContains">+run: address to copy is 2</span> -<span class="traceContains">+run: product 0 is 4</span> +<span class="traceContains">+mem: storing 2 in location 4</span> <span class="Delimiter">:(after "reagent base = " following "case GET_ADDRESS:")</span> base = canonize<span class="Delimiter">(</span>base<span class="Delimiter">);</span> @@ -149,14 +136,14 @@ base = canonize<span class="Delimiter">(</span>base<span class="Delimiter">);</s <span class="Delimiter">:(code)</span> bool has_property<span class="Delimiter">(</span>reagent x<span class="Delimiter">,</span> string name<span class="Delimiter">)</span> <span class="Delimiter">{</span> - for <span class="Delimiter">(</span>index_t i = <span class="Constant">0</span><span class="Delimiter">;</span> i < x<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>size<span class="Delimiter">();</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + for <span class="Delimiter">(</span>long long int i = <span class="Comment">/*</span><span class="Comment">skip name:type</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>x<span class="Delimiter">.</span>properties<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> if <span class="Delimiter">(</span>x<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>first == name<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> vector<string> property<span class="Delimiter">(</span>const reagent& r<span class="Delimiter">,</span> const string& name<span class="Delimiter">)</span> <span class="Delimiter">{</span> - for <span class="Delimiter">(</span>index_t p = <span class="Constant">0</span><span class="Delimiter">;</span> p != r<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>size<span class="Delimiter">();</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> + for <span class="Delimiter">(</span>long long int p = <span class="Comment">/*</span><span class="Comment">skip name:type</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> p != SIZE<span class="Delimiter">(</span>r<span class="Delimiter">.</span>properties<span class="Delimiter">);</span> ++p<span class="Delimiter">)</span> <span class="Delimiter">{</span> if <span class="Delimiter">(</span>r<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>p<span class="Delimiter">).</span>first == name<span class="Delimiter">)</span> <span class="Identifier">return</span> r<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span>p<span class="Delimiter">).</span>second<span class="Delimiter">;</span> <span class="Delimiter">}</span> |