From 82ac0b7ecbc145ed8c8ecd8309166f654af1ee75 Mon Sep 17 00:00:00 2001
From: "Kartik K. Agaram" <vc@akkartik.com>
Date: Tue, 14 Apr 2015 19:06:57 -0700
Subject: 1063 - variable names for surrounding spaces now work

This was a pain to debug.
---
 cpp/027space | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'cpp/027space')

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';
-- 
cgit 1.4.1-2-gfad0