about summary refs log tree commit diff stats
path: root/020run.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-05-18 16:45:32 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-05-18 16:45:32 -0700
commit56c0e796ef341f3f1640ee7d50963e3dffaca4fc (patch)
tree16bd76a09d4b5fe5263eac9fe2894c405ed63e04 /020run.cc
parent0be82cde0a56c48cd8b358b4cb81cb9490ce3012 (diff)
downloadmu-56c0e796ef341f3f1640ee7d50963e3dffaca4fc.tar.gz
2973 - reclaim refcounts for local scopes again
More thorough redo of commit 2767 (Mar 12), which was undone in commit
2810 (Mar 24). It's been a long slog. Next step: write a bunch of mu
code in the edit/ app in search of bugs.
Diffstat (limited to '020run.cc')
-rw-r--r--020run.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/020run.cc b/020run.cc
index f0e78b80..35eba974 100644
--- a/020run.cc
+++ b/020run.cc
@@ -90,9 +90,8 @@ void run_current_routine()
       raise << SIZE(products) << " vs " << SIZE(current_instruction().products) << ": failed to write to all products! " << to_original_string(current_instruction()) << '\n' << end();
     }
     else {
-      for (int i = 0; i < SIZE(current_instruction().products); ++i) {
-        write_memory(current_instruction().products.at(i), products.at(i));
-      }
+      for (int i = 0; i < SIZE(current_instruction().products); ++i)
+        write_memory(current_instruction().products.at(i), products.at(i), i);
     }
     // End of Instruction
     finish_instruction:;
@@ -267,7 +266,7 @@ vector<double> read_memory(reagent/*copy*/ x) {
   return result;
 }
 
-void write_memory(reagent/*copy*/ x, const vector<double>& data) {
+void write_memory(reagent/*copy*/ x, const vector<double>& data, const int /*only when called in the run loop above to save results; -1 otherwise*/ product_index) {
   // Begin Preprocess write_memory(x, data)
   if (!x.type) {
     raise << "can't write to " << to_string(x) << "; no type\n" << end();