about summary refs log tree commit diff stats
path: root/031address.cc
diff options
context:
space:
mode:
Diffstat (limited to '031address.cc')
-rw-r--r--031address.cc34
1 files changed, 17 insertions, 17 deletions
diff --git a/031address.cc b/031address.cc
index 657b7459..a069f332 100644
--- a/031address.cc
+++ b/031address.cc
@@ -1,12 +1,12 @@
 //: Instructions can read from addresses pointing at other locations using the
-//: 'deref' property.
+//: 'lookup' property.
 
 :(scenario copy_indirect)
 recipe main [
   1:address:number <- copy 2
   2:number <- copy 34
   # This loads location 1 as an address and looks up *that* location.
-  3:number <- copy 1:address:number/deref
+  3:number <- copy 1:address:number/lookup
 ]
 +mem: storing 34 in location 3
 
@@ -14,11 +14,11 @@ recipe main [
 x = canonize(x);
 
 //: similarly, write to addresses pointing at other locations using the
-//: 'deref' property
+//: 'lookup' property
 :(scenario store_indirect)
 recipe main [
   1:address:number <- copy 2
-  1:address:number/deref <- copy 34
+  1:address:number/lookup <- copy 34
 ]
 +mem: storing 34 in location 2
 
@@ -31,22 +31,22 @@ reagent canonize(reagent x) {
 //?   cout << "canonize\n"; //? 1
   reagent r = x;
 //?   cout << x.to_string() << " => " << r.to_string() << '\n'; //? 1
-  while (has_property(r, "deref"))
-    r = deref(r);
+  while (has_property(r, "lookup"))
+    r = lookup_memory(r);
   return r;
 }
 
-reagent deref(reagent x) {
-//?   cout << "deref: " << x.to_string() << "\n"; //? 2
+reagent lookup_memory(reagent x) {
+//?   cout << "lookup_memory: " << x.to_string() << "\n"; //? 2
   static const type_ordinal ADDRESS = Type_ordinal["address"];
   reagent result;
   if (x.types.at(0) != ADDRESS) {
-    raise << current_recipe_name() << ": tried to /deref " << x.original_string << " but it isn't an address\n" << end();
+    raise << current_recipe_name() << ": tried to /lookup " << x.original_string << " but it isn't an address\n" << end();
     return result;
   }
   // compute value
   if (x.value == 0) {
-    raise << current_recipe_name() << ": tried to /deref 0\n" << end();
+    raise << current_recipe_name() << ": tried to /lookup 0\n" << end();
     return result;
   }
   result.set_value(Memory[x.value]);
@@ -55,14 +55,14 @@ reagent deref(reagent x) {
   // populate types
   copy(++x.types.begin(), x.types.end(), inserter(result.types, result.types.begin()));
 
-  // drop-one 'deref'
+  // drop-one 'lookup'
   long long int i = 0;
   long long int len = SIZE(x.properties);
   for (i = 0; i < len; ++i) {
-    if (x.properties.at(i).first == "deref") break;
+    if (x.properties.at(i).first == "lookup") break;
     result.properties.push_back(x.properties.at(i));
   }
-  ++i;  // skip first deref
+  ++i;  // skip first lookup
   for (; i < len; ++i) {
     result.properties.push_back(x.properties.at(i));
   }
@@ -75,16 +75,16 @@ recipe main [
   1:number <- copy 2
   2:number <- copy 34
   3:number <- copy 35
-  4:number <- get 1:address:point/deref, 0:offset
+  4:number <- get 1:address:point/lookup, 0:offset
 ]
 +mem: storing 34 in location 4
 
-:(scenario include_nonderef_properties)
+:(scenario include_nonlookup_properties)
 recipe main [
   1:number <- copy 2
   2:number <- copy 34
   3:number <- copy 35
-  4:number <- get 1:address:point/deref/foo, 0:offset
+  4:number <- get 1:address:point/lookup/foo, 0:offset
 ]
 +mem: storing 34 in location 4
 
@@ -97,7 +97,7 @@ recipe main [
   1:number <- copy 2
   2:number <- copy 34
   3:number <- copy 35
-  4:number <- get-address 1:address:point/deref, 0:offset
+  4:number <- get-address 1:address:point/lookup, 0:offset
 ]
 +mem: storing 2 in location 4