diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-05-06 00:19:03 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-05-06 00:19:03 -0700 |
commit | 672e3e50c6ed6de161e40aa256c3fc0f2b1f7cf9 (patch) | |
tree | 5fa3d82e40137b15dec2941a3446e838ce43d3e5 /html/023jump.cc.html | |
parent | 20d1c9057a559ce8db83bbc2787ca91348bcb16f (diff) | |
download | mu-672e3e50c6ed6de161e40aa256c3fc0f2b1f7cf9.tar.gz |
1279 - colorized rendering of the source files
Diffstat (limited to 'html/023jump.cc.html')
-rw-r--r-- | html/023jump.cc.html | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/html/023jump.cc.html b/html/023jump.cc.html new file mode 100644 index 00000000..c20ce9b6 --- /dev/null +++ b/html/023jump.cc.html @@ -0,0 +1,152 @@ +<!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>~/Desktop/s/mu/023jump.cc.html</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: #d0d0d0; background-color: #000000; } +body { font-family: monospace; color: #d0d0d0; background-color: #000000; } +* { font-size: 1em; } +.Constant { color: #008080; } +.Comment { color: #8080ff; } +.Delimiter { color: #c000c0; } +.Special { color: #ff6060; } +.Identifier { color: #008080; } +.traceContains { color: #008000; } +.traceAbsent { color: #c00000; } +--> +</style> + +<script type='text/javascript'> +<!-- + +--> +</script> +</head> +<body> +<pre id='vimCodeElement'> +<span class="Comment">//: Jump primitives</span> + +<span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> +JUMP<span class="Delimiter">,</span> +<span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> +Recipe_number[<span class="Constant">"jump"</span>] = JUMP<span class="Delimiter">;</span> +<span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> +case JUMP: <span class="Delimiter">{</span> + trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ingredient 0 is "</span> << current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">0</span>]<span class="Delimiter">.</span>value<span class="Delimiter">;</span> + current_step_index<span class="Delimiter">()</span> += current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">0</span>]<span class="Delimiter">.</span>value<span class="Delimiter">;</span> + trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"jumping to instruction "</span> << current_step_index<span class="Delimiter">()</span>+<span class="Constant">1</span><span class="Delimiter">;</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> +<span class="Delimiter">}</span> + +<span class="Delimiter">:(scenario jump_can_skip_instructions)</span> +recipe main [ + jump <span class="Constant">1</span>:offset + <span class="Constant">1</span>:integer<span class="Special"> <- </span>copy <span class="Constant">1</span>:literal +] +<span class="traceContains">+run: instruction main/0</span> +<span class="traceContains">+run: ingredient 0 is 1</span> +<span class="traceAbsent">-run: instruction main/1</span> +<span class="traceAbsent">-mem: storing 1 in location 1</span> + +<span class="Delimiter">:(scenario jump_backward)</span> +recipe main [ + jump <span class="Constant">1</span>:offset <span class="Comment"># 0 -+</span> + jump <span class="Constant">1</span>:offset <span class="Comment"># | +-+ 1</span> + <span class="Comment"># \/ /\ |</span> + jump -<span class="Constant">2</span>:offset <span class="Comment"># 2 +-->+ |</span> +] <span class="Comment"># \/ 3</span> +<span class="traceContains">+run: instruction main/0</span> +<span class="traceContains">+run: instruction main/2</span> +<span class="traceContains">+run: instruction main/1</span> + +<span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> +JUMP_IF<span class="Delimiter">,</span> +<span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> +Recipe_number[<span class="Constant">"jump-if"</span>] = JUMP_IF<span class="Delimiter">;</span> +<span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> +case JUMP_IF: <span class="Delimiter">{</span> + vector<long long int> arg0 = read_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">0</span>]<span class="Delimiter">);</span> + assert<span class="Delimiter">(</span>arg0<span class="Delimiter">.</span>size<span class="Delimiter">()</span> == <span class="Constant">1</span><span class="Delimiter">);</span> + trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ingredient 0 is "</span> << arg0[<span class="Constant">0</span>]<span class="Delimiter">;</span> + if <span class="Delimiter">(</span>!arg0[<span class="Constant">0</span>]<span class="Delimiter">)</span> <span class="Delimiter">{</span> + trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"jump-if fell through"</span><span class="Delimiter">;</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> + trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ingredient 1 is "</span> << current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">1</span>]<span class="Delimiter">.</span>name<span class="Delimiter">;</span> + current_step_index<span class="Delimiter">()</span> += current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">1</span>]<span class="Delimiter">.</span>value<span class="Delimiter">;</span> + trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"jumping to instruction "</span> << current_step_index<span class="Delimiter">()</span>+<span class="Constant">1</span><span class="Delimiter">;</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> +<span class="Delimiter">}</span> + +<span class="Delimiter">:(scenario jump_if)</span> +recipe main [ + jump-if <span class="Constant">999</span>:literal <span class="Constant">1</span>:offset + <span class="Constant">1</span>:integer<span class="Special"> <- </span>copy <span class="Constant">1</span>:literal +] +<span class="traceContains">+run: instruction main/0</span> +<span class="traceContains">+run: ingredient 1 is 1</span> +<span class="traceContains">+run: jumping to instruction 2</span> +<span class="traceAbsent">-run: instruction main/1</span> +<span class="traceAbsent">-mem: storing 1 in location 1</span> + +<span class="Delimiter">:(scenario jump_if_fallthrough)</span> +recipe main [ + jump-if <span class="Constant">0</span>:literal <span class="Constant">1</span>:offset + <span class="Constant">123</span>:integer<span class="Special"> <- </span>copy <span class="Constant">1</span>:literal +] +<span class="traceContains">+run: instruction main/0</span> +<span class="traceContains">+run: jump-if fell through</span> +<span class="traceContains">+run: instruction main/1</span> +<span class="traceContains">+mem: storing 1 in location 123</span> + +<span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> +JUMP_UNLESS<span class="Delimiter">,</span> +<span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> +Recipe_number[<span class="Constant">"jump-unless"</span>] = JUMP_UNLESS<span class="Delimiter">;</span> +<span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> +case JUMP_UNLESS: <span class="Delimiter">{</span> + vector<long long int> arg0 = read_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">0</span>]<span class="Delimiter">);</span> + assert<span class="Delimiter">(</span>arg0<span class="Delimiter">.</span>size<span class="Delimiter">()</span> == <span class="Constant">1</span><span class="Delimiter">);</span> + trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ingredient 0 is "</span> << arg0[<span class="Constant">0</span>]<span class="Delimiter">;</span> + if <span class="Delimiter">(</span>arg0[<span class="Constant">0</span>]<span class="Delimiter">)</span> <span class="Delimiter">{</span> + trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"jump-unless fell through"</span><span class="Delimiter">;</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> + trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ingredient 1 is "</span> << current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">1</span>]<span class="Delimiter">.</span>name<span class="Delimiter">;</span> + current_step_index<span class="Delimiter">()</span> += current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">1</span>]<span class="Delimiter">.</span>value<span class="Delimiter">;</span> + trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"jumping to instruction "</span> << current_step_index<span class="Delimiter">()</span>+<span class="Constant">1</span><span class="Delimiter">;</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> +<span class="Delimiter">}</span> + +<span class="Delimiter">:(scenario jump_unless)</span> +recipe main [ + jump-unless <span class="Constant">0</span>:literal <span class="Constant">1</span>:offset + <span class="Constant">1</span>:integer<span class="Special"> <- </span>copy <span class="Constant">1</span>:literal +] +<span class="traceContains">+run: instruction main/0</span> +<span class="traceContains">+run: ingredient 1 is 1</span> +<span class="traceContains">+run: jumping to instruction 2</span> +<span class="traceAbsent">-run: instruction main/1</span> +<span class="traceAbsent">-mem: storing 1 in location 1</span> + +<span class="Delimiter">:(scenario jump_unless_fallthrough)</span> +recipe main [ + jump-unless <span class="Constant">999</span>:literal <span class="Constant">1</span>:offset + <span class="Constant">123</span>:integer<span class="Special"> <- </span>copy <span class="Constant">1</span>:literal +] +<span class="traceContains">+run: instruction main/0</span> +<span class="traceContains">+run: ingredient 0 is 999</span> +<span class="traceContains">+run: jump-unless fell through</span> +<span class="traceContains">+run: instruction main/1</span> +<span class="traceContains">+mem: storing 1 in location 123</span> +</pre> +</body> +</html> +<!-- vim: set foldmethod=manual : --> |