diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-08-02 22:18:19 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-08-02 22:18:19 -0700 |
commit | cfb142b9601cc648f15bf5738a3df09a23835e41 (patch) | |
tree | 670f168fbbf2693b17d679939bd1c203de1c3837 /081run_interactive.cc | |
parent | 37900254f083364dcfbb80cf7119c230a0b603d6 (diff) | |
download | mu-cfb142b9601cc648f15bf5738a3df09a23835e41.tar.gz |
1923
Still iterating on the right way to handle incorrect number of ingredients. My first idea of creating null results doesn't really work once they're used in later instructions. Just add a warning at one place in the run loop, but otherwise only add products when there's something to save in them. Undoes some work around commit 1886.
Diffstat (limited to '081run_interactive.cc')
-rw-r--r-- | 081run_interactive.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/081run_interactive.cc b/081run_interactive.cc index 59c79432..e627b0f6 100644 --- a/081run_interactive.cc +++ b/081run_interactive.cc @@ -27,7 +27,6 @@ Recipe_ordinal["run-interactive"] = RUN_INTERACTIVE; //? cerr << "run-interactive: " << RUN_INTERACTIVE << '\n'; //? 1 :(before "End Primitive Recipe Implementations") case RUN_INTERACTIVE: { - products.resize(4); if (SIZE(ingredients) != 1) { raise << current_recipe_name() << ": 'run-interactive' requires exactly one ingredient, but got " << current_instruction().to_string() << '\n' << end(); break; @@ -38,6 +37,7 @@ case RUN_INTERACTIVE: { } bool new_code_pushed_to_stack = run_interactive(ingredients.at(0).at(0)); if (!new_code_pushed_to_stack) { + products.resize(4); products.at(0).push_back(0); products.at(1).push_back(trace_contents("warn")); products.at(2).push_back(0); @@ -153,6 +153,14 @@ void record_products(const instruction& instruction, const vector<vector<double> // string if (i < SIZE(instruction.products)) { if (is_mu_string(instruction.products.at(i))) { + if (!scalar(products.at(i))) { + tb_shutdown(); + cerr << read_mu_string(trace_contents("warn")) << '\n'; + cerr << SIZE(products.at(i)) << ": "; + for (long long int j = 0; j < SIZE(products.at(i)); ++j) + cerr << products.at(i).at(j) << ' '; + cerr << '\n'; + } assert(scalar(products.at(i))); out << read_mu_string(products.at(i).at(0)) << '\n'; continue; @@ -281,7 +289,6 @@ RELOAD, Recipe_ordinal["reload"] = RELOAD; :(before "End Primitive Recipe Implementations") case RELOAD: { - products.resize(1); if (SIZE(ingredients) != 1) { raise << current_recipe_name() << ": 'reload' requires exactly one ingredient, but got " << current_instruction().to_string() << '\n' << end(); break; @@ -302,6 +309,7 @@ case RELOAD: { Trace_stream->newline(); // flush trace Disable_redefine_warnings = false; Hide_warnings = false; + products.resize(1); products.at(0).push_back(trace_contents("warn")); // hack: assume collect_layers isn't set anywhere else if (Trace_stream->is_narrowly_collecting("warn")) { |