about summary refs log blame commit diff stats
path: root/archive/1.vm/998check_type_pointers.cc
blob: da19cf3ee436ce972f1919e2636350f3a6c0b096 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; backgrou
//: enable this when tracking down null types
//: (but it interferes with edit/; since recipes created in the environment
//: can raise warnings here which will stop running the entire environment)
//? :(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;
//?         }
//?       }
//?     }
//?   }
//? }
count(s.begin(), s.end(), '.') == 1; } double to_double(string n) { char* end = NULL; // safe because string.c_str() is guaranteed to be null-terminated double result = strtod(n.c_str(), &end); assert(*end == '\0'); return result; } void test_is_noninteger() { CHECK(!is_noninteger("1234")); CHECK(!is_noninteger("1a2")); CHECK(is_noninteger("234.0")); CHECK(!is_noninteger("...")); CHECK(!is_noninteger(".")); CHECK(is_noninteger("2.")); CHECK(is_noninteger(".2")); }