about summary refs log tree commit diff stats
path: root/098check_type_pointers.cc
blob: 36c548a9a52ff5ae6c0327597a09fc649749c490 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
        }
      }
    }
  }
}