From d059fe743df6a5e8a72fc1418f2c3ba1ed5ac1e6 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 20 Oct 2016 00:37:24 -0700 Subject: 3524 --- html/056shape_shifting_recipe.cc.html | 62 +++++++++++++++++------------------ 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'html/056shape_shifting_recipe.cc.html') diff --git a/html/056shape_shifting_recipe.cc.html b/html/056shape_shifting_recipe.cc.html index dc46eb54..aa527a1d 100644 --- a/html/056shape_shifting_recipe.cc.html +++ b/html/056shape_shifting_recipe.cc.html @@ -104,7 +104,7 @@ candidates = strictly_matching_shape_shifting_variants(< // perform all transforms on the new specialization if (!variant.steps.empty()) { trace(9992, "transform") << "transforming new specialization: " << variant.name << end(); - for (int t = 0; t < SIZE(Transform); ++t) { + for (int t = 0; t < SIZE(Transform); ++t) { // one exception: skip tangle, which would have already occurred inside new_variant above if (Transform.at(t) == /*disambiguate overloading*/static_cast<transform_fn>(insert_fragments)) continue; @@ -138,7 +138,7 @@ candidates = strictly_matching_shape_shifting_variants(< // phase 3 of static dispatch vector<recipe_ordinal> strictly_matching_shape_shifting_variants(const instruction& inst, vector<recipe_ordinal>& variants) { vector<recipe_ordinal> result; - for (int i = 0; i < SIZE(variants); ++i) { + for (int i = 0; i < SIZE(variants); ++i) { if (variants.at(i) == -1) continue; if (!any_type_ingredient_in_header(variants.at(i))) continue; if (!all_concrete_header_reagents_strictly_match(inst, get(Recipe, variants.at(i)))) continue; @@ -148,13 +148,13 @@ vector<recipe_ordinal> strictly_matching_shape_shifting_variants} bool all_concrete_header_reagents_strictly_match(const instruction& inst, const recipe& variant) { - for (int i = 0; i < min(SIZE(inst.ingredients), SIZE(variant.ingredients)); ++i) { + for (int i = 0; i < min(SIZE(inst.ingredients), SIZE(variant.ingredients)); ++i) { if (!concrete_type_names_strictly_match(variant.ingredients.at(i), inst.ingredients.at(i))) { trace(9993, "transform") << "concrete-type match failed: ingredient " << i << end(); return false; } } - for (int i = 0; i < min(SIZE(inst.products), SIZE(variant.ingredients)); ++i) { + for (int i = 0; i < min(SIZE(inst.products), SIZE(variant.ingredients)); ++i) { if (is_dummy(inst.products.at(i))) continue; if (!concrete_type_names_strictly_match(variant.products.at(i), inst.products.at(i))) { trace(9993, "transform") << "strict match failed: product " << i << end(); @@ -169,7 +169,7 @@ recipe_ordinal best_shape_shifting_variant((!candidates.empty()); // primary score int max_score = -1; - for (int i = 0; i < SIZE(candidates); ++i) { + for (int i = 0; i < SIZE(candidates); ++i) { int score = number_of_concrete_type_names(candidates.at(i)); assert(score > -1); if (score > max_score) max_score = score; @@ -177,7 +177,7 @@ recipe_ordinal best_shape_shifting_variant(// break any ties at max_score by a secondary score int min_score2 = 999; int best_index = 0; - for (int i = 0; i < SIZE(candidates); ++i) { + for (int i = 0; i < SIZE(candidates); ++i) { int score1 = number_of_concrete_type_names(candidates.at(i)); assert(score1 <= max_score); if (score1 != max_score) continue; @@ -195,11 +195,11 @@ recipe_ordinal best_shape_shifting_variant(bool any_type_ingredient_in_header(recipe_ordinal variant) { const recipe& caller = get(Recipe, variant); - for (int i = 0; i < SIZE(caller.ingredients); ++i) { + for (int i = 0; i < SIZE(caller.ingredients); ++i) { if (contains_type_ingredient_name(caller.ingredients.at(i))) return true; } - for (int i = 0; i < SIZE(caller.products); ++i) { + for (int i = 0; i < SIZE(caller.products); ++i) { if (contains_type_ingredient_name(caller.products.at(i))) return true; } @@ -215,9 +215,9 @@ recipe_ordinal best_shape_shifting_variant(int number_of_concrete_type_names(recipe_ordinal r) { const recipe& caller = get(Recipe, r); int result = 0; - for (int i = 0; i < SIZE(caller.ingredients); ++i) + for (int i = 0; i < SIZE(caller.ingredients); ++i) result += number_of_concrete_type_names(caller.ingredients.at(i)); - for (int i = 0; i < SIZE(caller.products); ++i) + for (int i = 0; i < SIZE(caller.products); ++i) result += number_of_concrete_type_names(caller.products.at(i)); return result; } @@ -291,7 +291,7 @@ recipe_ordinal new_variant(recipe_ordinal exempla compute_type_ingredient_mappings(get(Recipe, exemplar), inst, mappings, caller_recipe, &error); if (!error) error = (SIZE(mappings) != type_ingredient_count_in_header(exemplar)); if (!error) replace_type_ingredients(new_recipe, mappings); - for (map<string, const type_tree*>::iterator p = mappings.begin(); p != mappings.end(); ++p) + for (map<string, const type_tree*>::iterator p = mappings.begin(); p != mappings.end(); ++p) delete p->second; if (error) return 0; } @@ -303,16 +303,16 @@ recipe_ordinal new_variant(recipe_ordinal exempla void compute_type_names(recipe& variant) { trace(9993, "transform") << "-- compute type names: " << variant.name << end(); map<string, type_tree*> type_names; - for (int i = 0; i < SIZE(variant.ingredients); ++i) + for (int i = 0; i < SIZE(variant.ingredients); ++i) save_or_deduce_type_name(variant.ingredients.at(i), type_names, variant, ""); - for (int i = 0; i < SIZE(variant.products); ++i) + for (int i = 0; i < SIZE(variant.products); ++i) save_or_deduce_type_name(variant.products.at(i), type_names, variant, ""); - for (int i = 0; i < SIZE(variant.steps); ++i) { + for (int i = 0; i < SIZE(variant.steps); ++i) { instruction& inst = variant.steps.at(i); trace(9993, "transform") << " instruction: " << to_string(inst) << end(); - for (int in = 0; in < SIZE(inst.ingredients); ++in) + for (int in = 0; in < SIZE(inst.ingredients); ++in) save_or_deduce_type_name(inst.ingredients.at(in), type_names, variant, " in '" + inst.original_string + "'"); - for (int out = 0; out < SIZE(inst.products); ++out) + for (int out = 0; out < SIZE(inst.products); ++out) save_or_deduce_type_name(inst.products.at(out), type_names, variant, " in '" + inst.original_string + "'"); } } @@ -336,7 +336,7 @@ recipe_ordinal new_variant(recipe_ordinal exempla void compute_type_ingredient_mappings(const recipe& exemplar, const instruction& inst, map<string, const type_tree*>& mappings, const recipe& caller_recipe, bool* error) { int limit = min(SIZE(inst.ingredients), SIZE(exemplar.ingredients)); - for (int i = 0; i < limit; ++i) { + for (int i = 0; i < limit; ++i) { const reagent& exemplar_reagent = exemplar.ingredients.at(i); reagent/*copy*/ ingredient = inst.ingredients.at(i); canonize_type(ingredient); @@ -344,7 +344,7 @@ recipe_ordinal new_variant(recipe_ordinal exempla accumulate_type_ingredients(exemplar_reagent, ingredient, mappings, exemplar, inst, caller_recipe, error); } limit = min(SIZE(inst.products), SIZE(exemplar.products)); - for (int i = 0; i < limit; ++i) { + for (int i = 0; i < limit; ++i) { const reagent& exemplar_reagent = exemplar.products.at(i); reagent/*copy*/ product = inst.products.at(i); if (is_dummy(product)) continue; @@ -402,18 +402,18 @@ recipe_ordinal new_variant(recipe_ordinal exempla // update its header if (mappings.empty()) return; trace(9993, "transform") << "replacing in recipe header ingredients" << end(); - for (int i = 0; i < SIZE(new_recipe.ingredients); ++i) + for (int i = 0; i < SIZE(new_recipe.ingredients); ++i) replace_type_ingredients(new_recipe.ingredients.at(i), mappings, new_recipe); trace(9993, "transform") << "replacing in recipe header products" << end(); - for (int i = 0; i < SIZE(new_recipe.products); ++i) + for (int i = 0; i < SIZE(new_recipe.products); ++i) replace_type_ingredients(new_recipe.products.at(i), mappings, new_recipe); // update its body - for (int i = 0; i < SIZE(new_recipe.steps); ++i) { + for (int i = 0; i < SIZE(new_recipe.steps); ++i) { instruction& inst = new_recipe.steps.at(i); trace(9993, "transform") << "replacing in instruction '" << to_string(inst) << "'" << end(); - for (int j = 0; j < SIZE(inst.ingredients); ++j) + for (int j = 0; j < SIZE(inst.ingredients); ++j) replace_type_ingredients(inst.ingredients.at(j), mappings, new_recipe); - for (int j = 0; j < SIZE(inst.products); ++j) + for (int j = 0; j < SIZE(inst.products); ++j) replace_type_ingredients(inst.products.at(j), mappings, new_recipe); // special-case for new: replace type ingredient in first ingredient *value* if (inst.name == "new" && inst.ingredients.at(0).type->name != "literal-string") { @@ -464,9 +464,9 @@ recipe_ordinal new_variant(recipe_ordinal exempla int type_ingredient_count_in_header(recipe_ordinal variant) { const recipe& caller = get(Recipe, variant); set<string> type_ingredients; - for (int i = 0; i < SIZE(caller.ingredients); ++i) + for (int i = 0; i < SIZE(caller.ingredients); ++i) accumulate_type_ingredients(caller.ingredients.at(i).type, type_ingredients); - for (int i = 0; i < SIZE(caller.products); ++i) + for (int i = 0; i < SIZE(caller.products); ++i) accumulate_type_ingredients(caller.products.at(i).type, type_ingredients); return SIZE(type_ingredients); } @@ -497,7 +497,7 @@ string inspect(const return; } out << '('; - for (const type_tree* curr = x; curr; curr = curr->right) { + for (const type_tree* curr = x; curr; curr = curr->right) { if (curr != x) out << ' '; if (curr->left) dump_inspect(curr->left, out); @@ -509,15 +509,15 @@ string inspect(const void ensure_all_concrete_types(/*const*/ recipe& new_recipe, const recipe& exemplar) { trace(9993, "transform") << "-- ensure all concrete types in recipe " << new_recipe.name << end(); - for (int i = 0; i < SIZE(new_recipe.ingredients); ++i) + for (int i = 0; i < SIZE(new_recipe.ingredients); ++i) ensure_all_concrete_types(new_recipe.ingredients.at(i), exemplar); - for (int i = 0; i < SIZE(new_recipe.products); ++i) + for (int i = 0; i < SIZE(new_recipe.products); ++i) ensure_all_concrete_types(new_recipe.products.at(i), exemplar); - for (int i = 0; i < SIZE(new_recipe.steps); ++i) { + for (int i = 0; i < SIZE(new_recipe.steps); ++i) { instruction& inst = new_recipe.steps.at(i); - for (int j = 0; j < SIZE(inst.ingredients); ++j) + for (int j = 0; j < SIZE(inst.ingredients); ++j) ensure_all_concrete_types(inst.ingredients.at(j), exemplar); - for (int j = 0; j < SIZE(inst.products); ++j) + for (int j = 0; j < SIZE(inst.products); ++j) ensure_all_concrete_types(inst.products.at(j), exemplar); } } -- cgit 1.4.1-2-gfad0