diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-06-09 00:02:23 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-06-09 00:02:23 -0700 |
commit | e8b1d3ff06bdfcc0005c70ccd99cd26cba3e1eef (patch) | |
tree | efd145601d5249dfde18b5be7be3b95e229717d7 | |
parent | fd1e8afdc9f68612f207d75b31b2011e8e738a47 (diff) | |
download | mu-e8b1d3ff06bdfcc0005c70ccd99cd26cba3e1eef.tar.gz |
1549
67 files changed, 794 insertions, 191 deletions
diff --git a/html/000organization.cc.html b/html/000organization.cc.html index 6ec61434..fe24b8aa 100644 --- a/html/000organization.cc.html +++ b/html/000organization.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Identifier { color: #008080; } .Comment { color: #8080ff; } diff --git a/html/001help.cc.html b/html/001help.cc.html index d131b7a4..b3b91e07 100644 --- a/html/001help.cc.html +++ b/html/001help.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .cSpecial { color: #008000; } .Constant { color: #008080; } diff --git a/html/002test.cc.html b/html/002test.cc.html index a8285065..22e6cad1 100644 --- a/html/002test.cc.html +++ b/html/002test.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .cSpecial { color: #008000; } .Constant { color: #008080; } diff --git a/html/003trace.cc.html b/html/003trace.cc.html index 2c04a850..3aa9636d 100644 --- a/html/003trace.cc.html +++ b/html/003trace.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .cSpecial { color: #008000; } .Constant { color: #008080; } diff --git a/html/003trace.test.cc.html b/html/003trace.test.cc.html index 704fd64e..2bb648f5 100644 --- a/html/003trace.test.cc.html +++ b/html/003trace.test.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .cSpecial { color: #008000; } .Delimiter { color: #c000c0; } diff --git a/html/010vm.cc.html b/html/010vm.cc.html index 5a971a6d..c61f82a8 100644 --- a/html/010vm.cc.html +++ b/html/010vm.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .cSpecial { color: #008000; } .Constant { color: #008080; } diff --git a/html/011load.cc.html b/html/011load.cc.html index 7b1807c5..0da90c1b 100644 --- a/html/011load.cc.html +++ b/html/011load.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } @@ -70,6 +70,7 @@ vector<recipe_number> load<span class="Delimiter">(</span>istream& in< <span class="Delimiter">}</span> <span class="Comment">// todo: save user-defined recipes to mu's memory</span> Recipe[Recipe_number[recipe_name]] = slurp_recipe<span class="Delimiter">(</span>in<span class="Delimiter">);</span> +<span class="CommentedCode">//? cerr << Recipe_number[recipe_name] << ": " << recipe_name << '\n'; //? 1</span> Recipe[Recipe_number[recipe_name]]<span class="Delimiter">.</span>name = recipe_name<span class="Delimiter">;</span> <span class="Comment">// track added recipes because we may need to undo them in tests; see below</span> recently_added_recipes<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>Recipe_number[recipe_name]<span class="Delimiter">);</span> diff --git a/html/012transform.cc.html b/html/012transform.cc.html index aca6b62b..4d1e9358 100644 --- a/html/012transform.cc.html +++ b/html/012transform.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Constant { color: #008080; } .Comment { color: #8080ff; } diff --git a/html/013literal_string.cc.html b/html/013literal_string.cc.html index 19683498..7ff3b23e 100644 --- a/html/013literal_string.cc.html +++ b/html/013literal_string.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } diff --git a/html/014literal_noninteger.cc.html b/html/014literal_noninteger.cc.html index 9c9b9286..8e73bb5f 100644 --- a/html/014literal_noninteger.cc.html +++ b/html/014literal_noninteger.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } diff --git a/html/020run.cc.html b/html/020run.cc.html index 2c39d12c..8881ac37 100644 --- a/html/020run.cc.html +++ b/html/020run.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } @@ -21,8 +21,8 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } .Comment { color: #8080ff; } .Delimiter { color: #c000c0; } .Special { color: #ff6060; } -.Identifier { color: #008080; } .CommentedCode { color: #6c6c6c; } +.Identifier { color: #008080; } --> </style> @@ -90,8 +90,10 @@ void run<span class="Delimiter">(</span>recipe_number r<span class="Delimiter">) void run_current_routine<span class="Delimiter">()</span> <span class="Delimiter">{</span> <span class="Comment">// curly on a separate line, because later layers will modify header</span> +<span class="CommentedCode">//? cerr << "AAA 6\n"; //? 2</span> while <span class="Delimiter">(</span>!Current_routine<span class="Delimiter">-></span>completed<span class="Delimiter">())</span> <span class="Comment">// later layers will modify condition</span> <span class="Delimiter">{</span> +<span class="CommentedCode">//? cerr << "AAA 7: " << current_step_index() << '\n'; //? 1</span> <span class="Comment">// Running One Instruction.</span> if <span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>is_label<span class="Delimiter">)</span> <span class="Delimiter">{</span> ++current_step_index<span class="Delimiter">();</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> trace<span class="Delimiter">(</span>Initial_callstack_depth+Callstack_depth<span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << current_instruction<span class="Delimiter">().</span>to_string<span class="Delimiter">();</span> @@ -103,9 +105,9 @@ void run_current_routine<span class="Delimiter">()</span> for <span class="Delimiter">(</span>long long int i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> ingredients<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>read_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)));</span> <span class="Delimiter">}</span> - <span class="Comment">// Instructions below will write to 'products' or to 'instruction_counter'.</span> + <span class="Comment">// Instructions below will write to 'products'.</span> vector<vector<double> > products<span class="Delimiter">;</span> - long long int instruction_counter = current_step_index<span class="Delimiter">();</span> +<span class="CommentedCode">//? cerr << "AAA 8: " << current_instruction().operation << " ^" << Recipe[current_instruction().operation].name << "$\n"; //? 1</span> switch <span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>operation<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Comment">// Primitive Recipe Implementations</span> case COPY: <span class="Delimiter">{</span> @@ -122,8 +124,9 @@ void run_current_routine<span class="Delimiter">()</span> for <span class="Delimiter">(</span>long long int i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>products<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> write_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">));</span> <span class="Delimiter">}</span> - current_step_index<span class="Delimiter">()</span> = instruction_counter+<span class="Constant">1</span><span class="Delimiter">;</span> + ++current_step_index<span class="Delimiter">();</span> <span class="Delimiter">}</span> +<span class="CommentedCode">//? cerr << "AAA 9\n"; //? 1</span> stop_running_current_routine:<span class="Delimiter">;</span> <span class="Delimiter">}</span> @@ -195,10 +198,13 @@ load_permanently<span class="Delimiter">(</span><span class="Constant">"cor <span class="Delimiter">:(code)</span> <span class="Comment">// helper for tests</span> void run<span class="Delimiter">(</span>string form<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="CommentedCode">//? cerr << "AAA 2\n"; //? 1</span> vector<recipe_number> tmp = load<span class="Delimiter">(</span>form<span class="Delimiter">);</span> if <span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span><span class="Delimiter">;</span> transform_all<span class="Delimiter">();</span> +<span class="CommentedCode">//? cerr << "AAA 3\n"; //? 1</span> run<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>front<span class="Delimiter">());</span> +<span class="CommentedCode">//? cerr << "YYY\n"; //? 1</span> <span class="Delimiter">}</span> <span class="SalientComment">//:: Reading from memory, writing to memory.</span> diff --git a/html/021arithmetic.cc.html b/html/021arithmetic.cc.html index 321d66f0..da4f4d2e 100644 --- a/html/021arithmetic.cc.html +++ b/html/021arithmetic.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .Constant { color: #008080; } diff --git a/html/022boolean.cc.html b/html/022boolean.cc.html index 72539bf2..6b10aaec 100644 --- a/html/022boolean.cc.html +++ b/html/022boolean.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .Constant { color: #008080; } diff --git a/html/023jump.cc.html b/html/023jump.cc.html index 842651db..824eca47 100644 --- a/html/023jump.cc.html +++ b/html/023jump.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .Constant { color: #008080; } @@ -19,6 +19,7 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } .Comment { color: #8080ff; } .Delimiter { color: #c000c0; } .Special { color: #ff6060; } +.CommentedCode { color: #6c6c6c; } .Identifier { color: #008080; } --> </style> @@ -34,6 +35,7 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } <span class="Comment">//: Jump primitives</span> <span class="Delimiter">:(scenario jump_can_skip_instructions)</span> +<span class="CommentedCode">#? % Trace_stream->dump_layer = "all"; #? 1</span> recipe main [ jump <span class="Constant">1</span>:offset <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">1</span>:literal @@ -51,9 +53,9 @@ case JUMP: <span class="Delimiter">{</span> assert<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>initialized<span class="Delimiter">);</span> assert<span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>ingredients<span class="Delimiter">)</span> == <span class="Constant">1</span><span class="Delimiter">);</span> assert<span class="Delimiter">(</span>scalar<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)));</span> - instruction_counter += ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> - trace<span class="Delimiter">(</span>Primitive_recipe_depth<span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"jumping to instruction "</span> << instruction_counter+<span class="Constant">1</span><span class="Delimiter">;</span> - <span class="Identifier">break</span><span class="Delimiter">;</span> + current_step_index<span class="Delimiter">()</span> += ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span>+<span class="Constant">1</span><span class="Delimiter">;</span> + trace<span class="Delimiter">(</span>Primitive_recipe_depth<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="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// skip rest of this instruction</span> <span class="Delimiter">}</span> <span class="Comment">//: special type to designate jump targets</span> @@ -85,9 +87,9 @@ case JUMP_IF: <span class="Delimiter">{</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> assert<span class="Delimiter">(</span>scalar<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">)));</span> - instruction_counter += ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> - trace<span class="Delimiter">(</span>Primitive_recipe_depth<span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"jumping to instruction "</span> << instruction_counter+<span class="Constant">1</span><span class="Delimiter">;</span> - <span class="Identifier">break</span><span class="Delimiter">;</span> + current_step_index<span class="Delimiter">()</span> += ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span>+<span class="Constant">1</span><span class="Delimiter">;</span> + trace<span class="Delimiter">(</span>Primitive_recipe_depth<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="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// skip rest of this instruction</span> <span class="Delimiter">}</span> <span class="Delimiter">:(scenario jump_if)</span> @@ -124,9 +126,9 @@ case JUMP_UNLESS: <span class="Delimiter">{</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> assert<span class="Delimiter">(</span>scalar<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">)));</span> - instruction_counter += ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> - trace<span class="Delimiter">(</span>Primitive_recipe_depth<span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"jumping to instruction "</span> << instruction_counter+<span class="Constant">1</span><span class="Delimiter">;</span> - <span class="Identifier">break</span><span class="Delimiter">;</span> + current_step_index<span class="Delimiter">()</span> += ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span>+<span class="Constant">1</span><span class="Delimiter">;</span> + trace<span class="Delimiter">(</span>Primitive_recipe_depth<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="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// skip rest of this instruction</span> <span class="Delimiter">}</span> <span class="Delimiter">:(scenario jump_unless)</span> diff --git a/html/024compare.cc.html b/html/024compare.cc.html index 1a145d00..996aabe5 100644 --- a/html/024compare.cc.html +++ b/html/024compare.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .Constant { color: #008080; } diff --git a/html/025trace.cc.html b/html/025trace.cc.html index 7951bfb5..2d28e978 100644 --- a/html/025trace.cc.html +++ b/html/025trace.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .Constant { color: #008080; } diff --git a/html/026assert.cc.html b/html/026assert.cc.html index 2cfeff0d..9a707b26 100644 --- a/html/026assert.cc.html +++ b/html/026assert.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } diff --git a/html/027debug.cc.html b/html/027debug.cc.html index 1cfa4300..52920149 100644 --- a/html/027debug.cc.html +++ b/html/027debug.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Constant { color: #008080; } .Comment { color: #8080ff; } diff --git a/html/030container.cc.html b/html/030container.cc.html index 5e7b1ff1..6c4a51c4 100644 --- a/html/030container.cc.html +++ b/html/030container.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } diff --git a/html/031address.cc.html b/html/031address.cc.html index de366c9a..5eb089a2 100644 --- a/html/031address.cc.html +++ b/html/031address.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .Constant { color: #008080; } diff --git a/html/032array.cc.html b/html/032array.cc.html index ac8d1636..f585d288 100644 --- a/html/032array.cc.html +++ b/html/032array.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } diff --git a/html/034exclusive_container.cc.html b/html/034exclusive_container.cc.html index 842c2789..f4bbc147 100644 --- a/html/034exclusive_container.cc.html +++ b/html/034exclusive_container.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .Constant { color: #008080; } diff --git a/html/035call.cc.html b/html/035call.cc.html index 73ba8d07..663aa29d 100644 --- a/html/035call.cc.html +++ b/html/035call.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } @@ -22,6 +22,7 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } .Special { color: #ff6060; } .Identifier { color: #008080; } .PreProc { color: #c000c0; } +.CommentedCode { color: #6c6c6c; } --> </style> @@ -143,6 +144,7 @@ inline const vector<instruction>& routine::steps<span class="Delimiter <span class="Comment">// it, and the one below that, and so on</span> while <span class="Delimiter">(</span>current_step_index<span class="Delimiter">()</span> >= SIZE<span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>steps<span class="Delimiter">()))</span> <span class="Delimiter">{</span> --Callstack_depth<span class="Delimiter">;</span> +<span class="CommentedCode">//? cerr << "reply " << Current_routine->calls.size() << '\n'; //? 1</span> Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>pop_front<span class="Delimiter">();</span> if <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">// todo: no results returned warning</span> diff --git a/html/036call_ingredient.cc.html b/html/036call_ingredient.cc.html index 45c81074..f791cfa3 100644 --- a/html/036call_ingredient.cc.html +++ b/html/036call_ingredient.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .Constant { color: #008080; } diff --git a/html/037call_reply.cc.html b/html/037call_reply.cc.html index 60363350..1bc51e77 100644 --- a/html/037call_reply.cc.html +++ b/html/037call_reply.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } @@ -77,9 +77,7 @@ case REPLY: <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> <span class="Delimiter">}</span> <span class="Delimiter">}</span> - <span class="Comment">// refresh instruction_counter to caller's step_index</span> - instruction_counter = current_step_index<span class="Delimiter">();</span> - <span class="Identifier">break</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> <span class="Delimiter">}</span> <span class="Comment">//: Products can include containers and exclusive containers, addresses and arrays.</span> diff --git a/html/038scheduler.cc.html b/html/038scheduler.cc.html index abf7f469..518440ce 100644 --- a/html/038scheduler.cc.html +++ b/html/038scheduler.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } @@ -82,7 +82,9 @@ long long int Scheduling_interval = <span class="Constant">500</span><span class Scheduling_interval = <span class="Constant">500</span><span class="Delimiter">;</span> <span class="Delimiter">:(replace{} "void run(recipe_number r)")</span> void run<span class="Delimiter">(</span>recipe_number r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="CommentedCode">//? cerr << "AAA 4\n"; //? 1</span> Routines<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>new routine<span class="Delimiter">(</span>r<span class="Delimiter">));</span> +<span class="CommentedCode">//? cerr << "AAA " << Routines.size() << " routines\n"; //? 1</span> Current_routine_index = <span class="Constant">0</span><span class="Delimiter">,</span> Current_routine = Routines<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> while <span class="Delimiter">(</span>!all_routines_done<span class="Delimiter">())</span> <span class="Delimiter">{</span> skip_to_next_routine<span class="Delimiter">();</span> @@ -94,6 +96,7 @@ void run<span class="Delimiter">(</span>recipe_number r<span class="Delimiter">) <span class="CommentedCode">//? trace("schedule") << Current_routine->id << " " << current_recipe_name(); //? 1</span> run_current_routine<span class="Delimiter">(</span>Scheduling_interval<span class="Delimiter">);</span> <span class="Comment">// Scheduler State Transitions</span> +<span class="CommentedCode">//? cerr << "AAA completed? " << Current_routine->completed() << '\n'; //? 1</span> if <span class="Delimiter">(</span>Current_routine<span class="Delimiter">-></span>completed<span class="Delimiter">())</span> Current_routine<span class="Delimiter">-></span>state = COMPLETED<span class="Delimiter">;</span> <span class="Comment">// End Scheduler State Transitions</span> diff --git a/html/039wait.cc.html b/html/039wait.cc.html index fb60ffc8..fdeafc37 100644 --- a/html/039wait.cc.html +++ b/html/039wait.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } diff --git a/html/040brace.cc.html b/html/040brace.cc.html index c6c12f8c..7e7a4b5f 100644 --- a/html/040brace.cc.html +++ b/html/040brace.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .Constant { color: #008080; } diff --git a/html/041name.cc.html b/html/041name.cc.html index ee937835..0e862bbc 100644 --- a/html/041name.cc.html +++ b/html/041name.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } @@ -98,7 +98,7 @@ void transform_names<span class="Delimiter">(</span>const recipe_number r<span c inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>out<span class="Delimiter">).</span>set_value<span class="Delimiter">(</span>lookup_name<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>out<span class="Delimiter">),</span> r<span class="Delimiter">));</span> <span class="Delimiter">}</span> <span class="Delimiter">}</span> - if <span class="Delimiter">(</span>names_used && numeric_locations_used<span class="Delimiter">)</span> + if <span class="Delimiter">(</span>names_used && numeric_locations_used && r != Recipe_number[<span class="Constant">"interactive"</span>]<span class="Delimiter">)</span> raise << <span class="Constant">"mixing variable names and numeric addresses in "</span> << Recipe[r]<span class="Delimiter">.</span>name << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> diff --git a/html/042new.cc.html b/html/042new.cc.html index b19775ab..06cd95a4 100644 --- a/html/042new.cc.html +++ b/html/042new.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } diff --git a/html/043space.cc.html b/html/043space.cc.html index 05e1c8d3..89d68498 100644 --- a/html/043space.cc.html +++ b/html/043space.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } diff --git a/html/044space_surround.cc.html b/html/044space_surround.cc.html index 74620675..4c01e4fc 100644 --- a/html/044space_surround.cc.html +++ b/html/044space_surround.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .Constant { color: #008080; } diff --git a/html/045closure_name.cc.html b/html/045closure_name.cc.html index 1520e46b..09f2abde 100644 --- a/html/045closure_name.cc.html +++ b/html/045closure_name.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } diff --git a/html/046tangle.cc.html b/html/046tangle.cc.html index 9604310f..faf34c4f 100644 --- a/html/046tangle.cc.html +++ b/html/046tangle.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .Constant { color: #008080; } diff --git a/html/047jump_label.cc.html b/html/047jump_label.cc.html index 4547dcb2..8e2670f4 100644 --- a/html/047jump_label.cc.html +++ b/html/047jump_label.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceAbsent { color: #c00000; } .cSpecial { color: #008000; } diff --git a/html/048call_variable.cc.html b/html/048call_variable.cc.html index 6d7bf3b4..eb9eb331 100644 --- a/html/048call_variable.cc.html +++ b/html/048call_variable.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .Constant { color: #008080; } diff --git a/html/049continuation.cc.html b/html/049continuation.cc.html index 341d6fa9..8455e720 100644 --- a/html/049continuation.cc.html +++ b/html/049continuation.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .Constant { color: #008080; } @@ -77,10 +77,8 @@ Recipe_number[<span class="Constant">"continue-from"</span>] = CONTINU case CONTINUE_FROM: <span class="Delimiter">{</span> assert<span class="Delimiter">(</span>scalar<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)));</span> long long int c = ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> - Current_routine<span class="Delimiter">-></span>calls = Continuation[c]<span class="Delimiter">;</span> <span class="Comment">// deep copy because calls have no pointers</span> - <span class="Comment">// refresh instruction_counter to next instruction after current-continuation</span> - instruction_counter = current_step_index<span class="Delimiter">()</span>+<span class="Constant">1</span><span class="Delimiter">;</span> - <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// not done with caller; don't increment current_step_index() further</span> + Current_routine<span class="Delimiter">-></span>calls = Continuation[c]<span class="Delimiter">;</span> <span class="Comment">// deep copy; calls have no pointers</span> + <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// skip rest of this instruction</span> <span class="Delimiter">}</span> <span class="Delimiter">:(scenario continuation)</span> @@ -104,6 +102,7 @@ recipe main [ $current-continuation: <span class="Constant">1</span> <span class="Delimiter">:(scenario continuation_inside_caller)</span> +<span class="CommentedCode">#? % Trace_stream->dump_layer = "all"; #? 1</span> recipe main [ <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">0</span>:literal <span class="Constant">2</span>:continuation<span class="Special"> <- </span>loop-body @@ -243,9 +242,7 @@ case REPLY_DELIMITED_CONTINUATION: <span class="Delimiter">{</span> products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>Next_delimited_continuation_id<span class="Delimiter">);</span> ++Next_delimited_continuation_id<span class="Delimiter">;</span> - <span class="Comment">// refresh instruction_counter to caller's step_index</span> - instruction_counter = current_step_index<span class="Delimiter">();</span> - <span class="Identifier">break</span><span class="Delimiter">;</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Comment">// continue to process rest of 'reset' call</span> <span class="Delimiter">}</span> <span class="Delimiter">:(code)</span> diff --git a/html/050scenario.cc.html b/html/050scenario.cc.html index 92d38825..a7b09c28 100644 --- a/html/050scenario.cc.html +++ b/html/050scenario.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } diff --git a/html/051scenario_test.mu.html b/html/051scenario_test.mu.html index 4097cb74..028b89ca 100644 --- a/html/051scenario_test.mu.html +++ b/html/051scenario_test.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Comment { color: #8080ff; } .Constant { color: #008080; } diff --git a/html/060string.mu.html b/html/060string.mu.html index ee17699c..18869d3c 100644 --- a/html/060string.mu.html +++ b/html/060string.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .CommentedCode { color: #6c6c6c; } .Delimiter { color: #c000c0; } @@ -190,13 +190,22 @@ container buffer [ <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> in:address:buffer<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> c:character<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + len:address:number<span class="Special"> <- </span>get-address in:address:buffer/deref, length:offset + <span class="Delimiter">{</span> + <span class="Comment"># backspace? just drop last character if it exists and return</span> + backspace?:boolean<span class="Special"> <- </span>equal c:character, <span class="Constant">8:literal/backspace</span> + <span class="Identifier">break-unless</span> backspace?:boolean + empty?:boolean<span class="Special"> <- </span>lesser-or-equal len:address:number/deref, <span class="Constant">0:literal</span> + <span class="Identifier">reply-if</span> empty?:boolean, in:address:buffer/same-as-ingredient:0 + len:address:number/deref<span class="Special"> <- </span>subtract len:address:number/deref, <span class="Constant">1:literal</span> + <span class="Identifier">reply</span> in:address:buffer/same-as-ingredient:0 + <span class="Delimiter">}</span> <span class="Delimiter">{</span> <span class="Comment"># grow buffer if necessary</span> full?:boolean<span class="Special"> <- </span>buffer-full? in:address:buffer <span class="Identifier">break-unless</span> full?:boolean in:address:buffer<span class="Special"> <- </span>grow-buffer in:address:buffer <span class="Delimiter">}</span> - len:address:number<span class="Special"> <- </span>get-address in:address:buffer/deref, length:offset s:address:array:character<span class="Special"> <- </span>get in:address:buffer/deref, data:offset dest:address:character<span class="Special"> <- </span>index-address s:address:array:character/deref, len:address:number/deref dest:address:character/deref<span class="Special"> <- </span>copy c:character @@ -256,6 +265,23 @@ container buffer [ ] ] +<span class="muScenario">scenario</span> buffer-append-handles-backspace [ + run [ + <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + x:address:buffer<span class="Special"> <- </span>init-buffer <span class="Constant">3:literal</span> + x:address:buffer<span class="Special"> <- </span>buffer-append x:address:buffer, <span class="Constant">97:literal</span> <span class="Comment"># 'a'</span> + x:address:buffer<span class="Special"> <- </span>buffer-append x:address:buffer, <span class="Constant">98:literal</span> <span class="Comment"># 'b'</span> + x:address:buffer<span class="Special"> <- </span>buffer-append x:address:buffer, <span class="Constant">8:literal/backspace</span> + s:address:array:character<span class="Special"> <- </span>buffer-to-array x:address:buffer + 1:array:character/<span class="Special">raw <- </span>copy s:address:array:character/deref + ] + memory-should-contain [ + 1<span class="Special"> <- </span>1 <span class="Comment"># length</span> + 2<span class="Special"> <- </span>97 <span class="Comment"># contents</span> + 3<span class="Special"> <- </span>0 + ] +] + <span class="Comment"># result:address:array:character <- integer-to-decimal-string n:number</span> <span class="muRecipe">recipe</span> integer-to-decimal-string [ <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> @@ -316,15 +342,15 @@ container buffer [ <span class="muRecipe">recipe</span> buffer-to-array [ <span class="Identifier">default-space</span>:address:array:character<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> in:address:buffer<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> - len:number<span class="Special"> <- </span>get in:address:buffer/deref, length:offset -<span class="CommentedCode">#? $print [size ], len:number, [ </span> -<span class="CommentedCode">#? ] #? 1</span> - s:address:array:character<span class="Special"> <- </span>get in:address:buffer/deref, data:offset <span class="Delimiter">{</span> <span class="Comment"># propagate null buffer</span> - <span class="Identifier">break-if</span> s:address:array:character + <span class="Identifier">break-if</span> in:address:buffer <span class="Identifier">reply</span> <span class="Constant">0:literal</span> <span class="Delimiter">}</span> + len:number<span class="Special"> <- </span>get in:address:buffer/deref, length:offset +<span class="CommentedCode">#? $print [size ], len:number, [ </span> +<span class="CommentedCode">#? ] #? 1</span> + s:address:array:character<span class="Special"> <- </span>get in:address:buffer/deref, data:offset <span class="Comment"># we can't just return s because it is usually the wrong length</span> result:address:array:character<span class="Special"> <- </span>new character:type, len:number i:number<span class="Special"> <- </span>copy <span class="Constant">0:literal</span> diff --git a/html/061channel.mu.html b/html/061channel.mu.html index 8860c45b..e9d5a8f9 100644 --- a/html/061channel.mu.html +++ b/html/061channel.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .CommentedCode { color: #6c6c6c; } .Delimiter { color: #c000c0; } diff --git a/html/062array.mu.html b/html/062array.mu.html index b1909132..435d8fbd 100644 --- a/html/062array.mu.html +++ b/html/062array.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Delimiter { color: #c000c0; } .Comment { color: #8080ff; } diff --git a/html/063list.mu.html b/html/063list.mu.html index 87b1b52b..62b4dfcb 100644 --- a/html/063list.mu.html +++ b/html/063list.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .CommentedCode { color: #6c6c6c; } .Comment { color: #8080ff; } diff --git a/html/064random.cc.html b/html/064random.cc.html index d2157fda..8ef6c773 100644 --- a/html/064random.cc.html +++ b/html/064random.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .Constant { color: #008080; } diff --git a/html/070display.cc.html b/html/070display.cc.html index f18bcf20..6ab69439 100644 --- a/html/070display.cc.html +++ b/html/070display.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .cSpecial { color: #008000; } .Constant { color: #008080; } @@ -47,6 +47,7 @@ long long int Display_row = <span class="Constant">0</span><span class="Delimite SWITCH_TO_DISPLAY<span class="Delimiter">,</span> <span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> Recipe_number[<span class="Constant">"switch-to-display"</span>] = SWITCH_TO_DISPLAY<span class="Delimiter">;</span> +<span class="CommentedCode">//? cerr << "switch-to-display: " << SWITCH_TO_DISPLAY << '\n'; //? 1</span> <span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> case SWITCH_TO_DISPLAY: <span class="Delimiter">{</span> tb_init<span class="Delimiter">();</span> @@ -87,7 +88,7 @@ Recipe_number[<span class="Constant">"clear-line-on-display"</span>] = case CLEAR_LINE_ON_DISPLAY: <span class="Delimiter">{</span> long long int width = tb_width<span class="Delimiter">();</span> for <span class="Delimiter">(</span>long long int x = Display_column<span class="Delimiter">;</span> x < width<span class="Delimiter">;</span> ++x<span class="Delimiter">)</span> <span class="Delimiter">{</span> - tb_change_cell<span class="Delimiter">(</span>x<span class="Delimiter">,</span> Display_row<span class="Delimiter">,</span> <span class="Constant">' '</span><span class="Delimiter">,</span> TB_WHITE<span class="Delimiter">,</span> TB_DEFAULT<span class="Delimiter">);</span> + tb_change_cell<span class="Delimiter">(</span>x<span class="Delimiter">,</span> Display_row<span class="Delimiter">,</span> <span class="Constant">' '</span><span class="Delimiter">,</span> TB_WHITE<span class="Delimiter">,</span> TB_BLACK<span class="Delimiter">);</span> <span class="Delimiter">}</span> tb_set_cursor<span class="Delimiter">(</span>Display_column<span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> tb_present<span class="Delimiter">();</span> @@ -119,22 +120,22 @@ case PRINT_CHARACTER_TO_DISPLAY: <span class="Delimiter">{</span> <span class="Delimiter">}</span> if <span class="Delimiter">(</span>c == <span class="cSpecial">'\b'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> if <span class="Delimiter">(</span>Display_column > <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> - tb_change_cell<span class="Delimiter">(</span>Display_column-<span class="Constant">1</span><span class="Delimiter">,</span> Display_row<span class="Delimiter">,</span> <span class="Constant">' '</span><span class="Delimiter">,</span> TB_WHITE<span class="Delimiter">,</span> TB_DEFAULT<span class="Delimiter">);</span> + tb_change_cell<span class="Delimiter">(</span>Display_column-<span class="Constant">1</span><span class="Delimiter">,</span> Display_row<span class="Delimiter">,</span> <span class="Constant">' '</span><span class="Delimiter">,</span> TB_WHITE<span class="Delimiter">,</span> TB_BLACK<span class="Delimiter">);</span> --Display_column<span class="Delimiter">;</span> tb_set_cursor<span class="Delimiter">(</span>Display_column<span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> tb_present<span class="Delimiter">();</span> <span class="Delimiter">}</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> - int color = TB_DEFAULT<span class="Delimiter">;</span> + int color = TB_BLACK<span class="Delimiter">;</span> if <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>ingredients<span class="Delimiter">)</span> > <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> assert<span class="Delimiter">(</span>scalar<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">)));</span> - color = ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span>+<span class="Constant">1</span><span class="Comment">/*</span><span class="Comment">skip default</span><span class="Comment">*/</span><span class="Delimiter">;</span> + color = ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> <span class="CommentedCode">//? tb_shutdown(); //? 1</span> <span class="CommentedCode">//? cerr << "AAA " << color << '\n'; //? 1</span> <span class="CommentedCode">//? exit(1); //? 1</span> <span class="Delimiter">}</span> - tb_change_cell<span class="Delimiter">(</span>Display_column<span class="Delimiter">,</span> Display_row<span class="Delimiter">,</span> c<span class="Delimiter">,</span> color<span class="Delimiter">,</span> TB_DEFAULT<span class="Delimiter">);</span> + tb_change_cell<span class="Delimiter">(</span>Display_column<span class="Delimiter">,</span> Display_row<span class="Delimiter">,</span> c<span class="Delimiter">,</span> color<span class="Delimiter">,</span> TB_BLACK<span class="Delimiter">);</span> if <span class="Delimiter">(</span>Display_column < width-<span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> ++Display_column<span class="Delimiter">;</span> tb_set_cursor<span class="Delimiter">(</span>Display_column<span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> @@ -230,6 +231,28 @@ case MOVE_CURSOR_LEFT_ON_DISPLAY: <span class="Delimiter">{</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> +<span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> +DISPLAY_WIDTH<span class="Delimiter">,</span> +<span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> +Recipe_number[<span class="Constant">"display-width"</span>] = DISPLAY_WIDTH<span class="Delimiter">;</span> +<span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> +case DISPLAY_WIDTH: <span class="Delimiter">{</span> + products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> + products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>tb_width<span class="Delimiter">());</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> +<span class="Delimiter">}</span> + +<span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> +DISPLAY_HEIGHT<span class="Delimiter">,</span> +<span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> +Recipe_number[<span class="Constant">"display-height"</span>] = DISPLAY_HEIGHT<span class="Delimiter">;</span> +<span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> +case DISPLAY_HEIGHT: <span class="Delimiter">{</span> + products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> + products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>tb_height<span class="Delimiter">());</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> +<span class="Delimiter">}</span> + <span class="SalientComment">//:: Keyboard management</span> <span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> @@ -238,7 +261,7 @@ WAIT_FOR_KEY_FROM_KEYBOARD<span class="Delimiter">,</span> Recipe_number[<span class="Constant">"wait-for-key-from-keyboard"</span>] = WAIT_FOR_KEY_FROM_KEYBOARD<span class="Delimiter">;</span> <span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> case WAIT_FOR_KEY_FROM_KEYBOARD: <span class="Delimiter">{</span> - struct tb_event event<span class="Delimiter">;</span> + tb_event event<span class="Delimiter">;</span> do <span class="Delimiter">{</span> tb_poll_event<span class="Delimiter">(</span>&event<span class="Delimiter">);</span> <span class="Delimiter">}</span> while <span class="Delimiter">(</span>event<span class="Delimiter">.</span>type != TB_EVENT_KEY<span class="Delimiter">);</span> @@ -257,7 +280,7 @@ READ_KEY_FROM_KEYBOARD<span class="Delimiter">,</span> Recipe_number[<span class="Constant">"read-key-from-keyboard"</span>] = READ_KEY_FROM_KEYBOARD<span class="Delimiter">;</span> <span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> case READ_KEY_FROM_KEYBOARD: <span class="Delimiter">{</span> - struct tb_event event<span class="Delimiter">;</span> + tb_event event<span class="Delimiter">;</span> int event_type = tb_peek_event<span class="Delimiter">(</span>&event<span class="Delimiter">,</span> <span class="Constant">5</span><span class="Comment">/*</span><span class="Comment">ms</span><span class="Comment">*/</span><span class="Delimiter">);</span> long long int result = <span class="Constant">0</span><span class="Delimiter">;</span> long long int found = <span class="Constant">false</span><span class="Delimiter">;</span> diff --git a/html/071print.mu.html b/html/071print.mu.html index 736cda4e..d4af4de3 100644 --- a/html/071print.mu.html +++ b/html/071print.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Delimiter { color: #c000c0; } .muScenario { color: #00af00; } @@ -450,17 +450,51 @@ container screen-cell [ <span class="Identifier">reply</span> x:address:screen/same-as-ingredient:0 ] +<span class="muRecipe">recipe</span> screen-width [ + <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + x:address:screen<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + <span class="Comment"># if x exists, move cursor in fake screen</span> + <span class="Delimiter">{</span> + <span class="Identifier">break-unless</span> x:address:screen + width:number<span class="Special"> <- </span>get x:address:screen/deref, num-columns:offset + <span class="Identifier">reply</span> width:number + <span class="Delimiter">}</span> + <span class="Comment"># otherwise, real screen</span> + width:number<span class="Special"> <- </span>display-width + <span class="Identifier">reply</span> width:number +] + +<span class="muRecipe">recipe</span> screen-height [ + <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + x:address:screen<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + <span class="Comment"># if x exists, move cursor in fake screen</span> + <span class="Delimiter">{</span> + <span class="Identifier">break-unless</span> x:address:screen + height:number<span class="Special"> <- </span>get x:address:screen/deref, num-rows:offset + <span class="Identifier">reply</span> height:number + <span class="Delimiter">}</span> + <span class="Comment"># otherwise, real screen</span> + height:number<span class="Special"> <- </span>display-height + <span class="Identifier">reply</span> height:number +] + <span class="muRecipe">recipe</span> print-string [ <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> x:address:screen<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> s:address:array:character<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + color:number, color-found?:boolean<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + <span class="Delimiter">{</span> + <span class="Comment"># default color to white</span> + <span class="Identifier">break-if</span> color-found?:boolean + color:number<span class="Special"> <- </span>copy <span class="Constant">7:literal/white</span> + <span class="Delimiter">}</span> len:number<span class="Special"> <- </span>length s:address:array:character/deref i:number<span class="Special"> <- </span>copy <span class="Constant">0:literal</span> <span class="Delimiter">{</span> done?:boolean<span class="Special"> <- </span>greater-or-equal i:number, len:number <span class="Identifier">break-if</span> done?:boolean c:character<span class="Special"> <- </span>index s:address:array:character/deref, i:number - print-character x:address:screen c:character + print-character x:address:screen, c:character, color:number i:number<span class="Special"> <- </span>add i:number, <span class="Constant">1:literal</span> <span class="Identifier">loop</span> <span class="Delimiter">}</span> @@ -471,9 +505,15 @@ container screen-cell [ <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> x:address:screen<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> n:number<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + color:number, color-found?:boolean<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + <span class="Delimiter">{</span> + <span class="Comment"># default color to white</span> + <span class="Identifier">break-if</span> color-found?:boolean + color:number<span class="Special"> <- </span>copy <span class="Constant">7:literal/white</span> + <span class="Delimiter">}</span> <span class="Comment"># todo: other bases besides decimal</span> s:address:array:character<span class="Special"> <- </span>integer-to-decimal-string n:number - print-string x:address:screen, s:address:array:character + print-string x:address:screen, s:address:array:character, color:number <span class="Identifier">reply</span> x:address:screen/same-as-ingredient:0 ] </pre> diff --git a/html/072scenario_screen.cc.html b/html/072scenario_screen.cc.html index 093a0173..c6de8564 100644 --- a/html/072scenario_screen.cc.html +++ b/html/072scenario_screen.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .traceContains { color: #008000; } .cSpecial { color: #008000; } @@ -247,7 +247,7 @@ void check_screen<span class="Delimiter">(</span>const string& expected_cont <span class="Comment">// contents match but color is off</span> if <span class="Delimiter">(</span>Current_scenario && !Hide_warnings<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Comment">// genuine test in a mu file</span> - raise << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">F - "</span> << Current_scenario<span class="Delimiter">-></span>name << <span class="Constant">": expected screen location ("</span> << row << <span class="Constant">", "</span> << column << <span class="Constant">", address "</span> << addr << <span class="Constant">", value "</span> << Memory[addr] << <span class="Constant">") to be in color "</span> << color << <span class="Constant">" instead of "</span> << Memory[addr+cell_color_offset] << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> + raise << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">F - "</span> << Current_scenario<span class="Delimiter">-></span>name << <span class="Constant">": expected screen location ("</span> << row << <span class="Constant">", "</span> << column << <span class="Constant">", address "</span> << addr << <span class="Constant">", value "</span> << Memory[addr] << <span class="Constant">") to be in color "</span> << color << <span class="Constant">" instead of "</span> << Memory[addr+cell_color_offset] << <span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> else <span class="Delimiter">{</span> <span class="Comment">// just testing check_screen</span> diff --git a/html/073scenario_screen_test.mu.html b/html/073scenario_screen_test.mu.html index 8df66f7b..3b15278e 100644 --- a/html/073scenario_screen_test.mu.html +++ b/html/073scenario_screen_test.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Comment { color: #8080ff; } .Constant { color: #008080; } diff --git a/html/074keyboard.mu.html b/html/074keyboard.mu.html index dc0ab783..e29f2485 100644 --- a/html/074keyboard.mu.html +++ b/html/074keyboard.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Delimiter { color: #c000c0; } .Comment { color: #8080ff; } diff --git a/html/075scenario_keyboard.cc.html b/html/075scenario_keyboard.cc.html index 9ebee7a4..25c378b4 100644 --- a/html/075scenario_keyboard.cc.html +++ b/html/075scenario_keyboard.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Constant { color: #008080; } .Comment { color: #8080ff; } diff --git a/html/076scenario_keyboard_test.mu.html b/html/076scenario_keyboard_test.mu.html index cb73c7ac..804eecaf 100644 --- a/html/076scenario_keyboard_test.mu.html +++ b/html/076scenario_keyboard_test.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Comment { color: #8080ff; } .Constant { color: #008080; } diff --git a/html/077trace_browser.cc.html b/html/077trace_browser.cc.html index d600ef8b..87447353 100644 --- a/html/077trace_browser.cc.html +++ b/html/077trace_browser.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .cSpecial { color: #008000; } .Constant { color: #008080; } @@ -64,7 +64,7 @@ void start_trace_browser<span class="Delimiter">()</span> <span class="Delimiter <span class="Delimiter">}</span> tb_init<span class="Delimiter">();</span> Display_row = Display_column = <span class="Constant">0</span><span class="Delimiter">;</span> - struct tb_event event<span class="Delimiter">;</span> + tb_event event<span class="Delimiter">;</span> Top_of_screen = <span class="Constant">0</span><span class="Delimiter">;</span> refresh_screen_rows<span class="Delimiter">();</span> while <span class="Delimiter">(</span><span class="Constant">true</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -74,11 +74,11 @@ void start_trace_browser<span class="Delimiter">()</span> <span class="Delimiter <span class="Delimiter">}</span> while <span class="Delimiter">(</span>event<span class="Delimiter">.</span>type != TB_EVENT_KEY<span class="Delimiter">);</span> long long int key = event<span class="Delimiter">.</span>key ? event<span class="Delimiter">.</span>key : event<span class="Delimiter">.</span>ch<span class="Delimiter">;</span> if <span class="Delimiter">(</span>key == <span class="Constant">'q'</span> || key == <span class="Constant">'Q'</span><span class="Delimiter">)</span> <span class="Identifier">break</span><span class="Delimiter">;</span> - if <span class="Delimiter">(</span>key == <span class="Constant">'j'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>key == <span class="Constant">'j'</span> || key == TB_KEY_ARROW_DOWN<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Comment">// move cursor one line down</span> if <span class="Delimiter">(</span>Display_row < Last_printed_row<span class="Delimiter">)</span> ++Display_row<span class="Delimiter">;</span> <span class="Delimiter">}</span> - if <span class="Delimiter">(</span>key == <span class="Constant">'k'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>key == <span class="Constant">'k'</span> || key == TB_KEY_ARROW_UP<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Comment">// move cursor one line up</span> if <span class="Delimiter">(</span>Display_row > <span class="Constant">0</span><span class="Delimiter">)</span> --Display_row<span class="Delimiter">;</span> <span class="Delimiter">}</span> @@ -94,14 +94,14 @@ void start_trace_browser<span class="Delimiter">()</span> <span class="Delimiter <span class="Comment">// move cursor to bottom of screen</span> Display_row = tb_height<span class="Delimiter">()</span>-<span class="Constant">1</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> - if <span class="Delimiter">(</span>key == <span class="Constant">'J'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>key == <span class="Constant">'J'</span> || key == TB_KEY_PGDN<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Comment">// page-down</span> if <span class="Delimiter">(</span>Trace_index<span class="Delimiter">.</span>find<span class="Delimiter">(</span>tb_height<span class="Delimiter">()</span>-<span class="Constant">1</span><span class="Delimiter">)</span> != Trace_index<span class="Delimiter">.</span>end<span class="Delimiter">())</span> <span class="Delimiter">{</span> Top_of_screen = Trace_index[tb_height<span class="Delimiter">()</span>-<span class="Constant">1</span>]+<span class="Constant">1</span><span class="Delimiter">;</span> refresh_screen_rows<span class="Delimiter">();</span> <span class="Delimiter">}</span> <span class="Delimiter">}</span> - if <span class="Delimiter">(</span>key == <span class="Constant">'K'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>key == <span class="Constant">'K'</span> || key == TB_KEY_PGUP<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Comment">// page-up is more convoluted</span> <span class="CommentedCode">//? tb_shutdown(); //? 1</span> <span class="CommentedCode">//? cerr << "page-up: Top_of_screen is currently " << Top_of_screen << '\n'; //? 1</span> @@ -224,10 +224,10 @@ void render_line<span class="Delimiter">(</span>int screen_row<span class="Delim for <span class="Delimiter">(</span>col = <span class="Constant">0</span><span class="Delimiter">;</span> col < tb_width<span class="Delimiter">()</span> && col < SIZE<span class="Delimiter">(</span>s<span class="Delimiter">);</span> ++col<span class="Delimiter">)</span> <span class="Delimiter">{</span> char c = s<span class="Delimiter">.</span>at<span class="Delimiter">(</span>col<span class="Delimiter">);</span> if <span class="Delimiter">(</span>c == <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> c = <span class="Constant">';'</span><span class="Delimiter">;</span> <span class="Comment">// replace newlines with semi-colons</span> - tb_change_cell<span class="Delimiter">(</span>col<span class="Delimiter">,</span> screen_row<span class="Delimiter">,</span> c<span class="Delimiter">,</span> TB_WHITE<span class="Delimiter">,</span> TB_DEFAULT<span class="Delimiter">);</span> + tb_change_cell<span class="Delimiter">(</span>col<span class="Delimiter">,</span> screen_row<span class="Delimiter">,</span> c<span class="Delimiter">,</span> TB_WHITE<span class="Delimiter">,</span> TB_BLACK<span class="Delimiter">);</span> <span class="Delimiter">}</span> for <span class="Delimiter">(;</span> col < tb_width<span class="Delimiter">();</span> ++col<span class="Delimiter">)</span> <span class="Delimiter">{</span> - tb_change_cell<span class="Delimiter">(</span>col<span class="Delimiter">,</span> screen_row<span class="Delimiter">,</span> <span class="Constant">' '</span><span class="Delimiter">,</span> TB_WHITE<span class="Delimiter">,</span> TB_DEFAULT<span class="Delimiter">);</span> + tb_change_cell<span class="Delimiter">(</span>col<span class="Delimiter">,</span> screen_row<span class="Delimiter">,</span> <span class="Constant">' '</span><span class="Delimiter">,</span> TB_WHITE<span class="Delimiter">,</span> TB_BLACK<span class="Delimiter">);</span> <span class="Delimiter">}</span> <span class="Delimiter">}</span> </pre> diff --git a/html/078run_interactive.cc.html b/html/078run_interactive.cc.html new file mode 100644 index 00000000..b8166497 --- /dev/null +++ b/html/078run_interactive.cc.html @@ -0,0 +1,159 @@ +<!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 - 078run_interactive.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: 1em; } +.cSpecial { color: #008000; } +.Constant { color: #008080; } +.Comment { color: #8080ff; } +.Delimiter { color: #c000c0; } +.SalientComment { color: #00ffff; } +.CommentedCode { color: #6c6c6c; } +.Identifier { color: #008080; } +--> +</style> + +<script type='text/javascript'> +<!-- + +--> +</script> +</head> +<body> +<pre id='vimCodeElement'> +<span class="Comment">//: Helper for the repl.</span> + +<span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> +RUN_INTERACTIVE<span class="Delimiter">,</span> +<span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> +Recipe_number[<span class="Constant">"run-interactive"</span>] = RUN_INTERACTIVE<span class="Delimiter">;</span> +<span class="CommentedCode">//? cerr << "run-interactive: " << RUN_INTERACTIVE << '\n'; //? 1</span> +<span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> +case RUN_INTERACTIVE: <span class="Delimiter">{</span> + assert<span class="Delimiter">(</span>scalar<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)));</span> +<span class="CommentedCode">//? cerr << "AAA 0\n"; //? 1</span> + run_interactive<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">));</span> +<span class="CommentedCode">//? cerr << "ZZZ\n"; //? 1</span> + <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// not done with caller; don't increment current_step_index()</span> +<span class="Delimiter">}</span> + +<span class="Delimiter">:(code)</span> +<span class="Comment">// manual tests:</span> +<span class="Comment">// empty string (excluding whitespace and comments) does nothing</span> +<span class="Comment">// ctrl-d</span> +<span class="Comment">// just an integer (excluding whitespace and comments) prints value of that location in memory</span> +<span class="Comment">// instruction executes</span> +<span class="Comment">// backspace at start begins new attempt</span> +void run_interactive<span class="Delimiter">(</span>long long int address<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="CommentedCode">//? tb_shutdown(); //? 1</span> + long long int size = Memory[address]<span class="Delimiter">;</span> + if <span class="Delimiter">(</span>size == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> + ++current_step_index<span class="Delimiter">();</span> + <span class="Identifier">return</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> + ostringstream tmp<span class="Delimiter">;</span> + for <span class="Delimiter">(</span>long long int curr = address+<span class="Constant">1</span><span class="Delimiter">;</span> curr < address+size<span class="Delimiter">;</span> ++curr<span class="Delimiter">)</span> <span class="Delimiter">{</span> + <span class="Comment">// todo: unicode</span> + tmp << <span class="Delimiter">(</span>char<span class="Delimiter">)(</span>int<span class="Delimiter">)</span>Memory[curr]<span class="Delimiter">;</span> + <span class="Delimiter">}</span> +<span class="CommentedCode">//? cerr << size << ' ' << Memory[address+size] << '\n'; //? 1</span> + assert<span class="Delimiter">(</span>Memory[address+size] == <span class="Constant">10</span><span class="Delimiter">);</span> <span class="Comment">// skip the newline</span> + if <span class="Delimiter">(</span>Recipe_number<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">"interactive"</span><span class="Delimiter">)</span> == Recipe_number<span class="Delimiter">.</span>end<span class="Delimiter">())</span> + Recipe_number[<span class="Constant">"interactive"</span>] = Next_recipe_number++<span class="Delimiter">;</span> + string command = trim<span class="Delimiter">(</span>strip_comments<span class="Delimiter">(</span>tmp<span class="Delimiter">.</span>str<span class="Delimiter">()));</span> + if <span class="Delimiter">(</span>command<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span> + ++current_step_index<span class="Delimiter">();</span> + <span class="Identifier">return</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> + if <span class="Delimiter">(</span>is_integer<span class="Delimiter">(</span>command<span class="Delimiter">))</span> <span class="Delimiter">{</span> + print_value_of_location_as_response<span class="Delimiter">(</span>to_integer<span class="Delimiter">(</span>command<span class="Delimiter">));</span> + ++current_step_index<span class="Delimiter">();</span> + <span class="Identifier">return</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> +<span class="CommentedCode">//? exit(0); //? 1</span> + if <span class="Delimiter">(</span>Name[Recipe_number[<span class="Constant">"interactive"</span>]]<span class="Delimiter">.</span>find<span class="Delimiter">(</span>command<span class="Delimiter">)</span> != Name[Recipe_number[<span class="Constant">"interactive"</span>]]<span class="Delimiter">.</span>end<span class="Delimiter">())</span> <span class="Delimiter">{</span> + print_value_of_location_as_response<span class="Delimiter">(</span>Name[Recipe_number[<span class="Constant">"interactive"</span>]][command]<span class="Delimiter">);</span> + ++current_step_index<span class="Delimiter">();</span> + <span class="Identifier">return</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> +<span class="CommentedCode">//? tb_shutdown(); //? 1</span> +<span class="CommentedCode">//? cerr << command; //? 1</span> +<span class="CommentedCode">//? exit(0); //? 1</span> +<span class="CommentedCode">//? cerr << "AAA 1\n"; //? 1</span> + Recipe<span class="Delimiter">.</span>erase<span class="Delimiter">(</span>Recipe_number[<span class="Constant">"interactive"</span>]<span class="Delimiter">);</span> + <span class="Comment">// call run(string) but without the scheduling</span> +<span class="CommentedCode">//? cerr << ("recipe interactive [\n"+command+"\n]\n"); //? 1</span> + load<span class="Delimiter">(</span><span class="Constant">"recipe interactive [</span><span class="cSpecial">\n</span><span class="Constant">"</span>+command+<span class="Constant">"</span><span class="cSpecial">\n</span><span class="Constant">]</span><span class="cSpecial">\n</span><span class="Constant">"</span><span class="Delimiter">);</span> + transform_all<span class="Delimiter">();</span> +<span class="CommentedCode">//? cerr << "names: " << Name[Recipe_number["interactive"]].size() << "; "; //? 1</span> +<span class="CommentedCode">//? cerr << "steps: " << Recipe[Recipe_number["interactive"]].steps.size() << "; "; //? 1</span> +<span class="CommentedCode">//? cerr << "interactive transformed_until: " << Recipe[Recipe_number["interactive"]].transformed_until << '\n'; //? 1</span> + Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>push_front<span class="Delimiter">(</span>call<span class="Delimiter">(</span>Recipe_number[<span class="Constant">"interactive"</span>]<span class="Delimiter">));</span> +<span class="Delimiter">}</span> + +string strip_comments<span class="Delimiter">(</span>string in<span class="Delimiter">)</span> <span class="Delimiter">{</span> + ostringstream result<span class="Delimiter">;</span> +<span class="CommentedCode">//? cerr << in; //? 1</span> + for <span class="Delimiter">(</span>long long int i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>in<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>in<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)</span> != <span class="Constant">'#'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> + result << in<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> + <span class="Delimiter">}</span> + else <span class="Delimiter">{</span> + while <span class="Delimiter">(</span>i < SIZE<span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)</span> != <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> + ++i<span class="Delimiter">;</span> + if <span class="Delimiter">(</span>i < SIZE<span class="Delimiter">(</span>in<span class="Delimiter">)</span> && in<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)</span> == <span class="cSpecial">'\n'</span><span class="Delimiter">)</span> ++i<span class="Delimiter">;</span> + <span class="Delimiter">}</span> + <span class="Delimiter">}</span> +<span class="CommentedCode">//? cerr << "ZZZ"; //? 1</span> + <span class="Identifier">return</span> result<span class="Delimiter">.</span>str<span class="Delimiter">();</span> +<span class="Delimiter">}</span> + +void print_value_of_location_as_response<span class="Delimiter">(</span>long long int address<span class="Delimiter">)</span> <span class="Delimiter">{</span> + <span class="Comment">// convert to string</span> + ostringstream out<span class="Delimiter">;</span> + out << <span class="Constant">"=> "</span> << Memory[address]<span class="Delimiter">;</span> + string result = out<span class="Delimiter">.</span>str<span class="Delimiter">();</span> + <span class="Comment">// handle regular I/O</span> + if <span class="Delimiter">(</span>!tb_is_active<span class="Delimiter">())</span> <span class="Delimiter">{</span> + cerr << result << <span class="cSpecial">'\n'</span><span class="Delimiter">;</span> + <span class="Identifier">return</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> + <span class="Comment">// raw I/O; use termbox to print</span> + long long int bound = SIZE<span class="Delimiter">(</span>result<span class="Delimiter">);</span> + if <span class="Delimiter">(</span>bound > tb_width<span class="Delimiter">())</span> bound = tb_width<span class="Delimiter">();</span> + for <span class="Delimiter">(</span>long long int i = <span class="Constant">0</span><span class="Delimiter">;</span> i < bound<span class="Delimiter">;</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + tb_change_cell<span class="Delimiter">(</span>i<span class="Delimiter">,</span> Display_row<span class="Delimiter">,</span> result<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> <span class="Comment">/*</span><span class="Comment">computer's color</span><span class="Comment">*/</span><span class="Constant">245</span><span class="Delimiter">,</span> TB_BLACK<span class="Delimiter">);</span> + <span class="Delimiter">}</span> + <span class="Comment">// newline</span> + if <span class="Delimiter">(</span>Display_row < tb_height<span class="Delimiter">()</span>-<span class="Constant">1</span><span class="Delimiter">)</span> + ++Display_row<span class="Delimiter">;</span> + Display_column = <span class="Constant">0</span><span class="Delimiter">;</span> + tb_set_cursor<span class="Delimiter">(</span>Display_column<span class="Delimiter">,</span> Display_row<span class="Delimiter">);</span> + tb_present<span class="Delimiter">();</span> +<span class="Delimiter">}</span> + +<span class="SalientComment">//:: debugging tool</span> + +<span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> +_RUN_DEPTH<span class="Delimiter">,</span> +<span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> +Recipe_number[<span class="Constant">"$run-depth"</span>] = _RUN_DEPTH<span class="Delimiter">;</span> +<span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> +case _RUN_DEPTH: <span class="Delimiter">{</span> + cerr << Current_routine<span class="Delimiter">-></span>calls<span class="Delimiter">.</span>size<span class="Delimiter">();</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> +<span class="Delimiter">}</span> +</pre> +</body> +</html> +<!-- vim: set foldmethod=manual : --> diff --git a/html/999spaces.cc.html b/html/999spaces.cc.html index 99c38f35..4294eaad 100644 --- a/html/999spaces.cc.html +++ b/html/999spaces.cc.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Constant { color: #008080; } .Comment { color: #8080ff; } diff --git a/html/callcc.mu.html b/html/callcc.mu.html index 50037f46..b7dad852 100644 --- a/html/callcc.mu.html +++ b/html/callcc.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Comment { color: #8080ff; } .Constant { color: #008080; } diff --git a/html/channel.mu.html b/html/channel.mu.html index e6d5a456..e6f7df34 100644 --- a/html/channel.mu.html +++ b/html/channel.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Delimiter { color: #c000c0; } .Comment { color: #8080ff; } diff --git a/html/chessboard.mu.html b/html/chessboard.mu.html index 457df812..4ece3331 100644 --- a/html/chessboard.mu.html +++ b/html/chessboard.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .CommentedCode { color: #6c6c6c; } .Delimiter { color: #c000c0; } diff --git a/html/counters.mu.html b/html/counters.mu.html index 5b762232..ee41a5f8 100644 --- a/html/counters.mu.html +++ b/html/counters.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Comment { color: #8080ff; } .Constant { color: #008080; } diff --git a/html/display.mu.html b/html/display.mu.html index 253d9eba..efae38f5 100644 --- a/html/display.mu.html +++ b/html/display.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Comment { color: #8080ff; } .Constant { color: #008080; } diff --git a/html/edit.mu.html b/html/edit.mu.html new file mode 100644 index 00000000..8251e997 --- /dev/null +++ b/html/edit.mu.html @@ -0,0 +1,119 @@ +<!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 - edit.mu</title> +<meta name="Generator" content="Vim/7.4"> +<meta name="plugin-version" content="vim7.4_v1"> +<meta name="syntax" content="none"> +<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: 1em; } +.Delimiter { color: #c000c0; } +.Comment { color: #8080ff; } +.Constant { color: #008080; } +.Special { color: #ff6060; } +.Identifier { color: #008080; } +.muRecipe { color: #ff8700; } +.CommentedCode { color: #6c6c6c; } +--> +</style> + +<script type='text/javascript'> +<!-- + +--> +</script> +</head> +<body> +<pre id='vimCodeElement'> +<span class="muRecipe">recipe</span> main [ + <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + switch-to-display + draw-bounding-box <span class="Constant">0:literal/screen</span>, <span class="Constant">5:literal</span>, <span class="Constant">5:literal</span>, <span class="Constant">30:literal</span>, <span class="Constant">45:literal</span> + wait-for-key-from-keyboard + return-to-console +] + +<span class="muRecipe">recipe</span> draw-bounding-box [ + <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + screen:address<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + <span class="Comment"># sanity-check the box bounds</span> + top:number<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + <span class="Delimiter">{</span> + out?:boolean<span class="Special"> <- </span>lesser-than top:number, <span class="Constant">0:literal</span> + <span class="Identifier">break-unless</span> out?:boolean + top:number<span class="Special"> <- </span>copy <span class="Constant">0:literal</span> + <span class="Delimiter">}</span> + left:number<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + <span class="Delimiter">{</span> + out?:boolean<span class="Special"> <- </span>lesser-than left:number, <span class="Constant">0:literal</span> + <span class="Identifier">break-unless</span> out?:boolean + left:number<span class="Special"> <- </span>copy <span class="Constant">0:literal</span> + <span class="Delimiter">}</span> + bottom:number<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + <span class="Delimiter">{</span> + height:number<span class="Special"> <- </span>screen-height screen:address + out?:boolean<span class="Special"> <- </span>greater-or-equal bottom:number, height:number + <span class="Identifier">break-unless</span> out?:boolean + bottom:number<span class="Special"> <- </span>subtract height:number, <span class="Constant">1:literal</span> + <span class="Delimiter">}</span> + right:number<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + <span class="Delimiter">{</span> + width:number<span class="Special"> <- </span>screen-width screen:address + out?:boolean<span class="Special"> <- </span>greater-or-equal right:number, width:number + <span class="Identifier">break-unless</span> out?:boolean + right:number<span class="Special"> <- </span>subtract width:number, <span class="Constant">1:literal</span> + <span class="Delimiter">}</span> +<span class="CommentedCode">#? print-integer screen:address, bottom:number</span> +<span class="CommentedCode">#? print-character screen:address, 32:literal/space</span> +<span class="CommentedCode">#? print-integer screen:address, right:number</span> + <span class="Comment"># top border</span> + move-cursor screen:address, top:number, left:number + print-character screen:address, <span class="Constant">9484:literal/down-right</span>, <span class="Constant">245:literal/grey</span> + x:number<span class="Special"> <- </span>add left:number, <span class="Constant">1:literal</span> <span class="Comment"># exclude corner</span> + <span class="Delimiter">{</span> + continue?:boolean<span class="Special"> <- </span>lesser-than x:number, right:number + <span class="Identifier">break-unless</span> continue?:boolean + print-character screen:address, <span class="Constant">9472:literal/horizontal</span>, <span class="Constant">245:literal/grey</span> + x:number<span class="Special"> <- </span>add x:number, <span class="Constant">1:literal</span> + <span class="Identifier">loop</span> + <span class="Delimiter">}</span> + print-character screen:address, <span class="Constant">9488:literal/down-left</span>, <span class="Constant">245:literal/grey</span> + <span class="Comment"># bottom border</span> + move-cursor screen:address, bottom:number, left:number + print-character screen:address, <span class="Constant">9492:literal/up-right</span>, <span class="Constant">245:literal/grey</span> + x:number<span class="Special"> <- </span>add left:number, <span class="Constant">1:literal</span> <span class="Comment"># exclude corner</span> + <span class="Delimiter">{</span> + continue?:boolean<span class="Special"> <- </span>lesser-than x:number, right:number + <span class="Identifier">break-unless</span> continue?:boolean + print-character screen:address, <span class="Constant">9472:literal/horizontal</span>, <span class="Constant">245:literal/grey</span> + x:number<span class="Special"> <- </span>add x:number, <span class="Constant">1:literal</span> + <span class="Identifier">loop</span> + <span class="Delimiter">}</span> + print-character screen:address, <span class="Constant">9496:literal/up-left</span>, <span class="Constant">245:literal/grey</span> + <span class="Comment"># left and right borders</span> + x:number<span class="Special"> <- </span>add top:number, <span class="Constant">1:literal</span> <span class="Comment"># exclude corner</span> + <span class="Delimiter">{</span> + continue?:boolean<span class="Special"> <- </span>lesser-than x:number, bottom:number + <span class="Identifier">break-unless</span> continue?:boolean + move-cursor screen:address, x:number, left:number + print-character screen:address, <span class="Constant">9474:literal/vertical</span>, <span class="Constant">245:literal/grey</span> + move-cursor screen:address, x:number, right:number + print-character screen:address, <span class="Constant">9474:literal/vertical</span>, <span class="Constant">245:literal/grey</span> + x:number<span class="Special"> <- </span>add x:number, <span class="Constant">1:literal</span> + <span class="Identifier">loop</span> + <span class="Delimiter">}</span> + <span class="Comment"># position cursor inside box</span> + move-cursor screen:address, top:number, left:number + cursor-down screen:address + cursor-right screen:address +] +</pre> +</body> +</html> +<!-- vim: set foldmethod=manual : --> diff --git a/html/factorial.mu.html b/html/factorial.mu.html index d8d58b93..c57d4b62 100644 --- a/html/factorial.mu.html +++ b/html/factorial.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Delimiter { color: #c000c0; } .Comment { color: #8080ff; } diff --git a/html/fork.mu.html b/html/fork.mu.html index 1dbd922c..39c7207a 100644 --- a/html/fork.mu.html +++ b/html/fork.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Constant { color: #008080; } .Comment { color: #8080ff; } diff --git a/html/keyboard.mu.html b/html/keyboard.mu.html index 5b700513..29d73f4e 100644 --- a/html/keyboard.mu.html +++ b/html/keyboard.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Constant { color: #008080; } .Comment { color: #8080ff; } diff --git a/html/repl.mu.html b/html/repl.mu.html index 807e9308..2a9f4d62 100644 --- a/html/repl.mu.html +++ b/html/repl.mu.html @@ -10,17 +10,17 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } -.CommentedCode { color: #6c6c6c; } .Delimiter { color: #c000c0; } +.muScenario { color: #00af00; } .Comment { color: #8080ff; } .Constant { color: #008080; } .Special { color: #ff6060; } .Identifier { color: #008080; } .muRecipe { color: #ff8700; } -.muScenario { color: #00af00; } +.CommentedCode { color: #6c6c6c; } --> </style> @@ -39,14 +39,23 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } switch-to-display msg:address:array:character<span class="Special"> <- </span>new <span class="Constant">[ready! type in an instruction, then hit enter. ctrl-d exits.</span> <span class="Constant">]</span> - <span class="Constant">0:literal/real-screen</span><span class="Special"> <- </span>print-string <span class="Constant">0:literal/real-screen</span>, msg:address:array:character + <span class="Constant">0:literal/real-screen</span><span class="Special"> <- </span>print-string <span class="Constant">0:literal/real-screen</span>, msg:address:array:character, <span class="Constant">245:literal/grey</span> + <span class="Constant">0:literal/real-keyboard</span>, <span class="Constant">0:literal/real-screen</span><span class="Special"> <- </span>color-session <span class="Constant">0:literal/real-keyboard</span>, <span class="Constant">0:literal/real-screen</span> +<span class="CommentedCode">#? wait-for-key-from-keyboard #? 1</span> + return-to-console +] + +<span class="muRecipe">recipe</span> color-session [ + <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + keyboard:address<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + screen:address<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> <span class="Delimiter">{</span> - inst:address:array:character, <span class="Constant">0:literal/real-keyboard</span>, <span class="Constant">0:literal/real-screen</span><span class="Special"> <- </span>read-instruction <span class="Constant">0:literal/real-keyboard</span>, <span class="Constant">0:literal/real-screen</span> + inst:address:array:character, keyboard:address, screen:address<span class="Special"> <- </span>read-instruction keyboard:address, screen:address <span class="Identifier">break-unless</span> inst:address:array:character - <span class="Constant">0:literal/real-screen</span><span class="Special"> <- </span>print-string <span class="Constant">0:literal/real-screen</span>, inst:address:array:character + run-interactive inst:address:array:character <span class="Identifier">loop</span> <span class="Delimiter">}</span> - return-to-console + <span class="Identifier">reply</span> keyboard:address/same-as-ingredient:0, screen:address/same-as-ingredient:1 ] <span class="Comment"># basic keyboard input; just text and enter</span> @@ -66,10 +75,14 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } <span class="Constant"> . .</span> ] screen-should-contain-in-color <span class="Constant">7:literal/white</span>, [ - <span class="Constant"> .x <- copy y .</span> + <span class="Constant"> .x copy y .</span> <span class="Constant"> .=> x <- copy y .</span> <span class="Constant"> . .</span> ] + screen-should-contain-in-color <span class="Constant">1:literal/red</span>, [ + <span class="Constant"> . <- .</span> + <span class="Constant"> . .</span> + ] ] <span class="Comment"># Read characters as they're typed at the keyboard, print them to the screen,</span> @@ -92,9 +105,13 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } <span class="Identifier">jump-if</span> completed?:boolean,<span class="Identifier"> +completed</span>:label <span class="Comment"># Otherwise we're just getting started.</span> result:address:buffer, k:address:keyboard, x:address:screen<span class="Special"> <- </span>slurp-regular-characters result:address:buffer, k:address:keyboard, x:address:screen, complete:continuation +<span class="CommentedCode">#? $print [aaa: ], result:address:buffer #? 1</span> +<span class="CommentedCode">#? move-cursor-down-on-display #? 1</span> trace <span class="Constant">[error]</span>, <span class="Constant">[slurp-regular-characters should never return normally]</span> <span class="Identifier"> +completed</span> result2:address:array:character<span class="Special"> <- </span>buffer-to-array result:address:buffer +<span class="CommentedCode">#? $print [bbb: ], result2:address:array:character #? 1</span> +<span class="CommentedCode">#? move-cursor-down-on-display #? 1</span> trace <span class="Constant">[app]</span>, <span class="Constant">[exiting read-instruction]</span> <span class="Identifier">reply</span> result2:address:array:character, k:address:keyboard/same-as-ingredient:0, x:address:screen/same-as-ingredient:1 ] @@ -102,21 +119,32 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } <span class="Comment"># read characters from the keyboard, print them to the screen in *white*.</span> <span class="Comment"># Transition to other routines for comments and strings.</span> <span class="muRecipe">recipe</span> slurp-regular-characters [ - <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">60:literal</span> + <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> result:address:buffer<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> k:address:keyboard<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> x:address:screen<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> complete:continuation<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> trace <span class="Constant">[app]</span>, <span class="Constant">[slurp-regular-characters]</span> characters-slurped:number<span class="Special"> <- </span>copy <span class="Constant">0:literal</span> +<span class="CommentedCode">#? $run-depth #? 1</span> <span class="Delimiter">{</span> <span class="Identifier"> +next-character</span> + trace <span class="Constant">[app]</span>, <span class="Constant">[slurp-regular-characters: next]</span> +<span class="CommentedCode">#? $print [a0 #? 1</span> +<span class="CommentedCode">#? ] #? 1</span> +<span class="CommentedCode">#? move-cursor-down-on-display #? 1</span> <span class="Comment"># read character</span> c:character, k:address:keyboard<span class="Special"> <- </span>wait-for-key k:address:keyboard +<span class="CommentedCode">#? print-character x:address:screen, c:character #? 1</span> +<span class="CommentedCode">#? move-cursor-down-on-display #? 1</span> <span class="Comment"># quit?</span> <span class="Delimiter">{</span> +<span class="CommentedCode">#? $print [aaa] #? 1</span> +<span class="CommentedCode">#? move-cursor-down-on-display #? 1</span> ctrl-d?:boolean<span class="Special"> <- </span>equal c:character, <span class="Constant">4:literal/ctrl-d/eof</span> <span class="Identifier">break-unless</span> ctrl-d?:boolean +<span class="CommentedCode">#? $print [ctrl-d] #? 1</span> +<span class="CommentedCode">#? move-cursor-down-on-display #? 1</span> trace <span class="Constant">[app]</span>, <span class="Constant">[slurp-regular-characters: ctrl-d]</span> <span class="Identifier">reply</span> <span class="Constant">0:literal</span>, k:address:keyboard/same-as-ingredient:1, x:address:screen/same-as-ingredient:2 <span class="Delimiter">}</span> @@ -145,23 +173,54 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } result:address:buffer, _, k:address:keyboard, x:address:screen<span class="Special"> <- </span>slurp-string result:address:buffer, k:address:keyboard, x:address:screen, complete:continuation <span class="Identifier">loop</span><span class="Identifier"> +next-character</span>:label <span class="Delimiter">}</span> + <span class="Comment"># assignment</span> + <span class="Delimiter">{</span> + assign?:boolean<span class="Special"> <- </span>equal c:character, <span class="Constant">60:literal/less-than</span> + <span class="Identifier">break-unless</span> assign?:boolean + print-character x:address:screen, c:character, <span class="Constant">1:literal/red</span> + trace <span class="Constant">[app]</span>, <span class="Constant">[start of assignment: <]</span> + result:address:buffer<span class="Special"> <- </span>buffer-append result:address:buffer, c:character + result:address:buffer, k:address:keyboard, x:address:screen<span class="Special"> <- </span>slurp-assignment result:address:buffer, k:address:keyboard, x:address:screen, complete:continuation + <span class="Identifier">loop</span><span class="Identifier"> +next-character</span>:label + <span class="Delimiter">}</span> <span class="Comment"># print</span> print-character x:address:screen, c:character <span class="Comment"># default color</span> <span class="Comment"># append</span> result:address:buffer<span class="Special"> <- </span>buffer-append result:address:buffer, c:character +<span class="CommentedCode">#? $print [a1 #? 1</span> +<span class="CommentedCode">#? ] #? 1</span> +<span class="CommentedCode">#? move-cursor-down-on-display #? 1</span> <span class="Comment"># backspace? decrement and maybe return</span> <span class="Delimiter">{</span> +<span class="CommentedCode">#? $print [a2 #? 1</span> +<span class="CommentedCode">#? ] #? 1</span> +<span class="CommentedCode">#? move-cursor-down-on-display #? 1</span> backspace?:boolean<span class="Special"> <- </span>equal c:character, <span class="Constant">8:literal/backspace</span> <span class="Identifier">break-unless</span> backspace?:boolean +<span class="CommentedCode">#? $print [a3 #? 1</span> +<span class="CommentedCode">#? ] #? 1</span> +<span class="CommentedCode">#? move-cursor-down-on-display #? 1</span> characters-slurped:number<span class="Special"> <- </span>subtract characters-slurped:number, <span class="Constant">1:literal</span> <span class="Delimiter">{</span> - done?:boolean<span class="Special"> <- </span>lesser-or-equal characters-slurped:number, <span class="Constant">0:literal</span> +<span class="CommentedCode">#? $print [a4 #? 1</span> +<span class="CommentedCode">#? ] #? 1</span> +<span class="CommentedCode">#? move-cursor-down-on-display #? 1</span> + done?:boolean<span class="Special"> <- </span>lesser-or-equal characters-slurped:number,<span class="Identifier"> -1</span>:literal <span class="Identifier">break-unless</span> done?:boolean +<span class="CommentedCode">#? $print [a5 #? 1</span> +<span class="CommentedCode">#? ] #? 1</span> +<span class="CommentedCode">#? move-cursor-down-on-display #? 1</span> trace <span class="Constant">[app]</span>, <span class="Constant">[slurp-regular-characters: too many backspaces; returning]</span> +<span class="CommentedCode">#? $print [a6 #? 1</span> +<span class="CommentedCode">#? ] #? 1</span> +<span class="CommentedCode">#? move-cursor-down-on-display #? 1</span> <span class="Identifier">reply</span> result:address:buffer, k:address:keyboard/same-as-ingredient:1, x:address:screen/same-as-ingredient:2 <span class="Delimiter">}</span> <span class="Identifier">loop</span><span class="Identifier"> +next-character</span>:label <span class="Delimiter">}</span> +<span class="CommentedCode">#? $print [a9 #? 1</span> +<span class="CommentedCode">#? ] #? 1</span> +<span class="CommentedCode">#? move-cursor-down-on-display #? 1</span> <span class="Comment"># otherwise increment</span> characters-slurped:number<span class="Special"> <- </span>add characters-slurped:number, <span class="Constant">1:literal</span> <span class="Comment"># done with this instruction?</span> @@ -181,7 +240,7 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } <span class="Comment"># Simpler version of slurp-regular-characters; doesn't handle comments or</span> <span class="Comment"># strings. Tracks an extra count in case we backspace out of it</span> <span class="muRecipe">recipe</span> slurp-comment [ - <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">60:literal</span> + <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> result:address:buffer<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> k:address:keyboard<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> x:address:screen<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> @@ -230,8 +289,8 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } <span class="Identifier">break-if</span> done?:boolean <span class="Identifier">loop</span> <span class="Delimiter">}</span> - trace <span class="Constant">[app]</span>, <span class="Constant">[slurp-regular-characters: newline encountered; returning]</span> - <span class="Identifier">reply</span> result:address:buffer, k:address:keyboard/same-as-ingredient:1, x:address:screen/same-as-ingredient:2 + trace <span class="Constant">[app]</span>, <span class="Constant">[slurp-regular-characters: newline encountered; unwinding stack]</span> + <span class="Identifier">continue-from</span> complete:continuation ] <span class="Comment"># read characters from keyboard, print them to screen in the string color and</span> @@ -242,7 +301,7 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } <span class="Comment"># b) handles nested strings using recursive calls to itself. Tracks an extra</span> <span class="Comment"># count in case we backspace out of it.</span> <span class="muRecipe">recipe</span> slurp-string [ - <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">60:literal</span> + <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> result:address:buffer<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> k:address:keyboard<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> x:address:screen<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> @@ -318,6 +377,49 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } <span class="Identifier">jump</span><span class="Identifier"> +next-character</span>:label ] +<span class="muRecipe">recipe</span> slurp-assignment [ + <span class="Identifier">default-space</span>:address:array:location<span class="Special"> <- </span>new location:type, <span class="Constant">30:literal</span> + result:address:buffer<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + k:address:keyboard<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + x:address:screen<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + complete:continuation<span class="Special"> <- </span><span class="Identifier">next-ingredient</span> + <span class="Delimiter">{</span> + <span class="Identifier"> +next-character</span> + <span class="Comment"># read character</span> + c:character, k:address:keyboard<span class="Special"> <- </span>wait-for-key k:address:keyboard + <span class="Comment"># quit?</span> + <span class="Delimiter">{</span> + ctrl-d?:boolean<span class="Special"> <- </span>equal c:character, <span class="Constant">4:literal/ctrl-d/eof</span> + <span class="Identifier">break-unless</span> ctrl-d?:boolean + trace <span class="Constant">[app]</span>, <span class="Constant">[slurp-assignment: ctrl-d]</span> + <span class="Identifier">reply</span> <span class="Constant">0:literal</span>, k:address:keyboard/same-as-ingredient:1, x:address:screen/same-as-ingredient:2 + <span class="Delimiter">}</span> + <span class="Delimiter">{</span> + null?:boolean<span class="Special"> <- </span>equal c:character, <span class="Constant">0:literal/null</span> + <span class="Identifier">break-unless</span> null?:boolean + trace <span class="Constant">[app]</span>, <span class="Constant">[slurp-assignment: null]</span> + <span class="Identifier">reply</span> <span class="Constant">0:literal</span>, k:address:keyboard/same-as-ingredient:1, x:address:screen/same-as-ingredient:2 + <span class="Delimiter">}</span> + <span class="Comment"># print</span> + print-character x:address:screen, c:character, <span class="Constant">1:literal/red</span> + trace <span class="Constant">[app]</span>, <span class="Constant">[slurp-assignment: saved one character]</span> + <span class="Comment"># append</span> + result:address:buffer<span class="Special"> <- </span>buffer-append result:address:buffer, c:character + <span class="Comment"># backspace? return</span> + <span class="Delimiter">{</span> + backspace?:boolean<span class="Special"> <- </span>equal c:character, <span class="Constant">8:literal/backspace</span> + <span class="Identifier">break-unless</span> backspace?:boolean + trace <span class="Constant">[app]</span>, <span class="Constant">[slurp-assignment: backspace; returning]</span> + <span class="Identifier">reply</span> result:address:buffer/same-as-ingredient:0, k:address:keyboard/same-as-ingredient:1, x:address:screen/same-as-ingredient:2 + <span class="Delimiter">}</span> + <span class="Delimiter">}</span> + trace <span class="Constant">[app]</span>, <span class="Constant">[slurp-assignment: done, recursing to regular characters]</span> + result:address:buffer, k:address:keyboard, x:address:screen<span class="Special"> <- </span>slurp-regular-characters result:address:buffer, k:address:keyboard, x:address:screen, complete:continuation + <span class="Comment"># backspaced back into this string</span> + trace <span class="Constant">[app]</span>, <span class="Constant">[slurp-assignment: backspaced back into assignment; restarting]</span> + <span class="Identifier">jump</span><span class="Identifier"> +next-character</span>:label +] + <span class="muScenario">scenario</span> read-instruction-color-comment [ assume-screen <span class="Constant">30:literal/width</span>, <span class="Constant">5:literal/height</span> assume-keyboard <span class="Constant">[# comment</span> @@ -389,6 +491,23 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } ] ] +<span class="muScenario">scenario</span> read-instruction-stop-after-comment [ + assume-screen <span class="Constant">30:literal/width</span>, <span class="Constant">5:literal/height</span> + <span class="Comment"># keyboard contains comment and then a second line</span> + assume-keyboard <span class="Constant">[#abc</span> +<span class="Constant">3</span> +<span class="Constant">]</span> + replace-in-keyboard <span class="Constant">171:literal/«</span>, <span class="Constant">8:literal/backspace</span> + run [ + read-instruction keyboard:address, screen:address + ] + <span class="Comment"># check that read-instruction reads just the comment</span> + screen-should-contain [ + <span class="Constant"> .#abc .</span> + <span class="Constant"> . .</span> + ] +] + <span class="muScenario">scenario</span> read-instruction-color-string [ <span class="CommentedCode">#? $start-tracing #? 1</span> assume-screen <span class="Constant">30:literal/width</span>, <span class="Constant">5:literal/height</span> @@ -574,7 +693,6 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } <span class="muScenario">scenario</span> read-instruction-backspace-back-into-string [ assume-screen <span class="Constant">30:literal/width</span>, <span class="Constant">5:literal/height</span> - <span class="Comment"># need to escape the '[' once for 'scenario' and once for 'assume-keyboard'</span> assume-keyboard <span class="Constant">[[a]</span>«b ] replace-in-keyboard <span class="Constant">171:literal/«</span>, <span class="Constant">8:literal/backspace</span> @@ -600,6 +718,115 @@ body { font-family: monospace; color: #d0d0d0; background-color: #080808; } <span class="Comment"># slurp-regular-characters/slurp-string/slurp-regular-characters: backspace</span> <span class="Comment"># slurp-regular-characters/slurp-string: b</span> ] + +<span class="muScenario">scenario</span> read-instruction-highlight-start-of-assignment [ + assume-screen <span class="Constant">30:literal/width</span>, <span class="Constant">5:literal/height</span> + assume-keyboard <span class="Constant">[a <</span> +<span class="Constant">]</span> + run [ + read-instruction keyboard:address, screen:address + ] + screen-should-contain [ + <span class="Constant"> .a < .</span> + <span class="Constant"> . .</span> + ] + screen-should-contain-in-color <span class="Constant">1:literal/red</span>, [ + <span class="Constant"> . < .</span> + <span class="Constant"> . .</span> + ] + screen-should-contain-in-color <span class="Constant">7:literal/white</span>, [ + <span class="Constant"> .a .</span> + <span class="Constant"> . .</span> + ] +] + +<span class="muScenario">scenario</span> read-instruction-highlight-assignment [ + assume-screen <span class="Constant">30:literal/width</span>, <span class="Constant">5:literal/height</span> + assume-keyboard <span class="Constant">[a <- b</span> +<span class="Constant">]</span> + run [ + read-instruction keyboard:address, screen:address + ] + screen-should-contain [ + <span class="Constant"> .a <- b .</span> + <span class="Constant"> . .</span> + ] + screen-should-contain-in-color <span class="Constant">1:literal/red</span>, [ + <span class="Constant"> . <- .</span> + <span class="Constant"> . .</span> + ] + screen-should-contain-in-color <span class="Constant">7:literal/white</span>, [ + <span class="Constant"> .a b .</span> + <span class="Constant"> . .</span> + ] +] + +<span class="muScenario">scenario</span> read-instruction-backspace-over-assignment [ + assume-screen <span class="Constant">30:literal/width</span>, <span class="Constant">5:literal/height</span> + assume-keyboard <span class="Constant">[a <-«</span> +<span class="Constant">]</span> + replace-in-keyboard <span class="Constant">171:literal/«</span>, <span class="Constant">8:literal/backspace</span> + run [ + read-instruction keyboard:address, screen:address + ] + screen-should-contain [ + <span class="Constant"> .a < .</span> + <span class="Constant"> . .</span> + ] + screen-should-contain-in-color <span class="Constant">1:literal/red</span>, [ + <span class="Constant"> . < .</span> + <span class="Constant"> . .</span> + ] + screen-should-contain-in-color <span class="Constant">7:literal/white</span>, [ + <span class="Constant"> .a .</span> + <span class="Constant"> . .</span> + ] +] + +<span class="muScenario">scenario</span> read-instruction-assignment-continues-after-backspace [ + assume-screen <span class="Constant">30:literal/width</span>, <span class="Constant">5:literal/height</span> + assume-keyboard <span class="Constant">[a <-«-</span> +<span class="Constant">]</span> + replace-in-keyboard <span class="Constant">171:literal/«</span>, <span class="Constant">8:literal/backspace</span> + run [ + read-instruction keyboard:address, screen:address + ] + screen-should-contain [ + <span class="Constant"> .a <- .</span> + <span class="Constant"> . .</span> + ] + screen-should-contain-in-color <span class="Constant">1:literal/red</span>, [ + <span class="Constant"> . <- .</span> + <span class="Constant"> . .</span> + ] + screen-should-contain-in-color <span class="Constant">7:literal/white</span>, [ + <span class="Constant"> .a .</span> + <span class="Constant"> . .</span> + ] +] + +<span class="muScenario">scenario</span> read-instruction-assignment-continues-after-backspace2 [ + assume-screen <span class="Constant">30:literal/width</span>, <span class="Constant">5:literal/height</span> + assume-keyboard <span class="Constant">[a <- ««-</span> +<span class="Constant">]</span> + replace-in-keyboard <span class="Constant">171:literal/«</span>, <span class="Constant">8:literal/backspace</span> + run [ + read-instruction keyboard:address, screen:address +<span class="CommentedCode">#? $browse-trace #? 1</span> + ] + screen-should-contain [ + <span class="Constant"> .a <- .</span> + <span class="Constant"> . .</span> + ] + screen-should-contain-in-color <span class="Constant">1:literal/red</span>, [ + <span class="Constant"> . <- .</span> + <span class="Constant"> . .</span> + ] + screen-should-contain-in-color <span class="Constant">7:literal/white</span>, [ + <span class="Constant"> .a .</span> + <span class="Constant"> . .</span> + ] +] </pre> </body> </html> diff --git a/html/screen.mu.html b/html/screen.mu.html index 9956cfa3..9dfa3474 100644 --- a/html/screen.mu.html +++ b/html/screen.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Comment { color: #8080ff; } .Constant { color: #008080; } diff --git a/html/tangle.mu.html b/html/tangle.mu.html index 8dd2b7f9..4edc9c2d 100644 --- a/html/tangle.mu.html +++ b/html/tangle.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Delimiter { color: #c000c0; } .Comment { color: #8080ff; } diff --git a/html/x.mu.html b/html/x.mu.html index 4c5803d2..96eb4be8 100644 --- a/html/x.mu.html +++ b/html/x.mu.html @@ -10,8 +10,8 @@ <meta name="colorscheme" content="minimal"> <style type="text/css"> <!-- -pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #080808; } -body { font-family: monospace; color: #d0d0d0; background-color: #080808; } +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; } .Comment { color: #8080ff; } .Constant { color: #008080; } |