diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-10-06 22:15:45 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-10-06 22:15:45 -0700 |
commit | 5f98a10cc78829a03c9fa5a137392e7d5e9030ac (patch) | |
tree | b88536e28f6d507c4b68b337423c0b6a4e28306c /044space.cc | |
parent | 75aa3a98e2b9311d65df91523ec754d5a2770456 (diff) | |
download | mu-5f98a10cc78829a03c9fa5a137392e7d5e9030ac.tar.gz |
2258 - separate warnings from errors
At the lowest level I'm reluctantly starting to see the need for errors that stop the program in its tracks. Only way to avoid memory corruption and security issues. But beyond that core I still want to be as lenient as possible at higher levels of abstraction.
Diffstat (limited to '044space.cc')
-rw-r--r-- | 044space.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/044space.cc b/044space.cc index 59b292a5..55e3cc23 100644 --- a/044space.cc +++ b/044space.cc @@ -52,7 +52,7 @@ reagent absolutize(reagent x) { if (is_raw(x) || is_dummy(x)) return x; if (x.name == "default-space") return x; if (!x.initialized) { - raise << current_instruction().to_string() << ": reagent not initialized: " << x.original_string << '\n' << end(); + raise_error << current_instruction().to_string() << ": reagent not initialized: " << x.original_string << '\n' << end(); return x; } reagent r = x; @@ -133,12 +133,12 @@ if (curr.name == "new-default-space") { vector<double> result; result.push_back(Name[Recipe_ordinal[current_recipe_name()]][""]); if (result.back() == 0) - raise << "no space allocated for default-space in recipe " << current_recipe_name() << "; are you using names\n" << end(); + raise_error << "no space allocated for default-space in recipe " << current_recipe_name() << "; are you using names\n" << end(); return result; } :(after "void write_memory(reagent x, vector<double> data)") if (x.name == "number-of-locals") { - raise << maybe(current_recipe_name()) << "can't write to special name 'number-of-locals'\n" << end(); + raise_error << maybe(current_recipe_name()) << "can't write to special name 'number-of-locals'\n" << end(); return; } @@ -185,11 +185,11 @@ void try_reclaim_locals() { void rewrite_default_space_instruction(instruction& curr) { curr.operation = Recipe_ordinal["new"]; if (!curr.ingredients.empty()) - raise << "new-default-space can't take any ingredients\n" << end(); + raise_error << "new-default-space can't take any ingredients\n" << end(); curr.ingredients.push_back(reagent("location:type")); curr.ingredients.push_back(reagent("number-of-locals:literal")); if (!curr.products.empty()) - raise << "new-default-space can't take any results\n" << end(); + raise_error << "new-default-space can't take any results\n" << end(); curr.products.push_back(reagent("default-space:address:array:location")); } @@ -204,7 +204,7 @@ long long int address(long long int offset, long long int base) { if (base == 0) return offset; // raw if (offset >= static_cast<long long int>(Memory[base])) { // todo: test - raise << "location " << offset << " is out of bounds " << no_scientific(Memory[base]) << " at " << base << '\n' << end(); + raise_error << "location " << offset << " is out of bounds " << no_scientific(Memory[base]) << " at " << base << '\n' << end(); } return base+1 + offset; } @@ -212,7 +212,7 @@ long long int address(long long int offset, long long int base) { :(after "void write_memory(reagent x, vector<double> data)") if (x.name == "default-space") { if (!scalar(data)) - raise << maybe(current_recipe_name()) << "'default-space' should be of type address:array:location, but tried to write " << to_string(data) << '\n' << end(); + raise_error << maybe(current_recipe_name()) << "'default-space' should be of type address:array:location, but tried to write " << to_string(data) << '\n' << end(); Current_routine->calls.front().default_space = data.at(0); return; } |