about summary refs log tree commit diff stats
path: root/031address.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-24 21:41:26 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-24 21:41:26 -0700
commit1fad5eefd951ccc65c55a2fa5040932441bd965a (patch)
treefb5b5c26704f9e0dd435413d7c526773c1f5158f /031address.cc
parent7e423e268bd0a07f43f5114eb015548d04331eb2 (diff)
downloadmu-1fad5eefd951ccc65c55a2fa5040932441bd965a.tar.gz
1842 - get layers building again after 2 weeks
Also, turns out I haven't been building 999spaces.cc in my default
build. Now fixed.
Diffstat (limited to '031address.cc')
-rw-r--r--031address.cc73
1 files changed, 61 insertions, 12 deletions
diff --git a/031address.cc b/031address.cc
index 9c63ebe3..4df2518c 100644
--- a/031address.cc
+++ b/031address.cc
@@ -98,20 +98,69 @@ recipe main [
 :(after "reagent base = " following "case GET_ADDRESS:")
 base = canonize(base);
 
-//:: helpers
-
-:(code)
-bool has_property(reagent x, string name) {
-  for (long long int i = /*skip name:type*/1; i < SIZE(x.properties); ++i) {
-    if (x.properties.at(i).first == name) return true;
+//:: Helpers for debugging
+
+:(before "End Primitive Recipe Declarations")
+_DUMP_TRACE,
+:(before "End Primitive Recipe Numbers")
+Recipe_ordinal["$dump-trace"] = _DUMP_TRACE;
+:(before "End Primitive Recipe Implementations")
+case _DUMP_TRACE: {
+  if (ingredients.empty()) {
+    DUMP("");
+  }
+  else {
+    DUMP(current_instruction().ingredients.at(0).name);
   }
-  return false;
+  break;
+}
+
+:(before "End Primitive Recipe Declarations")
+_CLEAR_TRACE,
+:(before "End Primitive Recipe Numbers")
+Recipe_ordinal["$clear-trace"] = _CLEAR_TRACE;
+:(before "End Primitive Recipe Implementations")
+case _CLEAR_TRACE: {
+  CLEAR_TRACE;
+  break;
 }
 
-vector<string> property(const reagent& r, const string& name) {
-  for (long long int p = /*skip name:type*/1; p != SIZE(r.properties); ++p) {
-    if (r.properties.at(p).first == name)
-      return r.properties.at(p).second;
+:(before "End Primitive Recipe Declarations")
+_DUMP_MEMORY,
+:(before "End Primitive Recipe Numbers")
+Recipe_ordinal["$dump-memory"] = _DUMP_MEMORY;
+:(before "End Primitive Recipe Implementations")
+case _DUMP_MEMORY: {
+  dump_memory();
+  break;
+}
+
+:(before "End Primitive Recipe Declarations")
+_DUMP,
+:(before "End Primitive Recipe Numbers")
+Recipe_ordinal["$dump"] = _DUMP;
+:(before "End Primitive Recipe Implementations")
+case _DUMP: {
+  reagent after_canonize = canonize(current_instruction().ingredients.at(0));
+  cerr << current_recipe_name() << ": " << current_instruction().ingredients.at(0).name << ' ' << current_instruction().ingredients.at(0).value << " => " << after_canonize.value << " => " << Memory[after_canonize.value] << '\n';
+  break;
+}
+
+//: grab an address, and then dump its value at intervals
+:(before "End Globals")
+long long int foo = -1;
+:(before "End Primitive Recipe Declarations")
+_FOO,
+:(before "End Primitive Recipe Numbers")
+Recipe_ordinal["$foo"] = _FOO;
+:(before "End Primitive Recipe Implementations")
+case _FOO: {
+  if (current_instruction().ingredients.empty()) {
+    if (foo != -1) cerr << foo << ": " << Memory[foo] << '\n';
+    else cerr << '\n';
+  }
+  else {
+    foo = canonize(current_instruction().ingredients.at(0)).value;
   }
-  return vector<string>();
+  break;
 }