diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-05-06 08:33:15 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-05-06 08:33:15 -0700 |
commit | 43b866d1997e82bfebd6c40881e33a0edd2bf340 (patch) | |
tree | 565c40a8dce9d5b831c38b5c6c3800873090dfd4 | |
parent | 3473c63ad94756d6f79ddd5c48813e79d87429ca (diff) | |
download | mu-43b866d1997e82bfebd6c40881e33a0edd2bf340.tar.gz |
2932
More consistent labeling of waypoints. Use types only when you need to distinguish between function overloadings. Otherwise just use variable names unless it's truly not apparent what they are (like that the result is a recipe in "End Rewrite Instruction").
-rw-r--r-- | 020run.cc | 12 | ||||
-rw-r--r-- | 029tools.cc | 2 | ||||
-rw-r--r-- | 030container.cc | 2 | ||||
-rw-r--r-- | 032array.cc | 2 | ||||
-rw-r--r-- | 038new_text.cc | 2 | ||||
-rw-r--r-- | 043space.cc | 8 |
6 files changed, 14 insertions, 14 deletions
diff --git a/020run.cc b/020run.cc index 5bfbc34b..f0e78b80 100644 --- a/020run.cc +++ b/020run.cc @@ -251,13 +251,13 @@ void load_all(string dir) { :(code) vector<double> read_memory(reagent/*copy*/ x) { - // Begin Preprocess read_memory(reagent x) + // Begin Preprocess read_memory(x) vector<double> result; if (is_literal(x)) { result.push_back(x.value); return result; } - // End Preprocess read_memory(reagent x) + // End Preprocess read_memory(x) int size = size_of(x); for (int offset = 0; offset < size; ++offset) { double val = get_or_insert(Memory, x.value+offset); @@ -268,20 +268,20 @@ vector<double> read_memory(reagent/*copy*/ x) { } void write_memory(reagent/*copy*/ x, const vector<double>& data) { - // Begin Preprocess write_memory(reagent x, vector<double> data) + // Begin Preprocess write_memory(x, data) if (!x.type) { raise << "can't write to " << to_string(x) << "; no type\n" << end(); return; } if (is_dummy(x)) return; if (is_literal(x)) return; - // End Preprocess write_memory(reagent x, vector<double> data) + // End Preprocess write_memory(x, data) if (x.value == 0) return; if (size_mismatch(x, data)) { raise << maybe(current_recipe_name()) << "size mismatch in storing to " << x.original_string << " (" << size_of(x.type) << " vs " << SIZE(data) << ") at '" << to_original_string(current_instruction()) << "'\n" << end(); return; } - // End write_memory(reagent x) Special-cases + // End write_memory(x) Special-cases for (int offset = 0; offset < SIZE(data); ++offset) { assert(x.value+offset > 0); trace(9999, "mem") << "storing " << no_scientific(data.at(offset)) << " in location " << x.value+offset << end(); @@ -292,7 +292,7 @@ void write_memory(reagent/*copy*/ x, const vector<double>& data) { :(code) int size_of(const reagent& r) { if (r.type == NULL) return 0; - // End size_of(reagent) Cases + // End size_of(reagent r) Cases return size_of(r.type); } int size_of(const type_tree* type) { diff --git a/029tools.cc b/029tools.cc index cb24fd85..faab1eb0 100644 --- a/029tools.cc +++ b/029tools.cc @@ -81,7 +81,7 @@ def main [ string print_mu(const reagent& r, const vector<double>& data) { if (is_literal(r)) return r.name+' '; - // End print Special-cases(reagent r, data) + // End print Special-cases(r, data) ostringstream out; for (long long i = 0; i < SIZE(data); ++i) out << no_scientific(data.at(i)) << ' '; diff --git a/030container.cc b/030container.cc index 3e779871..a31d409e 100644 --- a/030container.cc +++ b/030container.cc @@ -122,7 +122,7 @@ Container_metadata = Container_metadata_snapshot; //: do no work in size_of, simply lookup Container_metadata -:(before "End size_of(reagent) Cases") +:(before "End size_of(reagent r) Cases") if (r.metadata.size) return r.metadata.size; :(before "End size_of(type) Cases") diff --git a/032array.cc b/032array.cc index 51f8e0b4..a13f62a7 100644 --- a/032array.cc +++ b/032array.cc @@ -92,7 +92,7 @@ def main [ ] +app: foo: 3 14 15 16 -:(before "End size_of(reagent) Cases") +:(before "End size_of(reagent r) Cases") if (r.type && r.type->value == get(Type_ordinal, "array")) { if (!r.type->right) { raise << maybe(current_recipe_name()) << "'" << r.original_string << "' is an array of what?\n" << end(); diff --git a/038new_text.cc b/038new_text.cc index 4b3ad536..9ddcbabe 100644 --- a/038new_text.cc +++ b/038new_text.cc @@ -66,7 +66,7 @@ def main [ ] +app: foo: abc -:(before "End print Special-cases(reagent r, data)") +:(before "End print Special-cases(r, data)") if (is_mu_string(r)) { assert(scalar(data)); return read_mu_string(data.at(0))+' '; diff --git a/043space.cc b/043space.cc index e4a39b7c..936f552d 100644 --- a/043space.cc +++ b/043space.cc @@ -82,7 +82,7 @@ int address(int offset, int base) { //:: reads and writes to the 'default-space' variable have special behavior -:(after "Begin Preprocess write_memory(reagent x, vector<double> data)") +:(after "Begin Preprocess write_memory(x, data)") if (x.name == "default-space") { if (!scalar(data) || !x.type @@ -105,7 +105,7 @@ def main [ ] +mem: storing 10 in location 1 -:(after "Begin Preprocess read_memory(reagent x)") +:(after "Begin Preprocess read_memory(x)") if (x.name == "default-space") { vector<double> result; result.push_back(current_call().default_space); @@ -178,7 +178,7 @@ if (s == "number-of-locals") return true; if (curr.name == "new-default-space") { rewrite_default_space_instruction(curr); } -:(after "Begin Preprocess read_memory(reagent x)") +:(after "Begin Preprocess read_memory(x)") if (x.name == "number-of-locals") { vector<double> result; result.push_back(Name[get(Recipe_ordinal, current_recipe_name())][""]); @@ -186,7 +186,7 @@ if (x.name == "number-of-locals") { raise << "no space allocated for default-space in recipe " << current_recipe_name() << "; are you using names?\n" << end(); return result; } -:(after "Begin Preprocess write_memory(reagent x, vector<double> data)") +:(after "Begin Preprocess write_memory(x, data)") if (x.name == "number-of-locals") { raise << maybe(current_recipe_name()) << "can't write to special name 'number-of-locals'\n" << end(); return; |