diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-12-13 20:01:42 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-12-13 20:01:42 -0800 |
commit | 71974f15e3b5b32542fec00f0985c674f45a2501 (patch) | |
tree | f5fe3ec8cd6f9023acd392ebd8d384129d353797 | |
parent | bf458036ced8cbb50c79268f57418149f5e43909 (diff) | |
download | mu-71974f15e3b5b32542fec00f0985c674f45a2501.tar.gz |
2622
-rw-r--r-- | 011load.cc | 18 | ||||
-rw-r--r-- | 020run.cc | 2 | ||||
-rw-r--r-- | 030container.cc | 22 | ||||
-rw-r--r-- | 042name.cc | 6 | ||||
-rw-r--r-- | 059shape_shifting_recipe.cc | 16 | ||||
-rw-r--r-- | 091run_interactive.cc | 20 |
6 files changed, 42 insertions, 42 deletions
diff --git a/011load.cc b/011load.cc index e5122edb..a4ae7de2 100644 --- a/011load.cc +++ b/011load.cc @@ -61,7 +61,7 @@ long long int slurp_recipe(istream& in) { // End recipe Body(result) get_or_insert(Recipe, get(Recipe_ordinal, result.name)) = result; // track added recipes because we may need to undo them in tests; see below - recently_added_recipes.push_back(get(Recipe_ordinal, result.name)); + Recently_added_recipes.push_back(get(Recipe_ordinal, result.name)); return get(Recipe_ordinal, result.name); } @@ -234,17 +234,17 @@ void show_rest_of_stream(istream& in) { //: Have tests clean up any recipes they added. :(before "End Globals") -vector<recipe_ordinal> recently_added_recipes; +vector<recipe_ordinal> Recently_added_recipes; long long int Reserved_for_tests = 1000; :(before "End Setup") -for (long long int i = 0; i < SIZE(recently_added_recipes); ++i) { - if (recently_added_recipes.at(i) >= Reserved_for_tests // don't renumber existing recipes, like 'interactive' - && contains_key(Recipe, recently_added_recipes.at(i))) // in case previous test had duplicate definitions - Recipe_ordinal.erase(get(Recipe, recently_added_recipes.at(i)).name); - Recipe.erase(recently_added_recipes.at(i)); +for (long long int i = 0; i < SIZE(Recently_added_recipes); ++i) { + if (Recently_added_recipes.at(i) >= Reserved_for_tests // don't renumber existing recipes, like 'interactive' + && contains_key(Recipe, Recently_added_recipes.at(i))) // in case previous test had duplicate definitions + Recipe_ordinal.erase(get(Recipe, Recently_added_recipes.at(i)).name); + Recipe.erase(Recently_added_recipes.at(i)); } -// Clear Other State For recently_added_recipes -recently_added_recipes.clear(); +// Clear Other State For Recently_added_recipes +Recently_added_recipes.clear(); :(code) :(scenario parse_comment_outside_recipe) diff --git a/020run.cc b/020run.cc index d100b140..a3948dd1 100644 --- a/020run.cc +++ b/020run.cc @@ -219,7 +219,7 @@ void load_permanently(string filename) { load(fin); fin.close(); // freeze everything so it doesn't get cleared by tests - recently_added_recipes.clear(); + Recently_added_recipes.clear(); // End load_permanently. } diff --git a/030container.cc b/030container.cc index 1bae0da5..b470e8ad 100644 --- a/030container.cc +++ b/030container.cc @@ -415,7 +415,7 @@ void insert_container(const string& command, kind_of_type kind, istream& in) { trace(9999, "parse") << "type number: " << get(Type_ordinal, name) << end(); skip_bracket(in, "'container' must begin with '['"); type_info& info = get_or_insert(Type, get(Type_ordinal, name)); - recently_added_types.push_back(get(Type_ordinal, name)); + Recently_added_types.push_back(get(Type_ordinal, name)); info.name = name; info.kind = kind; while (has_data(in)) { @@ -471,22 +471,22 @@ recipe main [ //: ensure types created in one scenario don't leak outside it. :(before "End Globals") -vector<type_ordinal> recently_added_types; +vector<type_ordinal> Recently_added_types; :(before "End load_permanently") //: for non-tests -recently_added_types.clear(); +Recently_added_types.clear(); :(before "End Setup") //: for tests -for (long long int i = 0; i < SIZE(recently_added_types); ++i) { - if (!contains_key(Type, recently_added_types.at(i))) continue; - Type_ordinal.erase(get(Type, recently_added_types.at(i)).name); +for (long long int i = 0; i < SIZE(Recently_added_types); ++i) { + if (!contains_key(Type, Recently_added_types.at(i))) continue; + Type_ordinal.erase(get(Type, Recently_added_types.at(i)).name); // todo: why do I explicitly need to provide this? - for (long long int j = 0; j < SIZE(Type.at(recently_added_types.at(i)).elements); ++j) { - delete Type.at(recently_added_types.at(i)).elements.at(j); + for (long long int j = 0; j < SIZE(Type.at(Recently_added_types.at(i)).elements); ++j) { + delete Type.at(Recently_added_types.at(i)).elements.at(j); } - Type.erase(recently_added_types.at(i)); + Type.erase(Recently_added_types.at(i)); } -recently_added_types.clear(); +Recently_added_types.clear(); // delete recent type references -// can't rely on recently_added_types to cleanup Type_ordinal, because of deliberately misbehaving tests with references to undefined types +// can't rely on Recently_added_types to cleanup Type_ordinal, because of deliberately misbehaving tests with references to undefined types map<string, type_ordinal>::iterator p = Type_ordinal.begin(); while(p != Type_ordinal.end()) { // save current item diff --git a/042name.cc b/042name.cc index bb9fb08c..949f0dde 100644 --- a/042name.cc +++ b/042name.cc @@ -23,9 +23,9 @@ Transform.push_back(transform_names); // idempotent :(before "End Globals") map<recipe_ordinal, map<string, long long int> > Name; -:(after "Clear Other State For recently_added_recipes") -for (long long int i = 0; i < SIZE(recently_added_recipes); ++i) { - Name.erase(recently_added_recipes.at(i)); +:(after "Clear Other State For Recently_added_recipes") +for (long long int i = 0; i < SIZE(Recently_added_recipes); ++i) { + Name.erase(Recently_added_recipes.at(i)); } :(code) diff --git a/059shape_shifting_recipe.cc b/059shape_shifting_recipe.cc index 0e733abb..774230a2 100644 --- a/059shape_shifting_recipe.cc +++ b/059shape_shifting_recipe.cc @@ -44,20 +44,20 @@ if (contains_type_ingredient_name(lhs)) return false; //: *specializing* existing recipes. //: //: Keep track of these new recipes in a separate variable in addition to -//: recently_added_recipes, so that edit/ can clear them before reloading to +//: Recently_added_recipes, so that edit/ can clear them before reloading to //: regenerate errors. :(before "End Globals") -vector<recipe_ordinal> recently_added_shape_shifting_recipes; +vector<recipe_ordinal> Recently_added_shape_shifting_recipes; :(before "End Setup") //? cerr << "setup: clearing recently-added shape-shifting recipes\n"; -recently_added_shape_shifting_recipes.clear(); +Recently_added_shape_shifting_recipes.clear(); //: make sure we don't clear any of these recipes when we start running tests :(before "End Loading .mu Files") -recently_added_recipes.clear(); -recently_added_types.clear(); +Recently_added_recipes.clear(); +Recently_added_types.clear(); //? cerr << "clearing recently-added shape-shifting recipes\n"; -recently_added_shape_shifting_recipes.clear(); +Recently_added_shape_shifting_recipes.clear(); //: save original name of specialized recipes :(before "End recipe Fields") @@ -235,8 +235,8 @@ recipe_ordinal new_variant(recipe_ordinal exemplar, const instruction& inst, con // make a copy assert(contains_key(Recipe, exemplar)); assert(!contains_key(Recipe, new_recipe_ordinal)); - recently_added_recipes.push_back(new_recipe_ordinal); - recently_added_shape_shifting_recipes.push_back(new_recipe_ordinal); + Recently_added_recipes.push_back(new_recipe_ordinal); + Recently_added_shape_shifting_recipes.push_back(new_recipe_ordinal); put(Recipe, new_recipe_ordinal, get(Recipe, exemplar)); recipe& new_recipe = get(Recipe, new_recipe_ordinal); new_recipe.name = new_name; diff --git a/091run_interactive.cc b/091run_interactive.cc index 55fb92fe..0396ad47 100644 --- a/091run_interactive.cc +++ b/091run_interactive.cc @@ -151,7 +151,7 @@ load(string( "reply output, warnings, screen, stashes, completed?\n" + "]\n"); transform_all(); -recently_added_recipes.clear(); +Recently_added_recipes.clear(); //: adjust errors/warnings in the sandbox :(after "string maybe(string s)") @@ -422,27 +422,27 @@ case RELOAD: { case RELOAD: { //? cerr << "== reload\n"; // clear any containers in advance - for (long long int i = 0; i < SIZE(recently_added_types); ++i) { - Type_ordinal.erase(get(Type, recently_added_types.at(i)).name); - Type.erase(recently_added_types.at(i)); + for (long long int i = 0; i < SIZE(Recently_added_types); ++i) { + Type_ordinal.erase(get(Type, Recently_added_types.at(i)).name); + Type.erase(Recently_added_types.at(i)); } for (map<string, vector<recipe_ordinal> >::iterator p = Recipe_variants.begin(); p != Recipe_variants.end(); ++p) { //? cerr << p->first << ":\n"; vector<recipe_ordinal>& variants = p->second; for (long long int i = 0; i < SIZE(p->second); ++i) { if (variants.at(i) == -1) continue; - if (find(recently_added_shape_shifting_recipes.begin(), recently_added_shape_shifting_recipes.end(), variants.at(i)) != recently_added_shape_shifting_recipes.end()) { + if (find(Recently_added_shape_shifting_recipes.begin(), Recently_added_shape_shifting_recipes.end(), variants.at(i)) != Recently_added_shape_shifting_recipes.end()) { //? cerr << " " << variants.at(i) << ' ' << get(Recipe, variants.at(i)).name << '\n'; variants.at(i) = -1; // ghost } } } - for (long long int i = 0; i < SIZE(recently_added_shape_shifting_recipes); ++i) { -//? cerr << "erasing " << get(Recipe, recently_added_shape_shifting_recipes.at(i)).name << '\n'; - Recipe_ordinal.erase(get(Recipe, recently_added_shape_shifting_recipes.at(i)).name); - Recipe.erase(recently_added_shape_shifting_recipes.at(i)); + for (long long int i = 0; i < SIZE(Recently_added_shape_shifting_recipes); ++i) { +//? cerr << "erasing " << get(Recipe, Recently_added_shape_shifting_recipes.at(i)).name << '\n'; + Recipe_ordinal.erase(get(Recipe, Recently_added_shape_shifting_recipes.at(i)).name); + Recipe.erase(Recently_added_shape_shifting_recipes.at(i)); } - recently_added_shape_shifting_recipes.clear(); + Recently_added_shape_shifting_recipes.clear(); string code = read_mu_string(ingredients.at(0).at(0)); run_code_begin(); routine* save_current_routine = Current_routine; |