From eaeb955212eb3b133fd98d98457f17bfea8891d1 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 6 Aug 2015 19:15:57 -0700 Subject: 1949 --- html/032array.cc.html | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'html/032array.cc.html') diff --git a/html/032array.cc.html b/html/032array.cc.html index 249453b3..7332dd0c 100644 --- a/html/032array.cc.html +++ b/html/032array.cc.html @@ -14,9 +14,10 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background- body { font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 1.05em; } .traceContains { color: #008000; } +.SalientComment { color: #00ffff; } .Constant { color: #00a0a0; } .cSpecial { color: #008000; } -.SalientComment { color: #00ffff; } +.Normal { color: #eeeeee; background-color: #080808; padding-bottom: 1px; } .Comment { color: #9090ff; } .Delimiter { color: #a04060; } .Special { color: #ff6060; } @@ -73,10 +74,10 @@ recipe main [ //: disable the size mismatch check since the destination array need not be initialized :(before "End size_mismatch(x) Cases") -if (x.types.at(0) == Type_ordinal["array"]) return false; +if (x.types.at(0) == Type_ordinal["array"]) return false; :(before "End size_of(reagent) Cases") - if (r.types.at(0) == Type_ordinal["array"]) { - if (SIZE(r.types) == 1) { + if (r.types.at(0) == Type_ordinal["array"]) { + if (SIZE(r.types) == 1) { raise << current_recipe_name() << ": '" << r.original_string << "' is an array of what?\n" << end(); return 1; } @@ -112,29 +113,29 @@ INDEX, :(before "End Primitive Recipe Numbers") Recipe_ordinal["index"] = INDEX; :(before "End Primitive Recipe Implementations") -case INDEX: { - if (SIZE(ingredients) != 2) { +case INDEX: { + if (SIZE(ingredients) != 2) { raise << current_recipe_name() << ": 'index' expects exactly 2 ingredients in '" << current_instruction().to_string() << "'\n" << end(); break; } reagent base = canonize(current_instruction().ingredients.at(0)); - if (base.types.at(0) != Type_ordinal["array"]) { + if (base.types.at(0) != Type_ordinal["array"]) { raise << current_recipe_name () << ": 'index' on a non-array " << base.original_string << '\n' << end(); break; } - long long int base_address = base.value; - if (base_address == 0) { + long long int base_address = base.value; + if (base_address == 0) { raise << current_recipe_name() << ": tried to access location 0 in '" << current_instruction().to_string() << "'\n" << end(); break; } reagent offset = canonize(current_instruction().ingredients.at(1)); - vector<double> offset_val(read_memory(offset)); + vector<double> offset_val(read_memory(offset)); vector<type_ordinal> element_type = array_element(base.types); - if (offset_val.at(0) < 0 || offset_val.at(0) >= Memory[base_address]) { + if (offset_val.at(0) < 0 || offset_val.at(0) >= Memory[base_address]) { raise << current_recipe_name() << ": invalid index " << offset_val.at(0) << '\n' << end(); break; } - long long int src = base_address + 1 + offset_val.at(0)*size_of(element_type); + long long int src = base_address + 1 + offset_val.at(0)*size_of(element_type); trace(Primitive_recipe_depth, "run") << "address to copy is " << src << end(); trace(Primitive_recipe_depth, "run") << "its type is " << Type[element_type.at(0)].name << end(); reagent tmp; @@ -145,7 +146,7 @@ case INDEX: { } :(code) -vector<type_ordinal> array_element(const vector<type_ordinal>& types) { +vector<type_ordinal> array_element(const vector<type_ordinal>& types) { return vector<type_ordinal>(++types.begin(), types.end()); } @@ -207,29 +208,29 @@ INDEX_ADDRESS, :(before "End Primitive Recipe Numbers") Recipe_ordinal["index-address"] = INDEX_ADDRESS; :(before "End Primitive Recipe Implementations") -case INDEX_ADDRESS: { - if (SIZE(ingredients) != 2) { +case INDEX_ADDRESS: { + if (SIZE(ingredients) != 2) { raise << current_recipe_name() << ": 'index-address' expects exactly 2 ingredients in '" << current_instruction().to_string() << "'\n" << end(); break; } reagent base = canonize(current_instruction().ingredients.at(0)); - if (base.types.at(0) != Type_ordinal["array"]) { + if (base.types.at(0) != Type_ordinal["array"]) { raise << current_recipe_name () << ": 'index-address' on a non-array " << base.original_string << '\n' << end(); break; } - long long int base_address = base.value; - if (base_address == 0) { + long long int base_address = base.value; + if (base_address == 0) { raise << current_recipe_name() << ": tried to access location 0 in '" << current_instruction().to_string() << "'\n" << end(); break; } reagent offset = canonize(current_instruction().ingredients.at(1)); - vector<double> offset_val(read_memory(offset)); + vector<double> offset_val(read_memory(offset)); vector<type_ordinal> element_type = array_element(base.types); - if (offset_val.at(0) < 0 || offset_val.at(0) >= Memory[base_address]) { + if (offset_val.at(0) < 0 || offset_val.at(0) >= Memory[base_address]) { raise << current_recipe_name() << ": invalid index " << offset_val.at(0) << '\n' << end(); break; } - long long int result = base_address + 1 + offset_val.at(0)*size_of(element_type); + long long int result = base_address + 1 + offset_val.at(0)*size_of(element_type); products.resize(1); products.at(0).push_back(result); break; @@ -282,17 +283,17 @@ LENGTH, :(before "End Primitive Recipe Numbers") Recipe_ordinal["length"] = LENGTH; :(before "End Primitive Recipe Implementations") -case LENGTH: { - if (SIZE(ingredients) != 1) { +case LENGTH: { + if (SIZE(ingredients) != 1) { raise << current_recipe_name() << ": 'length' expects exactly 2 ingredients in '" << current_instruction().to_string() << "'\n" << end(); break; } reagent x = canonize(current_instruction().ingredients.at(0)); - if (x.types.at(0) != Type_ordinal["array"]) { + if (x.types.at(0) != Type_ordinal["array"]) { raise << "tried to calculate length of non-array " << x.original_string << '\n' << end(); break; } - if (x.value == 0) { + if (x.value == 0) { raise << current_recipe_name() << ": tried to access location 0 in '" << current_instruction().to_string() << "'\n" << end(); break; } -- cgit 1.4.1-2-gfad0