diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-04-19 20:38:09 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-04-19 20:38:09 -0700 |
commit | 4be9a93be91b4d301aa8679af5ebcba82ff2049d (patch) | |
tree | 681b3a19635dca4b35de567835749c5ae9ee5135 /cpp/036call_ingredient | |
parent | 4b72aa8ba510376d5ed2576e328972433213058c (diff) | |
download | mu-4be9a93be91b4d301aa8679af5ebcba82ff2049d.tar.gz |
1103
Diffstat (limited to 'cpp/036call_ingredient')
-rw-r--r-- | cpp/036call_ingredient | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cpp/036call_ingredient b/cpp/036call_ingredient index 9b85aa55..9f156d65 100644 --- a/cpp/036call_ingredient +++ b/cpp/036call_ingredient @@ -13,6 +13,15 @@ recipe f [ +mem: location 12 is 2 +mem: storing 3 in location 13 +:(scenario "next_ingredient_missing") +recipe main [ + f +] +recipe f [ + _, 12:integer <- next-ingredient +] ++mem: storing 0 in location 12 + :(before "End call Fields") vector<vector<int> > ingredient_atoms; size_t next_ingredient_to_process; @@ -37,7 +46,19 @@ case NEXT_INGREDIENT: { << rr.calls.top().ingredient_atoms[rr.calls.top().next_ingredient_to_process][0]; write_memory(instructions[pc].products[0], rr.calls.top().ingredient_atoms[rr.calls.top().next_ingredient_to_process]); + if (instructions[pc].products.size() > 1) { + vector<int> ingredient_exists; + ingredient_exists.push_back(1); + write_memory(instructions[pc].products[1], ingredient_exists); + } ++rr.calls.top().next_ingredient_to_process; } + else { + if (instructions[pc].products.size() > 1) { + vector<int> no_ingredient; + no_ingredient.push_back(0); + write_memory(instructions[pc].products[1], no_ingredient); + } + } break; } |