diff options
Diffstat (limited to '056recipe_header.cc')
-rw-r--r-- | 056recipe_header.cc | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/056recipe_header.cc b/056recipe_header.cc index dfe05167..d6caf76b 100644 --- a/056recipe_header.cc +++ b/056recipe_header.cc @@ -101,10 +101,10 @@ def main # comment :(after "Begin debug_string(recipe x)") out << "ingredients:\n"; -for (long long int i = 0; i < SIZE(x.ingredients); ++i) +for (int i = 0; i < SIZE(x.ingredients); ++i) out << " " << debug_string(x.ingredients.at(i)) << '\n'; out << "products:\n"; -for (long long int i = 0; i < SIZE(x.products); ++i) +for (int i = 0; i < SIZE(x.products); ++i) out << " " << debug_string(x.products.at(i)) << '\n'; //: If a recipe never mentions any ingredients or products, assume it has a header. @@ -118,7 +118,7 @@ def test [ :(before "End Recipe Body(result)") if (!result.has_header) { result.has_header = true; - for (long long int i = 0; i < SIZE(result.steps); ++i) { + for (int i = 0; i < SIZE(result.steps); ++i) { const instruction& inst = result.steps.at(i); if ((inst.name == "reply" && !inst.ingredients.empty()) || (inst.name == "return" && !inst.ingredients.empty()) @@ -140,7 +140,7 @@ if (result.has_header) { if (curr.name == "load-ingredients") { curr.clear(); recipe_ordinal op = get(Recipe_ordinal, "next-ingredient-without-typechecking"); - for (long long int i = 0; i < SIZE(result.ingredients); ++i) { + for (int i = 0; i < SIZE(result.ingredients); ++i) { curr.operation = op; curr.name = "next-ingredient-without-typechecking"; curr.products.push_back(result.ingredients.at(i)); @@ -171,8 +171,8 @@ case NEXT_INGREDIENT_WITHOUT_TYPECHECKING: { else { products.resize(2); // pad the first product with sufficient zeros to match its type - long long int size = size_of(current_instruction().products.at(0)); - for (long long int i = 0; i < size; ++i) + int size = size_of(current_instruction().products.at(0)); + for (int i = 0; i < size; ++i) products.at(0).push_back(0); products.at(1).push_back(0); } @@ -211,7 +211,7 @@ Transform.push_back(check_calls_against_header); // idempotent void check_calls_against_header(const recipe_ordinal r) { trace(9991, "transform") << "--- type-check calls inside recipe " << get(Recipe, r).name << end(); const recipe& caller = get(Recipe, r); - for (long long int i = 0; i < SIZE(caller.steps); ++i) { + for (int i = 0; i < SIZE(caller.steps); ++i) { const instruction& inst = caller.steps.at(i); if (inst.operation < MAX_PRIMITIVE_RECIPES) continue; const recipe& callee = get(Recipe, inst.operation); @@ -289,14 +289,14 @@ void check_reply_instructions_against_header(const recipe_ordinal r) { const recipe& caller_recipe = get(Recipe, r); if (!caller_recipe.has_header) return; trace(9991, "transform") << "--- checking reply instructions against header for " << caller_recipe.name << end(); - for (long long int i = 0; i < SIZE(caller_recipe.steps); ++i) { + for (int i = 0; i < SIZE(caller_recipe.steps); ++i) { const instruction& inst = caller_recipe.steps.at(i); if (inst.name != "reply" && inst.name != "return") continue; if (SIZE(caller_recipe.products) != SIZE(inst.ingredients)) { raise << maybe(caller_recipe.name) << "replied with the wrong number of products at '" << to_string(inst) << "'\n" << end(); continue; } - for (long long int i = 0; i < SIZE(caller_recipe.products); ++i) { + for (int i = 0; i < SIZE(caller_recipe.products); ++i) { if (!types_match(caller_recipe.products.at(i), inst.ingredients.at(i))) raise << maybe(caller_recipe.name) << "replied with the wrong type at '" << to_string(inst) << "'\n" << end(); } @@ -334,7 +334,7 @@ void check_header_ingredients(const recipe_ordinal r) { if (caller_recipe.products.empty()) return; caller_recipe.ingredient_index.clear(); trace(9991, "transform") << "--- checking reply instructions against header for " << caller_recipe.name << end(); - for (long long int i = 0; i < SIZE(caller_recipe.ingredients); ++i) { + for (int i = 0; i < SIZE(caller_recipe.ingredients); ++i) { if (contains_key(caller_recipe.ingredient_index, caller_recipe.ingredients.at(i).name)) raise << maybe(caller_recipe.name) << caller_recipe.ingredients.at(i).name << " can't repeat in the ingredients\n" << end(); put(caller_recipe.ingredient_index, caller_recipe.ingredients.at(i).name, i); @@ -365,18 +365,18 @@ void deduce_types_from_header(const recipe_ordinal r) { if (caller_recipe.products.empty()) return; trace(9991, "transform") << "--- deduce types from header for " << caller_recipe.name << end(); map<string, const type_tree*> header_type; - for (long long int i = 0; i < SIZE(caller_recipe.ingredients); ++i) { + for (int i = 0; i < SIZE(caller_recipe.ingredients); ++i) { put(header_type, caller_recipe.ingredients.at(i).name, caller_recipe.ingredients.at(i).type); trace(9993, "transform") << "type of " << caller_recipe.ingredients.at(i).name << " is " << names_to_string(caller_recipe.ingredients.at(i).type) << end(); } - for (long long int i = 0; i < SIZE(caller_recipe.products); ++i) { + for (int i = 0; i < SIZE(caller_recipe.products); ++i) { put(header_type, caller_recipe.products.at(i).name, caller_recipe.products.at(i).type); trace(9993, "transform") << "type of " << caller_recipe.products.at(i).name << " is " << names_to_string(caller_recipe.products.at(i).type) << end(); } - for (long long int i = 0; i < SIZE(caller_recipe.steps); ++i) { + for (int i = 0; i < SIZE(caller_recipe.steps); ++i) { instruction& inst = caller_recipe.steps.at(i); trace(9992, "transform") << "instruction: " << to_string(inst) << end(); - for (long long int i = 0; i < SIZE(inst.ingredients); ++i) { + for (int i = 0; i < SIZE(inst.ingredients); ++i) { if (inst.ingredients.at(i).type) continue; if (header_type.find(inst.ingredients.at(i).name) == header_type.end()) continue; @@ -384,7 +384,7 @@ void deduce_types_from_header(const recipe_ordinal r) { inst.ingredients.at(i).type = new type_tree(*get(header_type, inst.ingredients.at(i).name)); trace(9993, "transform") << "type of " << inst.ingredients.at(i).name << " is " << names_to_string(inst.ingredients.at(i).type) << end(); } - for (long long int i = 0; i < SIZE(inst.products); ++i) { + for (int i = 0; i < SIZE(inst.products); ++i) { trace(9993, "transform") << " product: " << to_string(inst.products.at(i)) << end(); if (inst.products.at(i).type) continue; if (header_type.find(inst.products.at(i).name) == header_type.end()) @@ -419,7 +419,7 @@ void fill_in_reply_ingredients(recipe_ordinal r) { recipe& caller_recipe = get(Recipe, r); if (!caller_recipe.has_header) return; trace(9991, "transform") << "--- fill in reply ingredients from header for recipe " << caller_recipe.name << end(); - for (long long int i = 0; i < SIZE(caller_recipe.steps); ++i) { + for (int i = 0; i < SIZE(caller_recipe.steps); ++i) { instruction& inst = caller_recipe.steps.at(i); if (inst.name == "reply" || inst.name == "return") add_header_products(inst, caller_recipe); @@ -437,7 +437,7 @@ void fill_in_reply_ingredients(recipe_ordinal r) { void add_header_products(instruction& inst, const recipe& caller_recipe) { assert(inst.name == "reply" || inst.name == "return"); // collect any products with the same names as ingredients - for (long long int i = 0; i < SIZE(caller_recipe.products); ++i) { + for (int i = 0; i < SIZE(caller_recipe.products); ++i) { // if the ingredient is missing, add it from the header if (SIZE(inst.ingredients) == i) inst.ingredients.push_back(caller_recipe.products.at(i)); |