diff options
-rw-r--r-- | 011load.cc | 24 | ||||
-rw-r--r-- | 050scenario.cc | 6 | ||||
-rw-r--r-- | 057static_dispatch.cc | 9 | ||||
-rw-r--r-- | 091run_interactive.cc | 32 |
4 files changed, 35 insertions, 36 deletions
diff --git a/011load.cc b/011load.cc index f3fb8793..be0ca375 100644 --- a/011load.cc +++ b/011load.cc @@ -28,9 +28,9 @@ vector<recipe_ordinal> load(istream& in) { result.push_back(slurp_recipe(in)); } else if (command == "recipe!") { - Disable_redefine_warnings = true; + Disable_redefine_errors = true; result.push_back(slurp_recipe(in)); - Disable_redefine_warnings = false; + Disable_redefine_errors = false; } // End Command Handlers else { @@ -54,7 +54,7 @@ long long int slurp_recipe(istream& in) { if (Recipe.find(get(Recipe_ordinal, result.name)) != Recipe.end()) { trace(9991, "parse") << "already exists" << end(); if (warn_on_redefine(result.name)) - raise << "redefining recipe " << result.name << "\n" << end(); + raise_error << "redefining recipe " << result.name << "\n" << end(); Recipe.erase(get(Recipe_ordinal, result.name)); } slurp_body(in, result); @@ -206,14 +206,14 @@ void skip_comment(istream& in) { //: Warn if a recipe gets redefined, because large codebases can accidentally //: step on their own toes. But there'll be many occasions later where -//: we'll want to disable the warnings. +//: we'll want to disable the errors. :(before "End Globals") -bool Disable_redefine_warnings = false; +bool Disable_redefine_errors = false; :(before "End Setup") -Disable_redefine_warnings = false; +Disable_redefine_errors = false; :(code) bool warn_on_redefine(const string& recipe_name) { - if (Disable_redefine_warnings) return false; + if (Disable_redefine_errors) return false; return true; } @@ -364,22 +364,22 @@ void test_parse_comment_terminated_by_eof() { } :(scenario warn_on_redefine) -% Hide_warnings = true; +% Hide_errors = true; recipe main [ 1:number <- copy 23 ] recipe main [ 1:number <- copy 24 ] -+warn: redefining recipe main ++error: redefining recipe main :(scenario redefine_without_warning) -% Hide_warnings = true; +% Hide_errors = true; recipe main [ 1:number <- copy 23 ] recipe! main [ 1:number <- copy 24 ] --warn: redefining recipe main -$warn: 0 +-error: redefining recipe main +$error: 0 diff --git a/050scenario.cc b/050scenario.cc index d7ffda6f..fa87541b 100644 --- a/050scenario.cc +++ b/050scenario.cc @@ -171,8 +171,8 @@ void run_mu_scenario(const scenario& s) { //: doing that, regardless of anything else. :(scenarios run) :(scenario warn_on_redefine_scenario) -% Hide_warnings = true; -% Disable_redefine_warnings = true; +% Hide_errors = true; +% Disable_redefine_errors = true; recipe scenario-foo [ 1:number <- copy 34 ] @@ -180,7 +180,7 @@ recipe scenario-foo [ recipe scenario-foo [ 1:number <- copy 35 ] -+warn: redefining recipe scenario-foo ++error: redefining recipe scenario-foo :(after "bool warn_on_redefine(const string& recipe_name)") if (recipe_name.find("scenario-") == 0) return true; diff --git a/057static_dispatch.cc b/057static_dispatch.cc index 9b1734b0..313facce 100644 --- a/057static_dispatch.cc +++ b/057static_dispatch.cc @@ -348,24 +348,24 @@ recipe test [ +mem: storing 34 in location 1 :(scenario static_dispatch_disabled_on_headerless_definition) -% Hide_warnings = true; +% Hide_errors = true; recipe test a:number -> z:number [ z <- copy 1 ] recipe test [ reply 34 ] -+warn: redefining recipe test ++error: redefining recipe test :(scenario static_dispatch_disabled_on_headerless_definition_2) -% Hide_warnings = true; +% Hide_errors = true; recipe test [ reply 34 ] recipe test a:number -> z:number [ z <- copy 1 ] -+warn: redefining recipe test ++error: redefining recipe test :(scenario static_dispatch_on_primitive_names) recipe main [ @@ -549,7 +549,6 @@ recipe! foo x:address:number -> y:number [ ] +mem: storing 34 in location 2 $error: 0 -$warn: 0 :(scenario dispatch_errors_come_after_unknown_name_errors) % Hide_errors = true; diff --git a/091run_interactive.cc b/091run_interactive.cc index 8930c935..c4d67278 100644 --- a/091run_interactive.cc +++ b/091run_interactive.cc @@ -18,9 +18,9 @@ recipe main [ # result is null +mem: storing 0 in location 2 -//: run code in 'interactive mode', i.e. with errors+warnings off and return: +//: run code in 'interactive mode', i.e. with errors off and return: //: stringified output in case we want to print it to screen -//: any errors+warnings encountered +//: any errors encountered //: simulated screen any prints went to //: any 'app' layer traces generated :(before "End Primitive Recipe Declarations") @@ -45,7 +45,7 @@ case RUN_INTERACTIVE: { if (!new_code_pushed_to_stack) { products.resize(5); products.at(0).push_back(0); - products.at(1).push_back(trace_error_warning_contents()); + products.at(1).push_back(trace_error_contents()); products.at(2).push_back(0); products.at(3).push_back(trace_app_contents()); products.at(4).push_back(1); // completed @@ -68,7 +68,7 @@ vector<recipe_ordinal> Save_recently_added_shape_shifting_recipes; Track_most_recent_products = false; :(code) // reads a string, tries to call it as code (treating it as a test), saving -// all warnings. +// all errors. // returns true if successfully called (no errors found during load and transform) bool run_interactive(long long int address) { assert(contains_key(Recipe_ordinal, "interactive") && get(Recipe_ordinal, "interactive") != 0); @@ -113,7 +113,7 @@ void run_code_begin(bool snapshot_recently_added_recipes) { // stuff to undo later, in run_code_end() Hide_warnings = true; Hide_errors = true; - Disable_redefine_warnings = true; + Disable_redefine_errors = true; if (snapshot_recently_added_recipes) { Save_recently_added_recipes = Recently_added_recipes; Recently_added_recipes.clear(); @@ -131,7 +131,7 @@ void run_code_end() { //? cerr << "back to old trace\n"; Hide_warnings = false; Hide_errors = false; - Disable_redefine_warnings = false; + Disable_redefine_errors = false; delete Trace_stream; Trace_stream = Save_trace_stream; Save_trace_stream = NULL; @@ -160,15 +160,15 @@ load(string( "sandbox-state:number <- routine-state r/routine_id\n" + "completed?:boolean <- equal sandbox-state, 1/completed\n" + "output:address:shared:array:character <- $most-recent-products\n" + - "warnings:address:shared:array:character <- save-errors-warnings\n" + + "errors:address:shared:array:character <- save-errors\n" + "stashes:address:shared:array:character <- save-app-trace\n" + "$cleanup-run-interactive\n" + - "reply output, warnings, screen, stashes, completed?\n" + + "reply output, errors, screen, stashes, completed?\n" + "]\n"); transform_all(); Recently_added_recipes.clear(); -//: adjust errors/warnings in the sandbox +//: adjust errors in the sandbox :(after "string maybe(string s)") if (s == "interactive") return ""; @@ -227,7 +227,7 @@ case _MOST_RECENT_PRODUCTS: { :(before "End Primitive Recipe Declarations") SAVE_ERRORS_WARNINGS, :(before "End Primitive Recipe Numbers") -put(Recipe_ordinal, "save-errors-warnings", SAVE_ERRORS_WARNINGS); +put(Recipe_ordinal, "save-errors", SAVE_ERRORS_WARNINGS); :(before "End Primitive Recipe Checks") case SAVE_ERRORS_WARNINGS: { break; @@ -235,7 +235,7 @@ case SAVE_ERRORS_WARNINGS: { :(before "End Primitive Recipe Implementations") case SAVE_ERRORS_WARNINGS: { products.resize(1); - products.at(0).push_back(trace_error_warning_contents()); + products.at(0).push_back(trace_error_contents()); break; } @@ -361,7 +361,7 @@ void track_most_recent_products(const instruction& instruction, const vector<vec if (is_mu_string(instruction.products.at(i))) { if (!scalar(products.at(i))) { tb_shutdown(); - cerr << read_mu_string(trace_error_warning_contents()) << '\n'; + cerr << read_mu_string(trace_error_contents()) << '\n'; cerr << SIZE(products.at(i)) << ": "; for (long long int j = 0; j < SIZE(products.at(i)); ++j) cerr << no_scientific(products.at(i).at(j)) << ' '; @@ -402,11 +402,11 @@ long long int stringified_value_of_location(long long int address) { return new_mu_string(out.str()); } -long long int trace_error_warning_contents() { +long long int trace_error_contents() { if (!Trace_stream) return 0; ostringstream out; for (vector<trace_line>::iterator p = Trace_stream->past_lines.begin(); p != Trace_stream->past_lines.end(); ++p) { - if (p->depth > Warning_depth) continue; + if (p->label != "error") continue; out << p->contents; if (*--p->contents.end() != '\n') out << '\n'; } @@ -440,7 +440,7 @@ void truncate(string& x) { } //: simpler version of run-interactive: doesn't do any running, just loads -//: recipes and reports errors+warnings. +//: recipes and reports errors. :(before "End Primitive Recipe Declarations") RELOAD, @@ -496,7 +496,7 @@ case RELOAD: { Trace_stream->newline(); // flush trace Current_routine = save_current_routine; products.resize(1); - products.at(0).push_back(trace_error_warning_contents()); + products.at(0).push_back(trace_error_contents()); run_code_end(); // wait until we're done with the trace contents //? cerr << "reload done\n"; break; |