diff options
Diffstat (limited to '098check_type_pointers.cc')
-rw-r--r-- | 098check_type_pointers.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/098check_type_pointers.cc b/098check_type_pointers.cc new file mode 100644 index 00000000..f052b1d7 --- /dev/null +++ b/098check_type_pointers.cc @@ -0,0 +1,34 @@ +:(before "End Transform All") +check_type_pointers(); + +:(code) +void check_type_pointers() { + for (map<recipe_ordinal, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) { + if (any_type_ingredient_in_header(p->first)) continue; + const recipe& r = p->second; + trace(9991, "transform") << "--- checking type and type_name pointers for recipe " << r.name << end(); + for (long long int i = 0; i < SIZE(r.steps); ++i) { + const instruction& inst = r.steps.at(i); + for (long long int j = 0; j < SIZE(inst.ingredients); ++j) { + if (!inst.ingredients.at(j).type) { + raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.ingredients.at(j).to_string() << " has no type\n" << end(); + return; + } + if (!inst.ingredients.at(j).properties.at(0).second) { + raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.ingredients.at(j).to_string() << " has no type name\n" << end(); + return; + } + } + for (long long int j = 0; j < SIZE(inst.products); ++j) { + if (!inst.products.at(j).type) { + raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.products.at(j).to_string() << " has no type\n" << end(); + return; + } + if (!inst.products.at(j).properties.at(0).second) { + raise_error << maybe(r.name) << " '" << inst.to_string() << "' -- " << inst.products.at(j).to_string() << " has no type name\n" << end(); + return; + } + } + } + } +} |