diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-11-13 10:08:57 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-11-13 10:08:57 -0800 |
commit | c603cd6cef43100aa83a62e15f96fd54c9fb987e (patch) | |
tree | d8631b1964a0200d170a996314f6e023686ff8de /998check_type_pointers.cc | |
parent | 05d3592047a76db4cc8d77102508c21ca1b86e7b (diff) | |
download | mu-c603cd6cef43100aa83a62e15f96fd54c9fb987e.tar.gz |
2430 - make room for more transforms
Diffstat (limited to '998check_type_pointers.cc')
-rw-r--r-- | 998check_type_pointers.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/998check_type_pointers.cc b/998check_type_pointers.cc new file mode 100644 index 00000000..36c548a9 --- /dev/null +++ b/998check_type_pointers.cc @@ -0,0 +1,33 @@ +:(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; + 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; + } + } + } + } +} |