about summary refs log tree commit diff stats
path: root/cpp
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-14 17:46:43 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-14 17:46:43 -0700
commite05847550c276debb831eb4853474b0da38614ef (patch)
tree2825eb7d50600b267731b6832fca0d61759c834d /cpp
parent6d6b656fa939e6af886f14d37736f3215a8694fc (diff)
downloadmu-e05847550c276debb831eb4853474b0da38614ef.tar.gz
1061
Diffstat (limited to 'cpp')
-rw-r--r--cpp/.traces/get_default_space14
-rw-r--r--cpp/027space14
2 files changed, 28 insertions, 0 deletions
diff --git a/cpp/.traces/get_default_space b/cpp/.traces/get_default_space
new file mode 100644
index 00000000..1d521c90
--- /dev/null
+++ b/cpp/.traces/get_default_space
@@ -0,0 +1,14 @@
+parse/0: instruction: 1
+parse/0:   ingredient: {name: "10", value: 0, type: 0, properties: ["10": "literal"]}
+parse/0:   product: {name: "default-space", value: 0, type: 2-0, properties: ["default-space": "address":"space"]}
+parse/0: instruction: 1
+parse/0:   ingredient: {name: "default-space", value: 0, type: 2-0, properties: ["default-space": "address":"space"]}
+parse/0:   product: {name: "1", value: 0, type: 1, properties: ["1": "integer", "raw": ]}
+after-brace/0: recipe main
+after-brace/0: copy ...
+after-brace/0: copy ...
+run/0: instruction main/0
+run/0: ingredient 0 is 10
+run/0: instruction main/1
+run/0: ingredient 0 is default-space
+mem/0: storing 10 in location 1
diff --git a/cpp/027space b/cpp/027space
index 7794db23..9d3ef572 100644
--- a/cpp/027space
+++ b/cpp/027space
@@ -71,3 +71,17 @@ int address(int offset, int base) {
 //?     cout << "AAA " << Current_routine.calls.top().default_space << '\n'; //? 1
     return;
   }
+
+:(scenario "get_default_space")
+recipe main [
+  default-space:address:space <- copy 10:literal
+  1:integer/raw <- copy default-space:address:space
+]
++mem: storing 10 in location 1
+
+:(after "vector<int> read_memory(reagent x)")
+  if (x.name == "default-space") {
+    vector<int> result;
+    result.push_back(Current_routine.calls.top().default_space);
+    return result;
+  }