diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-08-02 22:18:19 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-08-02 22:18:19 -0700 |
commit | cfb142b9601cc648f15bf5738a3df09a23835e41 (patch) | |
tree | 670f168fbbf2693b17d679939bd1c203de1c3837 /032array.cc | |
parent | 37900254f083364dcfbb80cf7119c230a0b603d6 (diff) | |
download | mu-cfb142b9601cc648f15bf5738a3df09a23835e41.tar.gz |
1923
Still iterating on the right way to handle incorrect number of ingredients. My first idea of creating null results doesn't really work once they're used in later instructions. Just add a warning at one place in the run loop, but otherwise only add products when there's something to save in them. Undoes some work around commit 1886.
Diffstat (limited to '032array.cc')
-rw-r--r-- | 032array.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/032array.cc b/032array.cc index eae33f4c..54e69e79 100644 --- a/032array.cc +++ b/032array.cc @@ -79,7 +79,6 @@ INDEX, Recipe_ordinal["index"] = INDEX; :(before "End Primitive Recipe Implementations") case INDEX: { - products.resize(1); if (SIZE(ingredients) != 2) { raise << current_recipe_name() << ": 'index' expects exactly 2 ingredients in '" << current_instruction().to_string() << "'\n" << end(); break; @@ -107,7 +106,7 @@ case INDEX: { reagent tmp; tmp.set_value(src); copy(element_type.begin(), element_type.end(), inserter(tmp.types, tmp.types.begin())); - products.at(0) = read_memory(tmp); + products.push_back(read_memory(tmp)); break; } @@ -175,7 +174,6 @@ INDEX_ADDRESS, Recipe_ordinal["index-address"] = INDEX_ADDRESS; :(before "End Primitive Recipe Implementations") case INDEX_ADDRESS: { - products.resize(1); if (SIZE(ingredients) != 2) { raise << current_recipe_name() << ": 'index-address' expects exactly 2 ingredients in '" << current_instruction().to_string() << "'\n" << end(); break; @@ -198,6 +196,7 @@ case INDEX_ADDRESS: { break; } 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; } @@ -250,7 +249,6 @@ LENGTH, Recipe_ordinal["length"] = LENGTH; :(before "End Primitive Recipe Implementations") case LENGTH: { - products.resize(1); if (SIZE(ingredients) != 1) { raise << current_recipe_name() << ": 'length' expects exactly 2 ingredients in '" << current_instruction().to_string() << "'\n" << end(); break; @@ -264,6 +262,7 @@ case LENGTH: { raise << current_recipe_name() << ": tried to access location 0 in '" << current_instruction().to_string() << "'\n" << end(); break; } + products.resize(1); products.at(0).push_back(Memory[x.value]); break; } |