diff options
43 files changed, 241 insertions, 134 deletions
diff --git a/002test.cc b/002test.cc index 72e2b95f..2f64437f 100644 --- a/002test.cc +++ b/002test.cc @@ -2,11 +2,11 @@ //: 'test_'. To run all tests so defined, run: //: $ mu test //: -//: So far it seems tasteful for layers to never ever reach back to modify -//: previously-defined tests. Every test is a contract once written, and should -//: pass as-is if it is included, regardless of how much later layers change -//: the program. Avoid writing 'temporary' tests that only work with some -//: subsets of the program. +//: Every layer should include tests, and can reach into previous layers. +//: However, it seems like a good idea never to reach into tests from previous +//: layers. Every test should be a contract that always passes as originally +//: written, regardless of any later layers. Avoid writing 'temporary' tests +//: that are only meant to work until some layer. :(before "End Types") typedef void (*test_fn)(void); diff --git a/html/000organization.cc.html b/html/000organization.cc.html index 9128bdd0..35bb2a25 100644 --- a/html/000organization.cc.html +++ b/html/000organization.cc.html @@ -126,16 +126,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment">// Types</span> <span class="Comment">// End Types</span> -<span class="Comment">// Prototypes are auto-generated in the makefile; define your functions in any</span> -<span class="Comment">// order. Just be sure to declare each function header all on one line. Our</span> -<span class="Comment">// auto-generation scripts are too minimal and simple-minded to handle</span> +<span class="Comment">// Prototypes are auto-generated in the 'build' script; define your functions</span> +<span class="Comment">// in any order. Just be sure to declare each function header all on one line.</span> +<span class="Comment">// Our auto-generation scripts are too minimal and simple-minded to handle</span> <span class="Comment">// anything else.</span> <span class="PreProc">#include </span><span class="Constant">"function_list"</span> <span class="Comment">// by convention, files ending with '_list' are auto-generated</span> <span class="Comment">// Globals</span> <span class="Comment">//</span> <span class="Comment">// All statements in this section should always define a single variable on a</span> -<span class="Comment">// single line. The makefile will simple-mindedly auto-generate extern</span> +<span class="Comment">// single line. The 'build' script will simple-mindedly auto-generate extern</span> <span class="Comment">// declarations for them. Don't forget to define (not just declare) constants</span> <span class="Comment">// with extern linkage in this section, since C++ global constants have</span> <span class="Comment">// internal linkage by default.</span> diff --git a/html/001help.cc.html b/html/001help.cc.html index 087ae91a..dd6f7d74 100644 --- a/html/001help.cc.html +++ b/html/001help.cc.html @@ -93,8 +93,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment">//: anywhere we like as long as we format the function header in a specific</span> <span class="Comment">//: way: put it all on a single line without indent, end the line with ') {'</span> <span class="Comment">//: and no trailing whitespace. As long as functions uniformly start this</span> -<span class="Comment">//: way, our makefile contains a little command to automatically generate</span> -<span class="Comment">//: declarations for them.</span> +<span class="Comment">//: way, our 'build' script contains a little command to automatically</span> +<span class="Comment">//: generate declarations for them.</span> <span class="Delimiter">:(code)</span> <span class="Normal">bool</span> is_equal<span class="Delimiter">(</span><span class="Normal">char</span>* s<span class="Delimiter">,</span> <span class="Normal">const</span> <span class="Normal">char</span>* lit<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Identifier">return</span> strncmp<span class="Delimiter">(</span>s<span class="Delimiter">,</span> lit<span class="Delimiter">,</span> strlen<span class="Delimiter">(</span>lit<span class="Delimiter">))</span> == <span class="Constant">0</span><span class="Delimiter">;</span> diff --git a/html/002test.cc.html b/html/002test.cc.html index 2010d08a..8ef2c73d 100644 --- a/html/002test.cc.html +++ b/html/002test.cc.html @@ -36,18 +36,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment">//: 'test_'. To run all tests so defined, run:</span> <span class="Comment">//: $ mu test</span> <span class="Comment">//:</span> -<span class="Comment">//: So far it seems tasteful for layers to never ever reach back to modify</span> -<span class="Comment">//: previously-defined tests. Every test is a contract once written, and should</span> -<span class="Comment">//: pass as-is if it is included, regardless of how much later layers change</span> -<span class="Comment">//: the program. Avoid writing 'temporary' tests that only work with some</span> -<span class="Comment">//: subsets of the program.</span> +<span class="Comment">//: Every layer should include tests, and can reach into previous layers.</span> +<span class="Comment">//: However, it seems like a good idea never to reach into tests from previous</span> +<span class="Comment">//: layers. Every test should be a contract that always passes as originally</span> +<span class="Comment">//: written, regardless of any later layers. Avoid writing 'temporary' tests</span> +<span class="Comment">//: that are only meant to work until some layer.</span> <span class="Delimiter">:(before "End Types")</span> <span class="Normal">typedef</span> <span class="Normal">void</span> <span class="Delimiter">(</span>*test_fn<span class="Delimiter">)(</span><span class="Normal">void</span><span class="Delimiter">);</span> <span class="Delimiter">:(before "Globals")</span> <span class="Comment">// move a global ahead into types that we can't generate an extern declaration for</span> <span class="Normal">const</span> test_fn Tests[] = <span class="Delimiter">{</span> -<span class="PreProc"> #include </span><span class="Constant">"test_list"</span> <span class="Comment">// auto-generated; see makefile</span> +<span class="PreProc"> #include </span><span class="Constant">"test_list"</span> <span class="Comment">// auto-generated; see 'build' script</span> <span class="Delimiter">};</span> <span class="Delimiter">:(before "End Globals")</span> diff --git a/html/003trace.test.cc.html b/html/003trace.test.cc.html index 6c1c6e53..a3fb3948 100644 --- a/html/003trace.test.cc.html +++ b/html/003trace.test.cc.html @@ -100,7 +100,6 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment">// pending: raise doesn't have to be saved if Hide_errors is set, just printed.</span> <span class="Comment">// pending: raise prints to stderr if Trace_stream is NULL.</span> <span class="Comment">// pending: raise prints to stderr if Trace_stream is NULL even if Hide_errors is set.</span> -<span class="Comment">// pending: raise << ... die() doesn't die if Hide_errors is set.</span> <span class="Comment">// can't check trace because trace methods call 'split'</span> diff --git a/html/010vm.cc.html b/html/010vm.cc.html index 69df5682..b2f2a111 100644 --- a/html/010vm.cc.html +++ b/html/010vm.cc.html @@ -64,7 +64,7 @@ recipe_ordinal Next_recipe_ordinal = <span class="Constant">1</span><span class= <span class="Comment">// product1, product2, product3, ... <- operation ingredient1, ingredient2, ingredient3, ...</span> <span class="Comment">// or just a single 'label' starting with a non-alphanumeric character</span> <span class="Comment">// +label</span> -<span class="Comment">// Labels don't do anything, they're just waypoints.</span> +<span class="Comment">// Labels don't do anything, they're just named locations in a recipe.</span> <span class="Normal">struct</span> instruction <span class="Delimiter">{</span> <span class="Normal">bool</span> is_label<span class="Delimiter">;</span> string label<span class="Delimiter">;</span> <span class="Comment">// only if is_label</span> diff --git a/html/011load.cc.html b/html/011load.cc.html index d482a246..4bcbd016 100644 --- a/html/011load.cc.html +++ b/html/011load.cc.html @@ -158,7 +158,7 @@ vector<recipe_ordinal> load<span class="Delimiter">(</span>istream& in <span class="Normal">if</span> <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>words<span class="Delimiter">)</span> == <span class="Constant">1</span> && words<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> == <span class="Constant">"]"</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span class="Comment">// end of recipe</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>words<span class="Delimiter">)</span> == <span class="Constant">1</span> && !isalnum<span class="Delimiter">(</span>words<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> && words<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">'$'</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>words<span class="Delimiter">)</span> == <span class="Constant">1</span> && is_label_word<span class="Delimiter">(</span>words<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span> curr<span class="Delimiter">-></span>is_label = <span class="Constant">true</span><span class="Delimiter">;</span> curr<span class="Delimiter">-></span>label = words<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> trace<span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">"parse"</span><span class="Delimiter">)</span> << <span class="Constant">"label: "</span> << curr<span class="Delimiter">-></span>label << end<span class="Delimiter">();</span> @@ -212,6 +212,11 @@ string next_word<span class="Delimiter">(</span>istream& in<span class="Deli <span class="Identifier">return</span> result<span class="Delimiter">;</span> <span class="Delimiter">}</span> +<span class="Normal">bool</span> is_label_word<span class="Delimiter">(</span><span class="Normal">const</span> string& word<span class="Delimiter">)</span> <span class="Delimiter">{</span> + assert<span class="Delimiter">(</span>!word<span class="Delimiter">.</span>empty<span class="Delimiter">());</span> + <span class="Identifier">return</span> !isalnum<span class="Delimiter">(</span>word<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> && string<span class="Delimiter">(</span><span class="Constant">"$_-"</span><span class="Delimiter">).</span>find<span class="Delimiter">(</span>word<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> == string::npos<span class="Delimiter">;</span> +<span class="Delimiter">}</span> + <span class="Normal">bool</span> ends_with<span class="Delimiter">(</span><span class="Normal">const</span> string& s<span class="Delimiter">,</span> <span class="Normal">const</span> <span class="Normal">char</span> c<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Normal">if</span> <span class="Delimiter">(</span>s<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span class="Identifier">return</span> *s<span class="Delimiter">.</span>rbegin<span class="Delimiter">()</span> == c<span class="Delimiter">;</span> diff --git a/html/012transform.cc.html b/html/012transform.cc.html index 7675fe25..c7e405eb 100644 --- a/html/012transform.cc.html +++ b/html/012transform.cc.html @@ -53,7 +53,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color transformed_until = -<span class="Constant">1</span><span class="Delimiter">;</span> <span class="Delimiter">:(before "End Types")</span> -<span class="Normal">typedef</span> <span class="Normal">void</span> <span class="Delimiter">(</span>*transform_fn<span class="Delimiter">)(</span>recipe_ordinal<span class="Delimiter">);</span> +<span class="Normal">typedef</span> <span class="Normal">void</span> <span class="Delimiter">(</span>*transform_fn<span class="Delimiter">)(</span><span class="Normal">const</span> recipe_ordinal<span class="Delimiter">);</span> <span class="Delimiter">:(before "End Globals")</span> vector<transform_fn> Transform<span class="Delimiter">;</span> diff --git a/html/013update_operation.cc.html b/html/013update_operation.cc.html index d8fe0a3e..132553c4 100644 --- a/html/013update_operation.cc.html +++ b/html/013update_operation.cc.html @@ -38,7 +38,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>update_instruction_operations<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span class="Delimiter">:(code)</span> -<span class="Normal">void</span> update_instruction_operations<span class="Delimiter">(</span>recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="Normal">void</span> update_instruction_operations<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> trace<span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- compute instruction operations for recipe "</span> << get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name << end<span class="Delimiter">();</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span class="CommentedCode">//? cerr << "--- compute instruction operations for recipe " << caller.name << '\n';</span> diff --git a/html/020run.cc.html b/html/020run.cc.html index 69cd90e4..bc31010d 100644 --- a/html/020run.cc.html +++ b/html/020run.cc.html @@ -92,7 +92,7 @@ map<string<span class="Delimiter">,</span> <span class="Normal">int</span>> map<string<span class="Delimiter">,</span> <span class="Normal">int</span>> Locations_read_by_instruction<span class="Delimiter">;</span> <span class="Delimiter">:(code)</span> -<span class="Normal">void</span> run<span class="Delimiter">(</span>recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="Normal">void</span> run<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> routine rr<span class="Delimiter">(</span>r<span class="Delimiter">);</span> Current_routine = &rr<span class="Delimiter">;</span> run_current_routine<span class="Delimiter">();</span> diff --git a/html/028call_reply.cc.html b/html/028call_reply.cc.html index 8d1280ff..9ef06f2c 100644 --- a/html/028call_reply.cc.html +++ b/html/028call_reply.cc.html @@ -81,9 +81,9 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span <span class="Comment">//: Types in reply instructions are checked ahead of time.</span> <span class="Delimiter">:(before "End Checks")</span> -Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_types_of_reply_instructions<span class="Delimiter">);</span> +Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_types_of_reply_instructions<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span class="Delimiter">:(code)</span> -<span class="Normal">void</span> check_types_of_reply_instructions<span class="Delimiter">(</span>recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="Normal">void</span> check_types_of_reply_instructions<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> trace<span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- check types of reply instructions in recipe "</span> << caller<span class="Delimiter">.</span>name << end<span class="Delimiter">();</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> diff --git a/html/030container.cc.html b/html/030container.cc.html index d4c45e18..05838130 100644 --- a/html/030container.cc.html +++ b/html/030container.cc.html @@ -213,9 +213,9 @@ type_info t = get<span class="Delimiter">(</span>Type<span class="Delimiter">,</ <span class="Comment">//: also store a copy in each reagent in each instruction in each recipe</span> <span class="Delimiter">:(after "End Type Modifying Transforms")</span> -Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>compute_container_sizes<span class="Delimiter">);</span> +Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>compute_container_sizes<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span class="Delimiter">:(code)</span> -<span class="Normal">void</span> compute_container_sizes<span class="Delimiter">(</span>recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="Normal">void</span> compute_container_sizes<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> trace<span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- compute container sizes for "</span> << caller<span class="Delimiter">.</span>name << end<span class="Delimiter">();</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -858,7 +858,7 @@ Num_calls_to_transform_all_at_first_definition = -<span class="Constant">1</span <span class="traceContains">+mem: storing 34 in location 2</span> <span class="Delimiter">:(after "Transform.push_back(expand_type_abbreviations)")</span> -Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>expand_type_abbreviations_in_containers<span class="Delimiter">);</span> +Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>expand_type_abbreviations_in_containers<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span class="Delimiter">:(code)</span> <span class="Comment">// extremely inefficient; we process all types over and over again, once for every single recipe</span> <span class="Comment">// but it doesn't seem to cause any noticeable slowdown</span> diff --git a/html/031merge.cc.html b/html/031merge.cc.html index 69c3029e..3c86781c 100644 --- a/html/031merge.cc.html +++ b/html/031merge.cc.html @@ -147,7 +147,7 @@ $error: <span class="Constant">0</span> <span class="Delimiter">};</span> <span class="Delimiter">:(before "End Checks")</span> -Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_merge_calls<span class="Delimiter">);</span> +Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_merge_calls<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span class="Delimiter">:(code)</span> <span class="Normal">void</span> check_merge_calls<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> diff --git a/html/034address.cc.html b/html/034address.cc.html index c91e4cfc..dadb168a 100644 --- a/html/034address.cc.html +++ b/html/034address.cc.html @@ -219,7 +219,7 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> drop_from_type<span class="Delimiter">(</span>product<span class="Delimiter">,</span> <span class="Constant">"array"</span><span class="Delimiter">);</span> <span class="Delimiter">}</span> - reagent<span class="Comment">/*</span><span class="Comment">copy</span><span class="Comment">*/</span> expected_product<span class="Delimiter">;</span> + reagent<span class="Comment">/*</span><span class="Comment">local</span><span class="Comment">*/</span> expected_product<span class="Delimiter">;</span> expected_product<span class="Delimiter">.</span>type = new_type_tree<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name<span class="Delimiter">);</span> <span class="Identifier">return</span> types_strictly_match<span class="Delimiter">(</span>product<span class="Delimiter">,</span> expected_product<span class="Delimiter">);</span> <span class="Delimiter">}</span> diff --git a/html/036refcount.cc.html b/html/036refcount.cc.html index 408aea5b..40547a4d 100644 --- a/html/036refcount.cc.html +++ b/html/036refcount.cc.html @@ -319,7 +319,7 @@ map<set<tag_condition_info><span class="Delimiter">,</span> set<addr <span class="Comment">//: already knowing the sizes of all types</span> <span class="Delimiter">:(after "Transform.push_back(compute_container_sizes)")</span> -Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>compute_container_address_offsets<span class="Delimiter">);</span> +Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>compute_container_address_offsets<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span class="Delimiter">:(code)</span> <span class="Normal">void</span> compute_container_address_offsets<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> diff --git a/html/040brace.cc.html b/html/040brace.cc.html index d58f9bc0..aa4f3908 100644 --- a/html/040brace.cc.html +++ b/html/040brace.cc.html @@ -47,8 +47,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment">//: }</span> <span class="Comment">//:</span> <span class="Comment">//: Braces are just labels, they require no special parsing. The pseudo</span> -<span class="Comment">//: recipes 'loop' and 'break' jump to just after the enclosing '{' and '}'</span> -<span class="Comment">//: respectively.</span> +<span class="Comment">//: instructions 'loop' and 'break' jump to just after the enclosing '{' and</span> +<span class="Comment">//: '}' respectively.</span> <span class="Comment">//:</span> <span class="Comment">//: Conditional and unconditional 'loop' and 'break' should give us 80% of the</span> <span class="Comment">//: benefits of the control-flow primitives we're used to in other languages,</span> diff --git a/html/041jump_target.cc.html b/html/041jump_target.cc.html index 2c6b6fde..98c5eab7 100644 --- a/html/041jump_target.cc.html +++ b/html/041jump_target.cc.html @@ -34,14 +34,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color </head> <body> <pre id='vimCodeElement'> -<span class="Comment">//: Support jumps to special labels called 'targets'. Targets must be in the</span> -<span class="Comment">//: same recipe as the jump, and must be unique in that recipe. Targets always</span> -<span class="Comment">//: start with a '+'.</span> +<span class="Comment">//: Support jumps to a specific label (the 'jump target') in the same recipe.</span> +<span class="Comment">//: Jump targets must be unique and unambiguous within any recipe.</span> <span class="Comment">//:</span> -<span class="Comment">//: We'll also treat 'break' and 'loop' as jumps. The choice of name is</span> -<span class="Comment">//: just documentation about intent; use 'break' to indicate you're exiting</span> -<span class="Comment">//: one or more loop nests, and 'loop' to indicate you're skipping to the next</span> -<span class="Comment">//: iteration of some containing loop nest.</span> +<span class="Comment">//: The 'break' and 'loop' pseudo instructions can also take jump targets.</span> +<span class="Comment">//: Which instruction you use is just documentation about intent; use 'break'</span> +<span class="Comment">//: to indicate you're exiting one or more loop nests, and 'loop' to indicate</span> +<span class="Comment">//: you're skipping to the next iteration of some containing loop nest.</span> + +<span class="Comment">//: Since they have to be unique in a recipe, not all labels can be jump</span> +<span class="Comment">//: targets.</span> +<span class="Normal">bool</span> is_jump_target<span class="Delimiter">(</span><span class="Normal">const</span> string& label<span class="Delimiter">)</span> <span class="Delimiter">{</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>label == <span class="Constant">"{"</span> || label == <span class="Constant">"}"</span><span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> + <span class="Comment">// End is_jump_target Special-cases</span> + <span class="Identifier">return</span> is_label_word<span class="Delimiter">(</span>label<span class="Delimiter">);</span> +<span class="Delimiter">}</span> <span class="Delimiter">:(scenario jump_to_label)</span> <span class="muRecipe">def</span> main [ @@ -62,7 +69,8 @@ Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</spa map<string<span class="Delimiter">,</span> <span class="Normal">int</span>> offset<span class="Delimiter">;</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Normal">const</span> instruction& inst = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>starts_with<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>label<span class="Delimiter">,</span> <span class="Constant">"+"</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>is_label<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>is_jump_target<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>label<span class="Delimiter">))</span> <span class="Delimiter">{</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!contains_key<span class="Delimiter">(</span>offset<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>label<span class="Delimiter">))</span> <span class="Delimiter">{</span> put<span class="Delimiter">(</span>offset<span class="Delimiter">,</span> inst<span class="Delimiter">.</span>label<span class="Delimiter">,</span> i<span class="Delimiter">);</span> <span class="Delimiter">}</span> @@ -101,7 +109,6 @@ Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</spa <span class="Delimiter">}</span> <span class="Delimiter">}</span> -<span class="Delimiter">:(code)</span> <span class="Normal">void</span> replace_offset<span class="Delimiter">(</span>reagent& x<span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">const</span><span class="Comment">*/</span> map<string<span class="Delimiter">,</span> <span class="Normal">int</span>>& offset<span class="Delimiter">,</span> <span class="Normal">const</span> <span class="Normal">int</span> current_offset<span class="Delimiter">,</span> <span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span class="Delimiter">{</span> raise << maybe<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> << <span class="Constant">"jump target must be offset or label but is '"</span> << x<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> @@ -123,10 +130,6 @@ Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</spa x<span class="Delimiter">.</span>set_value<span class="Delimiter">(</span>get<span class="Delimiter">(</span>offset<span class="Delimiter">,</span> x<span class="Delimiter">.</span>name<span class="Delimiter">)</span> - current_offset<span class="Delimiter">);</span> <span class="Delimiter">}</span> -<span class="Normal">bool</span> is_jump_target<span class="Delimiter">(</span>string label<span class="Delimiter">)</span> <span class="Delimiter">{</span> - <span class="Identifier">return</span> starts_with<span class="Delimiter">(</span>label<span class="Delimiter">,</span> <span class="Constant">"+"</span><span class="Delimiter">);</span> -<span class="Delimiter">}</span> - <span class="Delimiter">:(scenario break_to_label)</span> <span class="muRecipe">def</span> main [ <span class="Delimiter">{</span> diff --git a/html/047check_type_by_name.cc.html b/html/047check_type_by_name.cc.html index bf4db2e0..234fdb2c 100644 --- a/html/047check_type_by_name.cc.html +++ b/html/047check_type_by_name.cc.html @@ -14,6 +14,7 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background- body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 12pt; font-size: 1em; } .Constant { color: #00a0a0; } +.traceAbsent { color: #c00000; } .cSpecial { color: #008000; } .muRecipe { color: #ff8700; } .Comment { color: #9090ff; } @@ -72,6 +73,10 @@ Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</spa <span class="Normal">void</span> deduce_missing_type<span class="Delimiter">(</span>set<reagent>& known<span class="Delimiter">,</span> reagent& x<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>is_jump_target<span class="Delimiter">(</span>x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> + x<span class="Delimiter">.</span>type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span><span class="Constant">"label"</span><span class="Delimiter">);</span> + <span class="Identifier">return</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> <span class="Normal">if</span> <span class="Delimiter">(</span>known<span class="Delimiter">.</span>find<span class="Delimiter">(</span>x<span class="Delimiter">)</span> == known<span class="Delimiter">.</span>end<span class="Delimiter">())</span> <span class="Identifier">return</span><span class="Delimiter">;</span> x<span class="Delimiter">.</span>type = <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*known<span class="Delimiter">.</span>find<span class="Delimiter">(</span>x<span class="Delimiter">)-></span>type<span class="Delimiter">);</span> trace<span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << x<span class="Delimiter">.</span>name << <span class="Constant">" <= "</span> << names_to_string<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << end<span class="Delimiter">();</span> @@ -81,6 +86,11 @@ Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</spa <span class="Normal">if</span> <span class="Delimiter">(</span>is_literal<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Normal">if</span> <span class="Delimiter">(</span>is_integer<span class="Delimiter">(</span>x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">// if you use raw locations you're probably doing something unsafe</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> <span class="Comment">// might get filled in by other logic later</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>is_jump_target<span class="Delimiter">(</span>x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> <span class="Delimiter">{</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>!x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>atom || x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>name != <span class="Constant">"label"</span><span class="Delimiter">)</span> + raise << maybe<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"non-label '"</span> << x<span class="Delimiter">.</span>name << <span class="Constant">"' must begin with a letter</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + <span class="Identifier">return</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> <span class="Normal">if</span> <span class="Delimiter">(</span>known<span class="Delimiter">.</span>find<span class="Delimiter">(</span>x<span class="Delimiter">)</span> == known<span class="Delimiter">.</span>end<span class="Delimiter">())</span> <span class="Delimiter">{</span> trace<span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << x<span class="Delimiter">.</span>name << <span class="Constant">" => "</span> << names_to_string<span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">)</span> << end<span class="Delimiter">();</span> known<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>x<span class="Delimiter">);</span> @@ -125,6 +135,14 @@ Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</spa <span class="Comment"># x is in location 1</span> <span class="traceContains">+mem: storing 2 in location 1</span> +<span class="Delimiter">:(scenario transform_fills_in_missing_label_type)</span> +<span class="muRecipe">def</span> main [ + jump +target + <span class="Constant">1</span>:num<span class="Special"> <- </span>copy <span class="Constant">0</span> + +target +] +<span class="traceAbsent">-mem: storing 0 in location 1</span> + <span class="Delimiter">:(scenario transform_fails_on_missing_types_in_first_mention)</span> <span class="Special">% Hide_errors = true;</span> <span class="muRecipe">def</span> main [ @@ -133,6 +151,13 @@ Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</spa ] <span class="traceContains">+error: main: missing type for 'x' in 'x <- copy 1'</span> +<span class="Delimiter">:(scenario transform_fails_on_wrong_type_for_label)</span> +<span class="Special">% Hide_errors = true;</span> +<span class="muRecipe">def</span> main [ + +foo:num<span class="Special"> <- </span>copy <span class="Constant">34</span> +] +<span class="traceContains">+error: main: non-label '+foo' must begin with a letter</span> + <span class="Delimiter">:(scenario typo_in_address_type_fails)</span> <span class="Special">% Hide_errors = true;</span> <span class="muRecipe">def</span> main [ diff --git a/html/050scenario.cc.html b/html/050scenario.cc.html index bfaad402..ffdee110 100644 --- a/html/050scenario.cc.html +++ b/html/050scenario.cc.html @@ -241,7 +241,7 @@ Hide_missing_default_space_errors = <span class="Constant">false</span><span cla <span class="Comment">//: Some variables for fake resources always get special /raw addresses in scenarios.</span> <span class="Comment">// Should contain everything passed by is_special_name but failed by is_disqualified.</span> -<span class="Normal">void</span> bind_special_scenario_names<span class="Delimiter">(</span>recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="Normal">void</span> bind_special_scenario_names<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Comment">// Special Scenario Variable Names(r)</span> <span class="Comment">// End Special Scenario Variable Names(r)</span> <span class="Delimiter">}</span> diff --git a/html/052tangle.cc.html b/html/052tangle.cc.html index 59947dbd..4aff0513 100644 --- a/html/052tangle.cc.html +++ b/html/052tangle.cc.html @@ -15,14 +15,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color * { font-size: 12pt; font-size: 1em; } .Constant { color: #00a0a0; } .traceAbsent { color: #c00000; } -.cSpecial { color: #008000; } +.traceContains { color: #008000; } .muRecipe { color: #ff8700; } +.cSpecial { color: #008000; } .Comment { color: #9090ff; } .Delimiter { color: #800080; } .Special { color: #c00000; } -.traceContains { color: #008000; } -.Normal { color: #eeeeee; background-color: #080808; padding-bottom: 1px; } .Identifier { color: #c0a020; } +.Normal { color: #eeeeee; background-color: #080808; padding-bottom: 1px; } --> </style> @@ -35,12 +35,20 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <body> <pre id='vimCodeElement'> <span class="Comment">//: Allow code for recipes to be pulled in from multiple places and inserted</span> -<span class="Comment">//: at special labels called 'waypoints'. Unlike jump targets, a recipe can</span> -<span class="Comment">//: have multiple ambiguous waypoints with the same name. Any 'before' and</span> -<span class="Comment">//: 'after' fragments will simply be inserted at all applicable waypoints.</span> +<span class="Comment">//: at special labels called 'waypoints' using two new top-level commands:</span> +<span class="Comment">//: before</span> +<span class="Comment">//: after</span> + +<span class="Comment">//: Most labels are local: they must be unique to a recipe, and are invisible</span> +<span class="Comment">//: outside the recipe. However, waypoints are global: a recipe can have</span> +<span class="Comment">//: multiple of them, you can't use them as jump targets.</span> +<span class="Delimiter">:(before "End is_jump_target Special-cases")</span> +<span class="Normal">if</span> <span class="Delimiter">(</span>is_waypoint<span class="Delimiter">(</span>label<span class="Delimiter">))</span> <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> <span class="Comment">//: Waypoints are always surrounded by '<>', e.g. <handle-request>.</span> -<span class="Comment">//:</span> -<span class="Comment">//: todo: switch recipe.steps to a more efficient data structure.</span> +<span class="Delimiter">:(code)</span> +<span class="Normal">bool</span> is_waypoint<span class="Delimiter">(</span>string label<span class="Delimiter">)</span> <span class="Delimiter">{</span> + <span class="Identifier">return</span> *label<span class="Delimiter">.</span>begin<span class="Delimiter">()</span> == <span class="Constant">'<'</span> && *label<span class="Delimiter">.</span>rbegin<span class="Delimiter">()</span> == <span class="Constant">'>'</span><span class="Delimiter">;</span> +<span class="Delimiter">}</span> <span class="Delimiter">:(scenario tangle_before)</span> <span class="muRecipe">def</span> main [ @@ -80,7 +88,7 @@ Fragments_used<span class="Delimiter">.</span>clear<span class="Delimiter">();</ <span class="Normal">if</span> <span class="Delimiter">(</span>is_waypoint<span class="Delimiter">(</span>label<span class="Delimiter">))</span> Before_fragments[label]<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>Before_fragments[label]<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>end<span class="Delimiter">(),</span> tmp<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> tmp<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>end<span class="Delimiter">());</span> <span class="Normal">else</span> - raise << <span class="Constant">"can't tangle before label "</span> << label << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> + raise << <span class="Constant">"can't tangle before non-waypoint "</span> << label << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span class="Comment">// End before Command Handler</span> <span class="Delimiter">}</span> <span class="Normal">else</span> <span class="Normal">if</span> <span class="Delimiter">(</span>command == <span class="Constant">"after"</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -95,7 +103,7 @@ Fragments_used<span class="Delimiter">.</span>clear<span class="Delimiter">();</ <span class="Normal">if</span> <span class="Delimiter">(</span>is_waypoint<span class="Delimiter">(</span>label<span class="Delimiter">))</span> After_fragments[label]<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>insert<span class="Delimiter">(</span>After_fragments[label]<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> tmp<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> tmp<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>end<span class="Delimiter">());</span> <span class="Normal">else</span> - raise << <span class="Constant">"can't tangle after label "</span> << label << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> + raise << <span class="Constant">"can't tangle after non-waypoint "</span> << label << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span class="Comment">// End after Command Handler</span> <span class="Delimiter">}</span> @@ -176,18 +184,13 @@ tangle_done = <span class="Constant">false</span><span class="Delimiter">;</span <span class="Delimiter">}</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> j = <span class="Constant">0</span><span class="Delimiter">;</span> j < SIZE<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++j<span class="Delimiter">)</span> <span class="Delimiter">{</span> reagent& x = inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>j<span class="Delimiter">);</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>!is_literal<span class="Delimiter">(</span>x<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>x<span class="Delimiter">.</span>type<span class="Delimiter">-></span>name == <span class="Constant">"label"</span> && contains_key<span class="Delimiter">(</span>jump_targets<span class="Delimiter">,</span> x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>is_jump_target<span class="Delimiter">(</span>x<span class="Delimiter">.</span>name<span class="Delimiter">)</span> && contains_key<span class="Delimiter">(</span>jump_targets<span class="Delimiter">,</span> x<span class="Delimiter">.</span>name<span class="Delimiter">))</span> x<span class="Delimiter">.</span>name = prefix+x<span class="Delimiter">.</span>name<span class="Delimiter">;</span> <span class="Delimiter">}</span> base<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>inst<span class="Delimiter">);</span> <span class="Delimiter">}</span> <span class="Delimiter">}</span> -<span class="Normal">bool</span> is_waypoint<span class="Delimiter">(</span>string label<span class="Delimiter">)</span> <span class="Delimiter">{</span> - <span class="Identifier">return</span> *label<span class="Delimiter">.</span>begin<span class="Delimiter">()</span> == <span class="Constant">'<'</span> && *label<span class="Delimiter">.</span>rbegin<span class="Delimiter">()</span> == <span class="Constant">'>'</span><span class="Delimiter">;</span> -<span class="Delimiter">}</span> - <span class="Comment">//: complain about unapplied fragments</span> <span class="Comment">//: This can't run during transform because later (shape-shifting recipes)</span> <span class="Comment">//: we'll encounter situations where fragments might get used long after</span> @@ -238,7 +241,7 @@ $mem: <span class="Constant">4</span> <span class="muRecipe">before</span> +label1 [ <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">0</span> ] -<span class="traceContains">+error: can't tangle before label +label1</span> +<span class="traceContains">+error: can't tangle before non-waypoint +label1</span> <span class="Delimiter">:(scenario tangle_keeps_labels_separate)</span> <span class="muRecipe">def</span> main [ diff --git a/html/053recipe_header.cc.html b/html/053recipe_header.cc.html index 69b77f7f..d379b46a 100644 --- a/html/053recipe_header.cc.html +++ b/html/053recipe_header.cc.html @@ -458,7 +458,7 @@ Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</spa Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>fill_in_reply_ingredients<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span class="Delimiter">:(code)</span> -<span class="Normal">void</span> fill_in_reply_ingredients<span class="Delimiter">(</span>recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="Normal">void</span> fill_in_reply_ingredients<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> recipe& caller_recipe = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!caller_recipe<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> trace<span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- fill in reply ingredients from header for recipe "</span> << caller_recipe<span class="Delimiter">.</span>name << end<span class="Delimiter">();</span> @@ -559,6 +559,49 @@ Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</spa ] <span class="traceContains">+error: main: '3:num <- add2 1:num, 2:num' should write to '1:num' rather than '3:num'</span> +<span class="Comment">//: One special-case is recipe 'main'. Make sure it's only ever taking in text</span> +<span class="Comment">//: ingredients, and returning a single number.</span> + +<span class="Delimiter">:(scenario recipe_header_ingredients_constrained_for_main)</span> +<span class="Special">% Hide_errors = true;</span> +<span class="muRecipe">def</span> main x:num [ +] +<span class="traceContains">+error: ingredients of recipe 'main' must all be text (address:array:character)</span> + +<span class="Delimiter">:(scenario recipe_header_products_constrained_for_main)</span> +<span class="Special">% Hide_errors = true;</span> +<span class="muRecipe">def</span> main<span class="muRecipe"> -> </span>x:text [ +] +<span class="traceContains">+error: recipe 'main' must return at most a single product, a number</span> + +<span class="Delimiter">:(scenario recipe_header_products_constrained_for_main_2)</span> +<span class="Special">% Hide_errors = true;</span> +<span class="muRecipe">def</span> main<span class="muRecipe"> -> </span>x:num<span class="Delimiter">,</span> y:num [ +] +<span class="traceContains">+error: recipe 'main' must return at most a single product, a number</span> + +<span class="Delimiter">:(after "Transform.push_back(expand_type_abbreviations)")</span> +Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_recipe_header_constraints<span class="Delimiter">);</span> +<span class="Delimiter">:(code)</span> +<span class="Normal">void</span> check_recipe_header_constraints<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> + <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name != <span class="Constant">"main"</span><span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>!caller<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Identifier">return</span><span class="Delimiter">;</span> + reagent<span class="Comment">/*</span><span class="Comment">local</span><span class="Comment">*/</span> expected_ingredient<span class="Delimiter">(</span><span class="Constant">"x:address:array:character"</span><span class="Delimiter">);</span> + <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>!types_strictly_match<span class="Delimiter">(</span>expected_ingredient<span class="Delimiter">,</span> caller<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> <span class="Delimiter">{</span> + raise << <span class="Constant">"ingredients of recipe 'main' must all be text (address:array:character)</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> + <span class="Delimiter">}</span> + <span class="Normal">int</span> nprod = SIZE<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>products<span class="Delimiter">);</span> + reagent<span class="Comment">/*</span><span class="Comment">local</span><span class="Comment">*/</span> expected_product<span class="Delimiter">(</span><span class="Constant">"x:number"</span><span class="Delimiter">);</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>nprod > <span class="Constant">1</span> + || <span class="Delimiter">(</span>nprod == <span class="Constant">1</span> && !types_strictly_match<span class="Delimiter">(</span>expected_product<span class="Delimiter">,</span> caller<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))))</span> <span class="Delimiter">{</span> + raise << <span class="Constant">"recipe 'main' must return at most a single product, a number</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + <span class="Delimiter">}</span> +<span class="Delimiter">}</span> + <span class="Delimiter">:(before "End Includes")</span> <span class="Normal">using</span> std::min<span class="Delimiter">;</span> <span class="Normal">using</span> std::max<span class="Delimiter">;</span> diff --git a/html/054static_dispatch.cc.html b/html/054static_dispatch.cc.html index 62674558..eee71984 100644 --- a/html/054static_dispatch.cc.html +++ b/html/054static_dispatch.cc.html @@ -187,7 +187,7 @@ Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</spa list<call> resolve_stack<span class="Delimiter">;</span> <span class="Delimiter">:(code)</span> -<span class="Normal">void</span> resolve_ambiguous_calls<span class="Delimiter">(</span>recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="Normal">void</span> resolve_ambiguous_calls<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> recipe& caller_recipe = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> trace<span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- resolve ambiguous calls for recipe "</span> << caller_recipe<span class="Delimiter">.</span>name << end<span class="Delimiter">();</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> index = <span class="Constant">0</span><span class="Delimiter">;</span> index < SIZE<span class="Delimiter">(</span>caller_recipe<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span> @@ -595,7 +595,7 @@ $error: <span class="Constant">0</span> <span class="traceContains">+mem: storing 35 in location 1</span> <span class="Delimiter">:(code)</span> -string header_label<span class="Delimiter">(</span>recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +string header_label<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Identifier">return</span> header_label<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">));</span> <span class="Delimiter">}</span> string header_label<span class="Delimiter">(</span><span class="Normal">const</span> recipe& caller<span class="Delimiter">)</span> <span class="Delimiter">{</span> diff --git a/html/057immutable.cc.html b/html/057immutable.cc.html index 305eaede..ac57964f 100644 --- a/html/057immutable.cc.html +++ b/html/057immutable.cc.html @@ -374,7 +374,7 @@ $error: <span class="Constant">0</span> Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>check_immutable_ingredients<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span class="Delimiter">:(code)</span> -<span class="Normal">void</span> check_immutable_ingredients<span class="Delimiter">(</span>recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="Normal">void</span> check_immutable_ingredients<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Comment">// to ensure an address reagent isn't modified, it suffices to show that</span> <span class="Comment">// a) we never write to its contents directly,</span> <span class="Comment">// b) we never call 'put' or 'put-index' on it, and</span> @@ -520,7 +520,7 @@ set<<span class="Normal">int</span>> scan_contained_in_product_indices<spa <span class="Delimiter">}</span> <span class="Delimiter">}</span> -<span class="Normal">bool</span> is_modified_in_recipe<span class="Delimiter">(</span>recipe_ordinal r<span class="Delimiter">,</span> <span class="Normal">int</span> ingredient_index<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& caller<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="Normal">bool</span> is_modified_in_recipe<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">,</span> <span class="Normal">const</span> <span class="Normal">int</span> ingredient_index<span class="Delimiter">,</span> <span class="Normal">const</span> recipe& caller<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Normal">const</span> recipe& callee = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!callee<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Delimiter">{</span> raise << maybe<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"can't check mutability of ingredients in recipe "</span> << callee<span class="Delimiter">.</span>name << <span class="Constant">" because it uses 'next-ingredient' directly, rather than a recipe header.</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> diff --git a/html/060rewrite_literal_string.cc.html b/html/060rewrite_literal_string.cc.html index c1af6377..a2e46f7c 100644 --- a/html/060rewrite_literal_string.cc.html +++ b/html/060rewrite_literal_string.cc.html @@ -47,7 +47,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">:(before "End Instruction Inserting/Deleting Transforms")</span> initialize_transform_rewrite_literal_string_to_text<span class="Delimiter">();</span> -Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>rewrite_literal_string_to_text<span class="Delimiter">);</span> +Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>rewrite_literal_string_to_text<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span class="Delimiter">:(before "End Globals")</span> set<string> recipes_taking_literal_strings<span class="Delimiter">;</span> @@ -68,7 +68,7 @@ set<string> recipes_taking_literal_strings<span class="Delimiter">;</span> <span class="Comment">// End initialize_transform_rewrite_literal_string_to_text()</span> <span class="Delimiter">}</span> -<span class="Normal">void</span> rewrite_literal_string_to_text<span class="Delimiter">(</span>recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="Normal">void</span> rewrite_literal_string_to_text<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> trace<span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- rewrite literal strings in recipe "</span> << caller<span class="Delimiter">.</span>name << end<span class="Delimiter">();</span> <span class="Normal">if</span> <span class="Delimiter">(</span>contains_numeric_locations<span class="Delimiter">(</span>caller<span class="Delimiter">))</span> <span class="Identifier">return</span><span class="Delimiter">;</span> diff --git a/html/061text.mu.html b/html/061text.mu.html index 11271ed6..75e509fa 100644 --- a/html/061text.mu.html +++ b/html/061text.mu.html @@ -540,7 +540,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">{</span> <span class="Comment"># while i < template.length</span> tem-done?:bool<span class="Special"> <- </span>greater-or-equal i, tem-len - <span class="muControl">break-if</span> tem-done?, <span class="Constant">+done:label</span> + <span class="muControl">break-if</span> tem-done?, +done <span class="Comment"># while template[i] != '_'</span> in:char<span class="Special"> <- </span>index *template, i underscore?:bool<span class="Special"> <- </span>equal in, <span class="Constant">95/_</span> diff --git a/html/062convert_ingredients_to_text.cc.html b/html/062convert_ingredients_to_text.cc.html index 10dea3c6..bb867081 100644 --- a/html/062convert_ingredients_to_text.cc.html +++ b/html/062convert_ingredients_to_text.cc.html @@ -89,10 +89,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment">//: misplaced; should be in instruction inserting/deleting transforms, but has</span> <span class="Comment">//: prerequisites: deduce_types_from_header and check_or_set_types_by_name</span> <span class="Delimiter">:(after "Transform.push_back(deduce_types_from_header)")</span> -Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>convert_ingredients_to_text<span class="Delimiter">);</span> +Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>convert_ingredients_to_text<span class="Delimiter">);</span> <span class="Comment">// idempotent</span> <span class="Delimiter">:(code)</span> -<span class="Normal">void</span> convert_ingredients_to_text<span class="Delimiter">(</span>recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="Normal">void</span> convert_ingredients_to_text<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> trace<span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">"transform"</span><span class="Delimiter">)</span> << <span class="Constant">"--- convert some ingredients to text in recipe "</span> << caller<span class="Delimiter">.</span>name << end<span class="Delimiter">();</span> <span class="Comment">// in recipes without named locations, 'stash' is still not extensible</span> diff --git a/html/071recipe.cc.html b/html/071recipe.cc.html index c0cb48a1..2a63b5e8 100644 --- a/html/071recipe.cc.html +++ b/html/071recipe.cc.html @@ -196,24 +196,38 @@ Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</spa <span class="Normal">const</span> recipe& caller = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">);</span> <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < SIZE<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> <span class="Normal">const</span> instruction& inst = caller<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">);</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation != CALL<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// error raised above</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// if indirect call, error raised above</span> <span class="Normal">const</span> reagent& callee = inst<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="Normal">if</span> <span class="Delimiter">(</span>!is_mu_recipe<span class="Delimiter">(</span>callee<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// error raised above</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>!is_mu_recipe<span class="Delimiter">(</span>callee<span class="Delimiter">))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> <span class="Comment">// if indirect call, error raised above</span> <span class="Normal">const</span> recipe callee_header = is_literal<span class="Delimiter">(</span>callee<span class="Delimiter">)</span> ? get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> callee<span class="Delimiter">.</span>value<span class="Delimiter">)</span> : from_reagent<span class="Delimiter">(</span>inst<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="Normal">if</span> <span class="Delimiter">(</span>!callee_header<span class="Delimiter">.</span>has_header<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> - <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">long</span> <span class="Normal">int</span> i = <span class="Comment">/*</span><span class="Comment">skip callee</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> i < min<span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">),</span> SIZE<span class="Delimiter">(</span>callee_header<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span>+<span class="Comment">/*</span><span class="Comment">skip callee</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>callee_header<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i-<span class="Comment">/*</span><span class="Comment">skip callee</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">),</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> - raise << maybe<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"ingredient "</span> << i-<span class="Comment">/*</span><span class="Comment">skip callee</span><span class="Comment">*/</span><span class="Constant">1</span> << <span class="Constant">" has the wrong type at '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>is_indirect_call_with_ingredients<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> + <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">long</span> <span class="Normal">int</span> i = <span class="Comment">/*</span><span class="Comment">skip callee</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">;</span> i < min<span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">),</span> SIZE<span class="Delimiter">(</span>callee_header<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span>+<span class="Comment">/*</span><span class="Comment">skip callee</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">);</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>callee_header<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i-<span class="Comment">/*</span><span class="Comment">skip callee</span><span class="Comment">*/</span><span class="Constant">1</span><span class="Delimiter">),</span> inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> + raise << maybe<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"ingredient "</span> << i-<span class="Comment">/*</span><span class="Comment">skip callee</span><span class="Comment">*/</span><span class="Constant">1</span> << <span class="Constant">" has the wrong type at '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + <span class="Delimiter">}</span> <span class="Delimiter">}</span> - <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">long</span> <span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < min<span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">),</span> SIZE<span class="Delimiter">(</span>callee_header<span class="Delimiter">.</span>products<span class="Delimiter">));</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>is_dummy<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>callee_header<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> - raise << maybe<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"product "</span> << i << <span class="Constant">" has the wrong type at '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>is_indirect_call_with_products<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation<span class="Delimiter">))</span> <span class="Delimiter">{</span> + <span class="Normal">for</span> <span class="Delimiter">(</span><span class="Normal">long</span> <span class="Normal">int</span> i = <span class="Constant">0</span><span class="Delimiter">;</span> i < min<span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">),</span> SIZE<span class="Delimiter">(</span>callee_header<span class="Delimiter">.</span>products<span class="Delimiter">));</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>is_dummy<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> <span class="Identifier">continue</span><span class="Delimiter">;</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>!types_coercible<span class="Delimiter">(</span>callee_header<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">),</span> inst<span class="Delimiter">.</span>products<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">)))</span> + raise << maybe<span class="Delimiter">(</span>caller<span class="Delimiter">.</span>name<span class="Delimiter">)</span> << <span class="Constant">"product "</span> << i << <span class="Constant">" has the wrong type at '"</span> << inst<span class="Delimiter">.</span>original_string << <span class="Constant">"'</span><span class="cSpecial">\n</span><span class="Constant">"</span> << end<span class="Delimiter">();</span> + <span class="Delimiter">}</span> <span class="Delimiter">}</span> <span class="Delimiter">}</span> <span class="Delimiter">}</span> +<span class="Normal">bool</span> is_indirect_call_with_ingredients<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>r == CALL<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span> + <span class="Comment">// End is_indirect_call_with_ingredients Special-cases</span> + <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> +<span class="Delimiter">}</span> +<span class="Normal">bool</span> is_indirect_call_with_products<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> + <span class="Normal">if</span> <span class="Delimiter">(</span>r == CALL<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span> + <span class="Comment">// End is_indirect_call_with_products Special-cases</span> + <span class="Identifier">return</span> <span class="Constant">false</span><span class="Delimiter">;</span> +<span class="Delimiter">}</span> + <span class="muRecipe">recipe</span> from_reagent<span class="Delimiter">(</span><span class="Normal">const</span> reagent& r<span class="Delimiter">)</span> <span class="Delimiter">{</span> assert<span class="Delimiter">(</span>r<span class="Delimiter">.</span>type<span class="Delimiter">);</span> recipe result_header<span class="Delimiter">;</span> <span class="Comment">// will contain only ingredients and products, nothing else</span> diff --git a/html/072scheduler.cc.html b/html/072scheduler.cc.html index 955d5c1b..7d1734cf 100644 --- a/html/072scheduler.cc.html +++ b/html/072scheduler.cc.html @@ -90,8 +90,8 @@ vector<routine*> Routines<span class="Delimiter">;</span> <span class="Delimiter">:(before "End Setup")</span> Scheduling_interval = <span class="Constant">500</span><span class="Delimiter">;</span> Routines<span class="Delimiter">.</span>clear<span class="Delimiter">();</span> -<span class="Delimiter">:(replace{} "void run(recipe_ordinal r)")</span> -<span class="Normal">void</span> run<span class="Delimiter">(</span>recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> +<span class="Delimiter">:(replace{} "void run(const recipe_ordinal r)")</span> +<span class="Normal">void</span> run<span class="Delimiter">(</span><span class="Normal">const</span> recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span> run<span class="Delimiter">(</span><span class="Normal">new</span> routine<span class="Delimiter">(</span>r<span class="Delimiter">));</span> <span class="Delimiter">}</span> @@ -276,6 +276,21 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span ] <span class="traceContains">+mem: storing 4 in location 2</span> +<span class="Comment">//: type-checking for 'start-running'</span> + +<span class="Delimiter">:(scenario start_running_checks_types)</span> +<span class="Special">% Hide_errors = true;</span> +<span class="muRecipe">def</span> f1 [ + start-running f2<span class="Delimiter">,</span> <span class="Constant">3</span> +] +<span class="muRecipe">def</span> f2 n:&:num [ +] +<span class="traceContains">+error: f1: ingredient 0 has the wrong type at 'start-running f2, 3'</span> + +<span class="Comment">// 'start-running' only uses the ingredients of the callee, not its products</span> +<span class="Delimiter">:(before "End is_indirect_call_with_ingredients Special-cases")</span> +<span class="Normal">if</span> <span class="Delimiter">(</span>r == START_RUNNING<span class="Delimiter">)</span> <span class="Identifier">return</span> <span class="Constant">true</span><span class="Delimiter">;</span> + <span class="Comment">//: more complex: refcounting management when starting up new routines</span> <span class="Delimiter">:(scenario start_running_immediately_updates_refcounts_of_ingredients)</span> diff --git a/html/075channel.mu.html b/html/075channel.mu.html index eda9e8da..940540d6 100644 --- a/html/075channel.mu.html +++ b/html/075channel.mu.html @@ -440,7 +440,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color *line<span class="Special"> <- </span>put *line, <span class="Constant">length:offset</span>, buffer-length <span class="Delimiter">}</span> <span class="Comment"># and don't append this one</span> - <span class="muControl">loop</span> <span class="Constant">+next-character:label</span> + <span class="muControl">loop</span> +next-character <span class="Delimiter">}</span> <span class="Comment"># append anything else</span> line<span class="Special"> <- </span>append line, c diff --git a/html/chessboard.mu.html b/html/chessboard.mu.html index d4fd58da..7f89f457 100644 --- a/html/chessboard.mu.html +++ b/html/chessboard.mu.html @@ -126,7 +126,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color cursor-to-next-line screen screen<span class="Special"> <- </span>print screen, <span class="Constant">[move: ]</span> m:&:move, quit:bool, error:bool<span class="Special"> <- </span>read-move buffered-stdin-in, screen - <span class="muControl">break-if</span> quit, <span class="Constant">+quit:label</span> + <span class="muControl">break-if</span> quit, +quit buffered-stdin-in<span class="Special"> <- </span>clear buffered-stdin-in <span class="Comment"># cleanup after error. todo: test this?</span> <span class="muControl">loop-if</span> error <span class="Delimiter">}</span> diff --git a/html/edit/001-editor.mu.html b/html/edit/001-editor.mu.html index 35adc47e..2f07e8eb 100644 --- a/html/edit/001-editor.mu.html +++ b/html/edit/001-editor.mu.html @@ -215,7 +215,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color screen<span class="Special"> <- </span>move-cursor screen, row, column curr<span class="Special"> <- </span>next curr prev<span class="Special"> <- </span>next prev - <span class="muControl">loop</span> <span class="Constant">+next-character:label</span> + <span class="muControl">loop</span> +next-character <span class="Delimiter">}</span> <span class="Delimiter">{</span> <span class="Comment"># at right? wrap. even if there's only one more letter left; we need</span> @@ -229,7 +229,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color row<span class="Special"> <- </span>add row, <span class="Constant">1</span> screen<span class="Special"> <- </span>move-cursor screen, row, column <span class="Comment"># don't increment curr</span> - <span class="muControl">loop</span> <span class="Constant">+next-character:label</span> + <span class="muControl">loop</span> +next-character <span class="Delimiter">}</span> print screen, c, color curr<span class="Special"> <- </span>next curr @@ -449,7 +449,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">break-unless</span> starting-comment? trace <span class="Constant">90</span>, <span class="Constant">[app]</span>, <span class="Constant">[switch color back to blue]</span> color<span class="Special"> <- </span>copy <span class="Constant">12/lightblue</span> - <span class="muControl">jump</span> <span class="Constant">+exit:label</span> + <span class="muControl">jump</span> +exit <span class="Delimiter">}</span> <span class="Comment"># if color is blue and next character is newline, switch color to white</span> <span class="Delimiter">{</span> @@ -459,7 +459,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">break-unless</span> ending-comment? trace <span class="Constant">90</span>, <span class="Constant">[app]</span>, <span class="Constant">[switch color back to white]</span> color<span class="Special"> <- </span>copy <span class="Constant">7/white</span> - <span class="muControl">jump</span> <span class="Constant">+exit:label</span> + <span class="muControl">jump</span> +exit <span class="Delimiter">}</span> <span class="Comment"># if color is white (no comments) and next character is '<', switch color to red</span> <span class="Delimiter">{</span> @@ -467,7 +467,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color starting-assignment?:bool<span class="Special"> <- </span>equal c, <span class="Constant">60/<</span> <span class="muControl">break-unless</span> starting-assignment? color<span class="Special"> <- </span>copy <span class="Constant">1/red</span> - <span class="muControl">jump</span> <span class="Constant">+exit:label</span> + <span class="muControl">jump</span> +exit <span class="Delimiter">}</span> <span class="Comment"># if color is red and next character is space, switch color to white</span> <span class="Delimiter">{</span> @@ -476,7 +476,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ending-assignment?:bool<span class="Special"> <- </span>equal c, <span class="Constant">32/space</span> <span class="muControl">break-unless</span> ending-assignment? color<span class="Special"> <- </span>copy <span class="Constant">7/white</span> - <span class="muControl">jump</span> <span class="Constant">+exit:label</span> + <span class="muControl">jump</span> +exit <span class="Delimiter">}</span> <span class="Comment"># otherwise no change</span> <span class="Constant"> +exit</span> diff --git a/html/edit/002-typing.mu.html b/html/edit/002-typing.mu.html index 256f1805..a84266ca 100644 --- a/html/edit/002-typing.mu.html +++ b/html/edit/002-typing.mu.html @@ -64,7 +64,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">{</span> <span class="muControl">break-unless</span> is-touch? move-cursor-in-editor screen, editor, t - <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="muControl">loop</span> +next-event <span class="Delimiter">}</span> <span class="Comment"># keyboard events</span> <span class="Delimiter">{</span> @@ -160,7 +160,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color column<span class="Special"> <- </span>copy left curr<span class="Special"> <- </span>next curr prev<span class="Special"> <- </span>next prev - <span class="muControl">loop</span> <span class="Constant">+next-character:label</span> + <span class="muControl">loop</span> +next-character <span class="Delimiter">}</span> <span class="Delimiter">{</span> <span class="Comment"># at right? wrap. even if there's only one more letter left; we need</span> @@ -170,7 +170,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color column<span class="Special"> <- </span>copy left row<span class="Special"> <- </span>add row, <span class="Constant">1</span> <span class="Comment"># don't increment curr/prev</span> - <span class="muControl">loop</span> <span class="Constant">+next-character:label</span> + <span class="muControl">loop</span> +next-character <span class="Delimiter">}</span> curr<span class="Special"> <- </span>next curr prev<span class="Special"> <- </span>next prev diff --git a/html/edit/003-shortcuts.mu.html b/html/edit/003-shortcuts.mu.html index e9ec2f4d..ec91efbd 100644 --- a/html/edit/003-shortcuts.mu.html +++ b/html/edit/003-shortcuts.mu.html @@ -1276,7 +1276,7 @@ d] no-motion?:bool<span class="Special"> <- </span>equal next-line, before-cursor <span class="muControl">break-unless</span> no-motion? scroll?:bool<span class="Special"> <- </span>greater-than cursor-row, <span class="Constant">1</span> - <span class="muControl">break-if</span> scroll?, <span class="Constant">+try-to-scroll:label</span> + <span class="muControl">break-if</span> scroll?, +try-to-scroll go-render?<span class="Special"> <- </span>copy <span class="Constant">0/false</span> <span class="muControl">return</span> <span class="Delimiter">}</span> diff --git a/html/edit/004-programming-environment.mu.html b/html/edit/004-programming-environment.mu.html index 155ac14d..0fa7c5d2 100644 --- a/html/edit/004-programming-environment.mu.html +++ b/html/edit/004-programming-environment.mu.html @@ -120,7 +120,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># todo: test this</span> touch-type:num<span class="Special"> <- </span>get t, <span class="Constant">type:offset</span> is-left-click?:bool<span class="Special"> <- </span>equal touch-type, <span class="Constant">65513/mouse-left</span> - <span class="muControl">loop-unless</span> is-left-click?, <span class="Constant">+next-event:label</span> + <span class="muControl">loop-unless</span> is-left-click?, +next-event click-row:num<span class="Special"> <- </span>get t, <span class="Constant">row:offset</span> click-column:num<span class="Special"> <- </span>get t, <span class="Constant">column:offset</span> <span class="Comment"># later exceptions for non-editor touches will go here</span> @@ -130,7 +130,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color sandbox-in-focus?:bool<span class="Special"> <- </span>move-cursor-in-editor screen, current-sandbox, t *env<span class="Special"> <- </span>put *env, <span class="Constant">sandbox-in-focus?:offset</span>, sandbox-in-focus? screen<span class="Special"> <- </span>update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env - <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="muControl">loop</span> +next-event <span class="Delimiter">}</span> <span class="Comment"># 'resize' event - redraw editor</span> <span class="Comment"># todo: test this after supporting resize in assume-console</span> @@ -149,7 +149,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color screen<span class="Special"> <- </span>render-all screen, env, render-without-moving-cursor render-all-on-no-more-events?<span class="Special"> <- </span>copy <span class="Constant">0/false</span> <span class="Comment"># full render done</span> <span class="Delimiter">}</span> - <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="muControl">loop</span> +next-event <span class="Delimiter">}</span> <span class="Comment"># if it's not global and not a touch event, send to appropriate editor</span> <span class="Delimiter">{</span> @@ -164,7 +164,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">{</span> <span class="muControl">break-unless</span> more-events? render-all-on-no-more-events?<span class="Special"> <- </span>copy <span class="Constant">1/true</span> <span class="Comment"># no rendering now, full rendering on some future event</span> - <span class="muControl">jump</span> <span class="Constant">+finish-event:label</span> + <span class="muControl">jump</span> +finish-event <span class="Delimiter">}</span> <span class="Delimiter">{</span> <span class="muControl">break-if</span> more-events? @@ -173,13 +173,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># no more events, and we have to force render</span> screen<span class="Special"> <- </span>render-all screen, env, render render-all-on-no-more-events?<span class="Special"> <- </span>copy <span class="Constant">0/false</span> - <span class="muControl">jump</span> <span class="Constant">+finish-event:label</span> + <span class="muControl">jump</span> +finish-event <span class="Delimiter">}</span> <span class="Comment"># no more events, no force render</span> <span class="Delimiter">{</span> <span class="muControl">break-unless</span> render? screen<span class="Special"> <- </span>render-recipes screen, env, render - <span class="muControl">jump</span> <span class="Constant">+finish-event:label</span> + <span class="muControl">jump</span> +finish-event <span class="Delimiter">}</span> <span class="Delimiter">}</span> <span class="Delimiter">}</span> @@ -192,7 +192,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">{</span> <span class="muControl">break-unless</span> more-events? render-all-on-no-more-events?<span class="Special"> <- </span>copy <span class="Constant">1/true</span> <span class="Comment"># no rendering now, full rendering on some future event</span> - <span class="muControl">jump</span> <span class="Constant">+finish-event:label</span> + <span class="muControl">jump</span> +finish-event <span class="Delimiter">}</span> <span class="Delimiter">{</span> <span class="muControl">break-if</span> more-events? @@ -201,13 +201,13 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># no more events, and we have to force render</span> screen<span class="Special"> <- </span>render-all screen, env, render render-all-on-no-more-events?<span class="Special"> <- </span>copy <span class="Constant">0/false</span> - <span class="muControl">jump</span> <span class="Constant">+finish-event:label</span> + <span class="muControl">jump</span> +finish-event <span class="Delimiter">}</span> <span class="Comment"># no more events, no force render</span> <span class="Delimiter">{</span> <span class="muControl">break-unless</span> render? screen<span class="Special"> <- </span>render-sandbox-side screen, env, render - <span class="muControl">jump</span> <span class="Constant">+finish-event:label</span> + <span class="muControl">jump</span> +finish-event <span class="Delimiter">}</span> <span class="Delimiter">}</span> <span class="Delimiter">}</span> @@ -298,7 +298,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color screen<span class="Special"> <- </span>move-cursor screen, row, column curr<span class="Special"> <- </span>next curr prev<span class="Special"> <- </span>next prev - <span class="muControl">loop</span> <span class="Constant">+next-character:label</span> + <span class="muControl">loop</span> +next-character <span class="Delimiter">}</span> <span class="Delimiter">{</span> <span class="Comment"># at right? wrap. even if there's only one more letter left; we need</span> @@ -312,7 +312,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color row<span class="Special"> <- </span>add row, <span class="Constant">1</span> screen<span class="Special"> <- </span>move-cursor screen, row, column <span class="Comment"># don't increment curr</span> - <span class="muControl">loop</span> <span class="Constant">+next-character:label</span> + <span class="muControl">loop</span> +next-character <span class="Delimiter">}</span> print screen, c, color curr<span class="Special"> <- </span>next curr @@ -599,7 +599,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color column<span class="Special"> <- </span>copy left row<span class="Special"> <- </span>add row, <span class="Constant">1</span> screen<span class="Special"> <- </span>move-cursor screen, row, column - <span class="muControl">loop</span> <span class="Constant">+next-character:label</span> <span class="Comment"># retry i</span> + <span class="muControl">loop</span> +next-character <span class="Comment"># retry i</span> <span class="Delimiter">}</span> i<span class="Special"> <- </span>add i, <span class="Constant">1</span> <span class="Delimiter">{</span> @@ -618,7 +618,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color row<span class="Special"> <- </span>add row, <span class="Constant">1</span> column<span class="Special"> <- </span>copy left screen<span class="Special"> <- </span>move-cursor screen, row, column - <span class="muControl">loop</span> <span class="Constant">+next-character:label</span> + <span class="muControl">loop</span> +next-character <span class="Delimiter">}</span> print screen, c, color column<span class="Special"> <- </span>add column, <span class="Constant">1</span> @@ -641,7 +641,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">break-unless</span> redraw-screen? screen<span class="Special"> <- </span>render-all screen, env:&:environment, render sync-screen screen - <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="muControl">loop</span> +next-event <span class="Delimiter">}</span> ] @@ -656,7 +656,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color sandbox-in-focus?<span class="Special"> <- </span>not sandbox-in-focus? *env<span class="Special"> <- </span>put *env, <span class="Constant">sandbox-in-focus?:offset</span>, sandbox-in-focus? screen<span class="Special"> <- </span>update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env - <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="muControl">loop</span> +next-event <span class="Delimiter">}</span> ] diff --git a/html/edit/005-sandbox.mu.html b/html/edit/005-sandbox.mu.html index a1a87d1c..80650ce9 100644 --- a/html/edit/005-sandbox.mu.html +++ b/html/edit/005-sandbox.mu.html @@ -172,7 +172,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color screen<span class="Special"> <- </span>update-status screen, <span class="Constant">[ ]</span>, <span class="Constant">245/grey</span> <span class="Delimiter">}</span> screen<span class="Special"> <- </span>update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env - <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="muControl">loop</span> +next-event <span class="Delimiter">}</span> ] @@ -415,7 +415,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color column<span class="Special"> <- </span>copy left row<span class="Special"> <- </span>add row, <span class="Constant">1</span> screen<span class="Special"> <- </span>move-cursor screen, row, column - <span class="muControl">loop</span> <span class="Constant">+next-character:label</span> <span class="Comment"># retry i</span> + <span class="muControl">loop</span> +next-character <span class="Comment"># retry i</span> <span class="Delimiter">}</span> i<span class="Special"> <- </span>add i, <span class="Constant">1</span> <span class="Delimiter">{</span> @@ -434,7 +434,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color row<span class="Special"> <- </span>add row, <span class="Constant">1</span> column<span class="Special"> <- </span>copy left screen<span class="Special"> <- </span>move-cursor screen, row, column - <span class="muControl">loop</span> <span class="Constant">+next-character:label</span> + <span class="muControl">loop</span> +next-character <span class="Delimiter">}</span> print screen, c, color column<span class="Special"> <- </span>add column, <span class="Constant">1</span> @@ -741,7 +741,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">break-unless</span> at-bottom-of-editor? more-to-scroll?:bool<span class="Special"> <- </span>more-to-scroll? env, screen <span class="muControl">break-if</span> more-to-scroll? - <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="muControl">loop</span> +next-event <span class="Delimiter">}</span> <span class="Delimiter">{</span> <span class="muControl">break-if</span> sandbox-in-focus? @@ -749,7 +749,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">break-unless</span> page-down? more-to-scroll?:bool<span class="Special"> <- </span>more-to-scroll? env, screen <span class="muControl">break-if</span> more-to-scroll? - <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="muControl">loop</span> +next-event <span class="Delimiter">}</span> ] @@ -760,7 +760,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">break-unless</span> page-down? more-to-scroll?:bool<span class="Special"> <- </span>more-to-scroll? env, screen <span class="muControl">break-if</span> more-to-scroll? - <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="muControl">loop</span> +next-event <span class="Delimiter">}</span> ] @@ -898,14 +898,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color number-of-sandboxes:num<span class="Special"> <- </span>get *env, <span class="Constant">number-of-sandboxes:offset</span> max:num<span class="Special"> <- </span>subtract number-of-sandboxes, <span class="Constant">1</span> at-end?:bool<span class="Special"> <- </span>greater-or-equal render-from, max - <span class="muControl">jump-if</span> at-end?, <span class="Constant">+finish-event:label</span> <span class="Comment"># render nothing</span> + <span class="muControl">jump-if</span> at-end?, +finish-event <span class="Comment"># render nothing</span> render-from<span class="Special"> <- </span>add render-from, <span class="Constant">1</span> *env<span class="Special"> <- </span>put *env, <span class="Constant">render-from:offset</span>, render-from <span class="Delimiter">}</span> hide-screen screen screen<span class="Special"> <- </span>render-sandbox-side screen, env, render show-screen screen - <span class="muControl">jump</span> <span class="Constant">+finish-event:label</span> + <span class="muControl">jump</span> +finish-event <span class="Delimiter">}</span> ] @@ -936,7 +936,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color hide-screen screen screen<span class="Special"> <- </span>render-sandbox-side screen, env, render show-screen screen - <span class="muControl">jump</span> <span class="Constant">+finish-event:label</span> + <span class="muControl">jump</span> +finish-event <span class="Delimiter">}</span> ] diff --git a/html/edit/006-sandbox-copy.mu.html b/html/edit/006-sandbox-copy.mu.html index e0f8383f..f738325c 100644 --- a/html/edit/006-sandbox-copy.mu.html +++ b/html/edit/006-sandbox-copy.mu.html @@ -170,7 +170,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color screen<span class="Special"> <- </span>render-sandbox-side screen, env, render screen<span class="Special"> <- </span>update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env show-screen screen - <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="muControl">loop</span> +next-event <span class="Delimiter">}</span> ] diff --git a/html/edit/007-sandbox-delete.mu.html b/html/edit/007-sandbox-delete.mu.html index 0709f069..09752b87 100644 --- a/html/edit/007-sandbox-delete.mu.html +++ b/html/edit/007-sandbox-delete.mu.html @@ -108,7 +108,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color screen<span class="Special"> <- </span>render-sandbox-side screen, env, render screen<span class="Special"> <- </span>update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env show-screen screen - <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="muControl">loop</span> +next-event <span class="Delimiter">}</span> ] diff --git a/html/edit/008-sandbox-edit.mu.html b/html/edit/008-sandbox-edit.mu.html index 49098fb4..883c2501 100644 --- a/html/edit/008-sandbox-edit.mu.html +++ b/html/edit/008-sandbox-edit.mu.html @@ -165,7 +165,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color screen<span class="Special"> <- </span>render-sandbox-side screen, env, render screen<span class="Special"> <- </span>update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env show-screen screen - <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="muControl">loop</span> +next-event <span class="Delimiter">}</span> ] diff --git a/html/edit/009-sandbox-test.mu.html b/html/edit/009-sandbox-test.mu.html index 8c2324e4..6606679d 100644 --- a/html/edit/009-sandbox-test.mu.html +++ b/html/edit/009-sandbox-test.mu.html @@ -169,7 +169,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color screen<span class="Special"> <- </span>update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env <span class="Comment"># no change in cursor</span> show-screen screen - <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="muControl">loop</span> +next-event <span class="Delimiter">}</span> ] @@ -232,7 +232,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">break-unless</span> response-is-expected?:bool row, screen<span class="Special"> <- </span>render-text screen, sandbox-response, left, right, <span class="Constant">2/green</span>, row <span class="Delimiter">}</span> - <span class="muControl">jump</span> <span class="Constant">+render-sandbox-end:label</span> + <span class="muControl">jump</span> +render-sandbox-end <span class="Delimiter">}</span> ] diff --git a/html/edit/010-sandbox-trace.mu.html b/html/edit/010-sandbox-trace.mu.html index 5d8acd04..ff1e572f 100644 --- a/html/edit/010-sandbox-trace.mu.html +++ b/html/edit/010-sandbox-trace.mu.html @@ -232,7 +232,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color screen<span class="Special"> <- </span>update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env <span class="Comment"># no change in cursor</span> show-screen screen - <span class="muControl">loop</span> <span class="Constant">+next-event:label</span> + <span class="muControl">loop</span> +next-event <span class="Delimiter">}</span> ] diff --git a/html/edit/011-errors.mu.html b/html/edit/011-errors.mu.html index 6c69076c..e31fc3e9 100644 --- a/html/edit/011-errors.mu.html +++ b/html/edit/011-errors.mu.html @@ -145,7 +145,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color *sandbox<span class="Special"> <- </span>put *sandbox, <span class="Constant">response-starting-row-on-screen:offset</span>, <span class="Constant">0</span> <span class="Comment"># no response</span> row, screen<span class="Special"> <- </span>render-text screen, sandbox-errors, left, right, <span class="Constant">1/red</span>, row <span class="Comment"># don't try to print anything more for this sandbox</span> - <span class="muControl">jump</span> <span class="Constant">+render-sandbox-end:label</span> + <span class="muControl">jump</span> +render-sandbox-end <span class="Delimiter">}</span> ] diff --git a/html/edit/012-editor-undo.mu.html b/html/edit/012-editor-undo.mu.html index 97238c64..1d78409b 100644 --- a/html/edit/012-editor-undo.mu.html +++ b/html/edit/012-editor-undo.mu.html @@ -197,7 +197,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color typing<span class="Special"> <- </span>put typing, <span class="Constant">after-column:offset</span>, cursor-column typing<span class="Special"> <- </span>put typing, <span class="Constant">after-top-of-screen:offset</span>, top-after *op<span class="Special"> <- </span>merge <span class="Constant">0/insert-operation</span>, typing - <span class="muControl">break</span> <span class="Constant">+done-adding-insert-operation:label</span> + <span class="muControl">break</span> +done-adding-insert-operation <span class="Delimiter">}</span> <span class="Comment"># if not, create a new operation</span> insert-from:&:duplex-list:char<span class="Special"> <- </span>next cursor-before @@ -777,7 +777,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color move<span class="Special"> <- </span>put move, <span class="Constant">after-column:offset</span>, cursor-column move<span class="Special"> <- </span>put move, <span class="Constant">after-top-of-screen:offset</span>, top-after *op<span class="Special"> <- </span>merge <span class="Constant">1/move-operation</span>, move - <span class="muControl">break</span> <span class="Constant">+done-adding-move-operation:label</span> + <span class="muControl">break</span> +done-adding-move-operation <span class="Delimiter">}</span> op:&:operation<span class="Special"> <- </span>new <span class="Constant">operation:type</span> *op<span class="Special"> <- </span>merge <span class="Constant">1/move-operation</span>, cursor-row-before, cursor-column-before, top-before, cursor-row/after, cursor-column/after, top-after, undo-coalesce-tag @@ -1678,7 +1678,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color deletion<span class="Special"> <- </span>put deletion, <span class="Constant">after-column:offset</span>, cursor-column deletion<span class="Special"> <- </span>put deletion, <span class="Constant">after-top-of-screen:offset</span>, top-after *op<span class="Special"> <- </span>merge <span class="Constant">2/delete-operation</span>, deletion - <span class="muControl">break</span> <span class="Constant">+done-adding-backspace-operation:label</span> + <span class="muControl">break</span> +done-adding-backspace-operation <span class="Delimiter">}</span> <span class="Comment"># if not, create a new operation</span> op:&:operation<span class="Special"> <- </span>new <span class="Constant">operation:type</span> @@ -1905,7 +1905,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color deletion<span class="Special"> <- </span>put deletion, <span class="Constant">after-column:offset</span>, cursor-column deletion<span class="Special"> <- </span>put deletion, <span class="Constant">after-top-of-screen:offset</span>, top-after *op<span class="Special"> <- </span>merge <span class="Constant">2/delete-operation</span>, deletion - <span class="muControl">break</span> <span class="Constant">+done-adding-delete-operation:label</span> + <span class="muControl">break</span> +done-adding-delete-operation <span class="Delimiter">}</span> <span class="Comment"># if not, create a new operation</span> op:&:operation<span class="Special"> <- </span>new <span class="Constant">operation:type</span> diff --git a/html/lambda-to-mu.mu.html b/html/lambda-to-mu.mu.html index 46788657..131d0122 100644 --- a/html/lambda-to-mu.mu.html +++ b/html/lambda-to-mu.mu.html @@ -268,7 +268,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color close-paren?:bool<span class="Special"> <- </span>equal c, <span class="Constant">41/close-paren</span> <span class="muControl">break-unless</span> close-paren? read in <span class="Comment"># skip ')'</span> - <span class="muControl">break</span> <span class="Constant">+end-pair:label</span> + <span class="muControl">break</span> +end-pair <span class="Delimiter">}</span> <span class="Comment"># still here? read next element of pair</span> next:&:cell, in<span class="Special"> <- </span>parse in |