diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-07-25 00:02:20 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-07-25 00:02:20 -0700 |
commit | 35064671ef90ec6e35eafd9b15363058bf4f23f4 (patch) | |
tree | 3a0b4b02cbdd1b304deb52d1673083091a1ed12d /044space.cc | |
parent | a17fd65ca0124f544bd4de844f1bfe2d91b46ae6 (diff) | |
download | mu-35064671ef90ec6e35eafd9b15363058bf4f23f4.tar.gz |
1844 - explicitly end each trace line
More verbose, but it saves trouble when debugging; there's never something you thought should be traced but just never came out the other end. Also got rid of fatal errors entirely. Everything's a warning now, and code after a warning isn't guaranteed to run.
Diffstat (limited to '044space.cc')
-rw-r--r-- | 044space.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/044space.cc b/044space.cc index 557ee04c..17ca4d2a 100644 --- a/044space.cc +++ b/044space.cc @@ -51,8 +51,10 @@ reagent r = absolutize(x); reagent absolutize(reagent x) { //? cout << "absolutize " << x.to_string() << '\n'; //? 4 if (is_raw(x) || is_dummy(x)) return x; - if (!x.initialized) - raise << current_instruction().to_string() << ": reagent not initialized: " << x.original_string << die(); + if (!x.initialized) { + raise << current_instruction().to_string() << ": reagent not initialized: " << x.original_string << end(); + return x; + } reagent r = x; r.set_value(address(r.value, space_base(r))); r.properties.push_back(pair<string, vector<string> >("raw", vector<string>())); @@ -131,13 +133,13 @@ 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"; + raise << "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") { assert(scalar(data)); - raise << "can't write to special variable number-of-locals\n"; + raise << "can't write to special variable number-of-locals\n" << end(); return; } @@ -186,11 +188,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"; + raise << "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"; + raise << "new-default-space can't take any results\n" << end(); curr.products.push_back(reagent("default-space:address:array:location")); } @@ -206,7 +208,7 @@ long long int address(long long int offset, long long int base) { //? cout << base << '\n'; //? 2 if (offset >= static_cast<long long int>(Memory[base])) { // todo: test - raise << "location " << offset << " is out of bounds " << Memory[base] << " at " << base << '\n'; + raise << "location " << offset << " is out of bounds " << Memory[base] << " at " << base << '\n' << end(); } return base+1 + offset; } |