diff options
Diffstat (limited to 'html/037call_reply.cc.html')
-rw-r--r-- | html/037call_reply.cc.html | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/html/037call_reply.cc.html b/html/037call_reply.cc.html index 711bc8c4..82517f08 100644 --- a/html/037call_reply.cc.html +++ b/html/037call_reply.cc.html @@ -12,14 +12,14 @@ <!-- pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } body { font-family: monospace; color: #eeeeee; background-color: #080808; } -* { font-size: 1em; } +* { font-size: 1.05em; } .traceContains { color: #008000; } .cSpecial { color: #008000; } -.Constant { color: #008080; } -.Comment { color: #8080ff; } -.Delimiter { color: #c000c0; } +.Constant { color: #00a0a0; } +.Comment { color: #9090ff; } +.Delimiter { color: #a04060; } .Special { color: #ff6060; } -.CommentedCode { color: #6c6c6c; } +.Comment { color: #9090ff; } .Identifier { color: #804000; } --> </style> @@ -53,6 +53,7 @@ Recipe_number[<span class="Constant">"reply"</span>] = REPLY<span clas <span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> case REPLY: <span class="Delimiter">{</span> const instruction& reply_inst = current_instruction<span class="Delimiter">();</span> <span class="Comment">// save pointer into recipe before pop</span> + const string& callee = current_recipe_name<span class="Delimiter">();</span> --Callstack_depth<span class="Delimiter">;</span> <span class="CommentedCode">//? if (tb_is_active()) { //? 1</span> <span class="CommentedCode">//? tb_clear(); //? 1</span> @@ -74,7 +75,7 @@ case REPLY: <span class="Delimiter">{</span> assert<span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>tmp<span class="Delimiter">)</span> == <span class="Constant">1</span><span class="Delimiter">);</span> long long int ingredient_index = to_integer<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> if <span class="Delimiter">(</span>caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>value != caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">).</span>value<span class="Delimiter">)</span> - raise << <span class="Constant">"'same-as-ingredient' result "</span> << caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>value << <span class="Constant">" must be location "</span> << caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">).</span>value << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> + raise << current_recipe_name<span class="Delimiter">()</span> << <span class="Constant">": 'same-as-ingredient' result "</span> << caller_instruction<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>value << <span class="Constant">" from call to "</span> << callee << <span class="Constant">" must be location "</span> << caller_instruction<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>ingredient_index<span class="Delimiter">).</span>value << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> <span class="Delimiter">}</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// continue to process rest of *caller* instruction</span> @@ -109,7 +110,7 @@ recipe test1 [ <span class="Constant">10</span>:address:number<span class="Special"> <- </span>next-ingredient reply <span class="Constant">10</span>:address:number/same-as-ingredient:<span class="Constant">0</span> ] -<span class="traceContains">+warn: 'same-as-ingredient' result 2 must be location 1</span> +<span class="traceContains">+warn: main: 'same-as-ingredient' result 2 from call to test1 must be location 1</span> <span class="Delimiter">:(code)</span> string to_string<span class="Delimiter">(</span>const vector<double>& in<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -159,6 +160,7 @@ recipe test1 [ if <span class="Delimiter">(</span>curr<span class="Delimiter">.</span>name == <span class="Constant">"reply-if"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> assert<span class="Delimiter">(</span>curr<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> curr<span class="Delimiter">.</span>operation = Recipe_number[<span class="Constant">"jump-unless"</span>]<span class="Delimiter">;</span> + curr<span class="Delimiter">.</span>name = <span class="Constant">"jump-unless"</span><span class="Delimiter">;</span> vector<reagent> results<span class="Delimiter">;</span> copy<span class="Delimiter">(</span>++curr<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> curr<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>end<span class="Delimiter">(),</span> inserter<span class="Delimiter">(</span>results<span class="Delimiter">,</span> results<span class="Delimiter">.</span>end<span class="Delimiter">()));</span> curr<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> @@ -166,6 +168,26 @@ if <span class="Delimiter">(</span>curr<span class="Delimiter">.</span>name == < result<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>curr<span class="Delimiter">);</span> curr<span class="Delimiter">.</span>clear<span class="Delimiter">();</span> curr<span class="Delimiter">.</span>operation = Recipe_number[<span class="Constant">"reply"</span>]<span class="Delimiter">;</span> + curr<span class="Delimiter">.</span>name = <span class="Constant">"reply"</span><span class="Delimiter">;</span> + curr<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>swap<span class="Delimiter">(</span>results<span class="Delimiter">);</span> +<span class="Delimiter">}</span> +<span class="Comment">// rewrite `reply-unless a, b, c, ...` to</span> +<span class="Comment">// ```</span> +<span class="Comment">// jump-if a, 1:offset</span> +<span class="Comment">// reply b, c, ...</span> +<span class="Comment">// ```</span> +if <span class="Delimiter">(</span>curr<span class="Delimiter">.</span>name == <span class="Constant">"reply-unless"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> + assert<span class="Delimiter">(</span>curr<span class="Delimiter">.</span>products<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> + curr<span class="Delimiter">.</span>operation = Recipe_number[<span class="Constant">"jump-if"</span>]<span class="Delimiter">;</span> + curr<span class="Delimiter">.</span>name = <span class="Constant">"jump-if"</span><span class="Delimiter">;</span> + vector<reagent> results<span class="Delimiter">;</span> + copy<span class="Delimiter">(</span>++curr<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> curr<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>end<span class="Delimiter">(),</span> inserter<span class="Delimiter">(</span>results<span class="Delimiter">,</span> results<span class="Delimiter">.</span>end<span class="Delimiter">()));</span> + curr<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> + curr<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>reagent<span class="Delimiter">(</span><span class="Constant">"1:offset"</span><span class="Delimiter">));</span> + result<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>curr<span class="Delimiter">);</span> + curr<span class="Delimiter">.</span>clear<span class="Delimiter">();</span> + curr<span class="Delimiter">.</span>operation = Recipe_number[<span class="Constant">"reply"</span>]<span class="Delimiter">;</span> + curr<span class="Delimiter">.</span>name = <span class="Constant">"reply"</span><span class="Delimiter">;</span> curr<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>swap<span class="Delimiter">(</span>results<span class="Delimiter">);</span> <span class="Delimiter">}</span> </pre> |