about summary refs log tree commit diff stats
path: root/cpp/027space
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-14 19:06:57 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-14 19:08:38 -0700
commit82ac0b7ecbc145ed8c8ecd8309166f654af1ee75 (patch)
treefb24d253bec1b3a24bf9d3e6d746111dbf4b856f /cpp/027space
parent0edf822f996c5def4588cc207d1977cffc3e9a0c (diff)
downloadmu-82ac0b7ecbc145ed8c8ecd8309166f654af1ee75.tar.gz
1063 - variable names for surrounding spaces now work
This was a pain to debug.
Diffstat (limited to 'cpp/027space')
-rw-r--r--cpp/027space9
1 files changed, 6 insertions, 3 deletions
diff --git a/cpp/027space b/cpp/027space
index 2a845015..1bb91b8e 100644
--- a/cpp/027space
+++ b/cpp/027space
@@ -35,13 +35,15 @@ call(recipe_number r) :running_recipe(r), pc(0), next_ingredient_to_process(0),
 reagent r = absolutize(x);
 :(code)
 reagent absolutize(reagent x) {
-//?   cout << "absolutize " << x.to_string() << '\n'; //? 2
+//?   if (Recipe_number.find("increment-counter") != Recipe_number.end()) //? 1
+//?     cout << "AAA " << "increment-counter/2: " << Recipe[Recipe_number["increment-counter"]].steps[2].products[0].to_string() << '\n'; //? 1
+//?   cout << "absolutize " << x.to_string() << '\n'; //? 3
 //?   cout << is_raw(x) << '\n'; //? 1
   if (is_raw(x) || is_dummy(x)) return x;
 //?   cout << "not raw: " << x.to_string() << '\n'; //? 1
   assert(x.initialized);
   reagent r = x;
-  r.set_value(address(r.value, space(r)));
+  r.set_value(address(r.value, space_base(r)));
 //?   cout << "after absolutize: " << r.value << '\n'; //? 1
   r.properties.push_back(pair<string, vector<string> >("raw", vector<string>()));
   assert(is_raw(r));
@@ -51,12 +53,13 @@ reagent absolutize(reagent x) {
 result.properties.push_back(pair<string, vector<string> >("raw", vector<string>()));
 
 :(code)
-int space(const reagent& x) {
+int space_base(const reagent& x) {
   return Current_routine->calls.top().default_space;
 }
 
 int address(int offset, int base) {
   if (base == 0) return offset;  // raw
+//?   cout << base << '\n'; //? 1
   if (offset >= Memory[base]) {
     // todo: test
     raise << "location " << offset << " is out of bounds " << Memory[base] << '\n';