about summary refs log tree commit diff stats
path: root/020run.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-06-20 22:55:01 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-06-20 22:59:27 -0700
commit70179d1f132ab3170d9fda9b002f4d82af5b0a56 (patch)
treeccb15976c3678b7464108cf32000df97d5bee90c /020run.cc
parent9897c8177bba26946a54513f5a8113a375f205f0 (diff)
downloadmu-70179d1f132ab3170d9fda9b002f4d82af5b0a56.tar.gz
1611 - switch to keyboard+mouse events
Diffstat (limited to '020run.cc')
-rw-r--r--020run.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/020run.cc b/020run.cc
index 90413df3..9e6cbb2c 100644
--- a/020run.cc
+++ b/020run.cc
@@ -194,8 +194,10 @@ vector<double> read_memory(reagent x) {
 void write_memory(reagent x, vector<double> data) {
   if (is_dummy(x)) return;
   long long int base = x.value;
-  if (size_of(x) != SIZE(data))
-    raise << "size mismatch in storing to " << x.to_string() << '\n';
+  if (size_mismatch(x, data)) {
+    tb_shutdown();
+    raise << current_recipe_name() << ": size mismatch in storing to " << x.to_string() << " at " << current_instruction().to_string() << '\n' << die();
+  }
   for (long long int offset = 0; offset < SIZE(data); ++offset) {
     trace(Primitive_recipe_depth, "mem") << "storing " << data.at(offset) << " in location " << base+offset;
     Memory[base+offset] = data.at(offset);
@@ -211,6 +213,14 @@ long long int size_of(const vector<type_number>& types) {
   return 1;
 }
 
+bool size_mismatch(const reagent& x, const vector<double>& data) {
+  if (size_of(x) != SIZE(data)) {
+    tb_shutdown();
+    cerr << size_of(x) << " vs " << SIZE(data) << '\n';
+  }
+  return size_of(x) != SIZE(data);
+}
+
 bool is_dummy(const reagent& x) {
   return x.name == "_";
 }