From 9e751bb8c0cdf771d34c839cb6591d892b8e62de Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 7 Mar 2017 01:41:48 -0800 Subject: 3761 --- html/042name.cc.html | 161 ++++++++++++++++++++++++++------------------------- 1 file changed, 81 insertions(+), 80 deletions(-) (limited to 'html/042name.cc.html') diff --git a/html/042name.cc.html b/html/042name.cc.html index 9082f8a8..00e5267b 100644 --- a/html/042name.cc.html +++ b/html/042name.cc.html @@ -15,18 +15,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color a { text-decoration: none; } a:hover { text-decoration: underline; } * { font-size: 12pt; font-size: 1em; } -.Constant { color: #00a0a0; } -.traceAbsent { color: #c00000; } -.Special { color: #c00000; } +.SalientComment { color: #00ffff; } .muRecipe { color: #ff8700; } -.cSpecial { color: #008000; } -.Comment { color: #9090ff; } -.Delimiter { color: #800080; } .LineNr { color: #444444; } .traceContains { color: #008000; } +.traceAbsent { color: #c00000; } +.Delimiter { color: #800080; } .Normal { color: #eeeeee; background-color: #080808; padding-bottom: 1px; } +.cSpecial { color: #008000; } +.Conceal { color: #4e4e4e; } +.Comment { color: #9090ff; } +.Constant { color: #00a0a0; } +.Special { color: #c00000; } .Identifier { color: #c0a020; } -.SalientComment { color: #00ffff; } --> @@ -99,7 +100,7 @@ if ('onhashchange' in window) { 36 :(code) 37 void transform_names(const recipe_ordinal r) { 38 recipe& caller = get(Recipe, r); - 39 trace(9991, "transform") << "--- transform names for recipe " << caller.name << end(); + 39 trace(9991, "transform") << "--- transform names for recipe " << caller.name << end(); 40 bool names_used = false; 41 bool numeric_locations_used = false; 42 map<string, int>& names = Name[r]; @@ -107,63 +108,63 @@ if ('onhashchange' in window) { 44 int& curr_idx = names[""]; 45 ++curr_idx; // avoid using index 0, benign skip in some other cases 46 for (int i = 0; i < SIZE(caller.steps); ++i) { - 47 instruction& inst = caller.steps.at(i); - 48 // End transform_names(inst) Special-cases - 49 // map names to addresses - 50 for (int in = 0; in < SIZE(inst.ingredients); ++in) { - 51 reagent& ingredient = inst.ingredients.at(in); - 52 // Begin transform_names Ingredient Special-cases(ingredient, inst, caller) - 53 if (is_disqualified(ingredient, inst, caller.name)) continue; - 54 if (is_numeric_location(ingredient)) numeric_locations_used = true; - 55 if (is_named_location(ingredient)) names_used = true; - 56 if (is_integer(ingredient.name)) continue; - 57 if (!already_transformed(ingredient, names)) { - 58 raise << maybe(caller.name) << "tried to read ingredient '" << ingredient.name << "' in '" << to_original_string(inst) << "' but it hasn't been written to yet\n" << end(); - 59 // use-before-set Error - 60 return; - 61 } - 62 int v = lookup_name(ingredient, r); - 63 if (v >= 0) { - 64 ingredient.set_value(v); - 65 // Done Placing Ingredient(ingredient, inst, caller) - 66 } - 67 else { - 68 raise << maybe(caller.name) << "can't find a place to store '" << ingredient.name << "'\n" << end(); - 69 return; - 70 } - 71 } - 72 for (int out = 0; out < SIZE(inst.products); ++out) { - 73 reagent& product = inst.products.at(out); - 74 // Begin transform_names Product Special-cases(product, inst, caller) - 75 if (is_disqualified(product, inst, caller.name)) continue; - 76 if (is_numeric_location(product)) numeric_locations_used = true; - 77 if (is_named_location(product)) names_used = true; - 78 if (is_integer(product.name)) continue; - 79 if (names.find(product.name) == names.end()) { - 80 trace(9993, "name") << "assign " << product.name << " " << curr_idx << end(); - 81 names[product.name] = curr_idx; - 82 curr_idx += size_of(product); - 83 } - 84 int v = lookup_name(product, r); - 85 if (v >= 0) { - 86 product.set_value(v); - 87 // Done Placing Product(product, inst, caller) - 88 } - 89 else { - 90 raise << maybe(caller.name) << "can't find a place to store '" << product.name << "'\n" << end(); - 91 return; - 92 } - 93 } + 47 ¦ instruction& inst = caller.steps.at(i); + 48 ¦ // End transform_names(inst) Special-cases + 49 ¦ // map names to addresses + 50 ¦ for (int in = 0; in < SIZE(inst.ingredients); ++in) { + 51 ¦ ¦ reagent& ingredient = inst.ingredients.at(in); + 52 ¦ ¦ // Begin transform_names Ingredient Special-cases(ingredient, inst, caller) + 53 ¦ ¦ if (is_disqualified(ingredient, inst, caller.name)) continue; + 54 ¦ ¦ if (is_numeric_location(ingredient)) numeric_locations_used = true; + 55 ¦ ¦ if (is_named_location(ingredient)) names_used = true; + 56 ¦ ¦ if (is_integer(ingredient.name)) continue; + 57 ¦ ¦ if (!already_transformed(ingredient, names)) { + 58 ¦ ¦ ¦ raise << maybe(caller.name) << "tried to read ingredient '" << ingredient.name << "' in '" << to_original_string(inst) << "' but it hasn't been written to yet\n" << end(); + 59 ¦ ¦ ¦ // use-before-set Error + 60 ¦ ¦ ¦ return; + 61 ¦ ¦ } + 62 ¦ ¦ int v = lookup_name(ingredient, r); + 63 ¦ ¦ if (v >= 0) { + 64 ¦ ¦ ¦ ingredient.set_value(v); + 65 ¦ ¦ ¦ // Done Placing Ingredient(ingredient, inst, caller) + 66 ¦ ¦ } + 67 ¦ ¦ else { + 68 ¦ ¦ ¦ raise << maybe(caller.name) << "can't find a place to store '" << ingredient.name << "'\n" << end(); + 69 ¦ ¦ ¦ return; + 70 ¦ ¦ } + 71 ¦ } + 72 ¦ for (int out = 0; out < SIZE(inst.products); ++out) { + 73 ¦ ¦ reagent& product = inst.products.at(out); + 74 ¦ ¦ // Begin transform_names Product Special-cases(product, inst, caller) + 75 ¦ ¦ if (is_disqualified(product, inst, caller.name)) continue; + 76 ¦ ¦ if (is_numeric_location(product)) numeric_locations_used = true; + 77 ¦ ¦ if (is_named_location(product)) names_used = true; + 78 ¦ ¦ if (is_integer(product.name)) continue; + 79 ¦ ¦ if (names.find(product.name) == names.end()) { + 80 ¦ ¦ ¦ trace(9993, "name") << "assign " << product.name << " " << curr_idx << end(); + 81 ¦ ¦ ¦ names[product.name] = curr_idx; + 82 ¦ ¦ ¦ curr_idx += size_of(product); + 83 ¦ ¦ } + 84 ¦ ¦ int v = lookup_name(product, r); + 85 ¦ ¦ if (v >= 0) { + 86 ¦ ¦ ¦ product.set_value(v); + 87 ¦ ¦ ¦ // Done Placing Product(product, inst, caller) + 88 ¦ ¦ } + 89 ¦ ¦ else { + 90 ¦ ¦ ¦ raise << maybe(caller.name) << "can't find a place to store '" << product.name << "'\n" << end(); + 91 ¦ ¦ ¦ return; + 92 ¦ ¦ } + 93 ¦ } 94 } 95 if (names_used && numeric_locations_used) - 96 raise << maybe(caller.name) << "mixing variable names and numeric addresses\n" << end(); + 96 ¦ raise << maybe(caller.name) << "mixing variable names and numeric addresses\n" << end(); 97 } 98 99 bool is_disqualified(/*mutable*/ reagent& x, const instruction& inst, const string& recipe_name) { 100 if (!x.type) { -101 raise << maybe(recipe_name) << "missing type for '" << x.original_string << "' in '" << inst.original_string << "'\n" << end(); -102 // missing-type Error 1 -103 return true; +101 ¦ raise << maybe(recipe_name) << "missing type for '" << x.original_string << "' in '" << inst.original_string << "'\n" << end(); +102 ¦ // missing-type Error 1 +103 ¦ return true; 104 } 105 if (is_raw(x)) return true; 106 if (is_literal(x)) return true; @@ -182,13 +183,13 @@ if ('onhashchange' in window) { 119 120 type_ordinal skip_addresses(type_tree* type) { 121 while (type && is_compound_type_starting_with(type, "address")) -122 type = type->right; +122 ¦ type = type->right; 123 if (!type) return -1; // error handled elsewhere 124 if (type->atom) return type->value; 125 const type_tree* base_type = type; 126 // Update base_type in skip_addresses 127 if (base_type->atom) -128 return base_type->value; +128 ¦ return base_type->value; 129 assert(base_type->left->atom); 130 return base_type->left->value; 131 } @@ -196,7 +197,7 @@ if ('onhashchange' in window) { 133 int find_element_name(const type_ordinal t, const string& name, const string& recipe_name) { 134 const type_info& container = get(Type, t); 135 for (int i = 0; i < SIZE(container.elements); ++i) -136 if (container.elements.at(i).name == name) return i; +136 ¦ if (container.elements.at(i).name == name) return i; 137 raise << maybe(recipe_name) << "unknown element '" << name << "' in container '" << get(Type, t).name << "'\n" << end(); 138 return -1; 139 } @@ -295,8 +296,8 @@ if ('onhashchange' in window) { 232 :(before "End update GET offset_value in Check") 233 else { 234 if (!offset.initialized) { -235 raise << maybe(get(Recipe, r).name) << "uninitialized offset '" << offset.name << "' in '" << to_original_string(inst) << "'\n" << end(); -236 break; +235 ¦ raise << maybe(get(Recipe, r).name) << "uninitialized offset '" << offset.name << "' in '" << to_original_string(inst) << "'\n" << end(); +236 ¦ break; 237 } 238 offset_value = offset.value; 239 } @@ -317,16 +318,16 @@ if ('onhashchange' in window) { 254 //: instructions with the same names (static dispatch), which could lead to 255 //: spurious errors 256 if (SIZE(inst.ingredients) < 2) -257 break; // error raised elsewhere +257 ¦ break; // error raised elsewhere 258 if (!is_literal(inst.ingredients.at(1))) -259 break; // error raised elsewhere +259 ¦ break; // error raised elsewhere 260 if (inst.ingredients.at(1).name.find_first_not_of("0123456789") != string::npos) { -261 // since first non-address in base type must be a container, we don't have to canonize -262 type_ordinal base_type = skip_addresses(inst.ingredients.at(0).type); -263 if (contains_key(Type, base_type)) { // otherwise we'll raise an error elsewhere -264 inst.ingredients.at(1).set_value(find_element_name(base_type, inst.ingredients.at(1).name, get(Recipe, r).name)); -265 trace(9993, "name") << "element " << inst.ingredients.at(1).name << " of type " << get(Type, base_type).name << " is at offset " << no_scientific(inst.ingredients.at(1).value) << end(); -266 } +261 ¦ // since first non-address in base type must be a container, we don't have to canonize +262 ¦ type_ordinal base_type = skip_addresses(inst.ingredients.at(0).type); +263 ¦ if (contains_key(Type, base_type)) { // otherwise we'll raise an error elsewhere +264 ¦ ¦ inst.ingredients.at(1).set_value(find_element_name(base_type, inst.ingredients.at(1).name, get(Recipe, r).name)); +265 ¦ ¦ trace(9993, "name") << "element " << inst.ingredients.at(1).name << " of type " << get(Type, base_type).name << " is at offset " << no_scientific(inst.ingredients.at(1).value) << end(); +266 ¦ } 267 } 268 } 269 @@ -366,17 +367,17 @@ if ('onhashchange' in window) { 303 // convert variant names of exclusive containers 304 if (inst.name == "maybe-convert") { 305 if (SIZE(inst.ingredients) != 2) { -306 raise << maybe(get(Recipe, r).name) << "exactly 2 ingredients expected in '" << inst.original_string << "'\n" << end(); -307 break; +306 ¦ raise << maybe(get(Recipe, r).name) << "exactly 2 ingredients expected in '" << inst.original_string << "'\n" << end(); +307 ¦ break; 308 } 309 assert(is_literal(inst.ingredients.at(1))); 310 if (inst.ingredients.at(1).name.find_first_not_of("0123456789") != string::npos) { -311 // since first non-address in base type must be an exclusive container, we don't have to canonize -312 type_ordinal base_type = skip_addresses(inst.ingredients.at(0).type); -313 if (contains_key(Type, base_type)) { // otherwise we'll raise an error elsewhere -314 inst.ingredients.at(1).set_value(find_element_name(base_type, inst.ingredients.at(1).name, get(Recipe, r).name)); -315 trace(9993, "name") << "variant " << inst.ingredients.at(1).name << " of type " << get(Type, base_type).name << " has tag " << no_scientific(inst.ingredients.at(1).value) << end(); -316 } +311 ¦ // since first non-address in base type must be an exclusive container, we don't have to canonize +312 ¦ type_ordinal base_type = skip_addresses(inst.ingredients.at(0).type); +313 ¦ if (contains_key(Type, base_type)) { // otherwise we'll raise an error elsewhere +314 ¦ ¦ inst.ingredients.at(1).set_value(find_element_name(base_type, inst.ingredients.at(1).name, get(Recipe, r).name)); +315 ¦ ¦ trace(9993, "name") << "variant " << inst.ingredients.at(1).name << " of type " << get(Type, base_type).name << " has tag " << no_scientific(inst.ingredients.at(1).value) << end(); +316 ¦ } 317 } 318 } 319 -- cgit 1.4.1-2-gfad0