From c5ffb6e1cc9c5ff880d037c53b8ebc8562be0008 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 25 May 2015 22:27:19 -0700 Subject: 1459 --- html/043space.cc.html | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) (limited to 'html/043space.cc.html') diff --git a/html/043space.cc.html b/html/043space.cc.html index 66e073b3..0007e765 100644 --- a/html/043space.cc.html +++ b/html/043space.cc.html @@ -2,7 +2,7 @@ -~/Desktop/s/mu/043space.cc +043space.cc @@ -13,14 +13,15 @@ pre { white-space: pre-wrap; font-family: monospace; color: #d0d0d0; background-color: #000000; } body { font-family: monospace; color: #d0d0d0; background-color: #000000; } * { font-size: 1em; } -.cSpecial { color: #008000; } -.Identifier { color: #008080; } +.traceAbsent { color: #c00000; } +.CommentedCode { color: #6c6c6c; } .Constant { color: #008080; } .Comment { color: #8080ff; } .Delimiter { color: #c000c0; } .Special { color: #ff6060; } -.CommentedCode { color: #6c6c6c; } +.Identifier { color: #008080; } .SalientComment { color: #00ffff; } +.cSpecial { color: #008000; } .traceContains { color: #008000; } --> @@ -33,7 +34,7 @@ body { font-family: monospace; color: #d0d0d0; background-color: #000000; }
-//: Spaces help isolate functions from each other. You can create them at will,
+//: Spaces help isolate recipes from each other. You can create them at will,
 //: and all addresses in arguments are implicitly based on the 'default-space'
 //: (unless they have the /raw property)
 
@@ -53,17 +54,32 @@ recipe main [
   3:number <- copy 34:literal
   # pretend array
   1000:number <- copy 5:literal
-  # actual start of this function
+  # actual start of this recipe
   default-space:address:array:location <- copy 1000:literal
   1:address:number <- copy 3:literal
   8:number/raw <- copy 1:address:number/deref
 ]
 +mem: storing 34 in location 8
 
+//:: first disable name conversion for 'default-space'
+:(scenario convert_names_passes_default_space)
+recipe main [
+  default-space:number, x:number <- copy 0:literal, 1:literal
+]
++name: assign x 1
+-name: assign default-space 1
+
+:(before "End Disqualified Reagents")
+if (x.name == "default-space")
+  x.initialized = true;
+:(before "End is_special_name Cases")
+if (s == "default-space") return true;
+
+//:: now implement space support
 :(before "End call Fields")
-index_t default_space;
-:(replace "call(recipe_number r) :running_recipe(r)")
-call(recipe_number r) :running_recipe(r), running_step_index(0), next_ingredient_to_process(0), default_space(0) {}
+long long int default_space;
+:(before "End call Constructor")
+default_space = 0;
 
 :(replace "reagent r = x" following "reagent canonize(reagent x)")
 reagent r = absolutize(x);
@@ -95,7 +111,7 @@ recipe main [
   13:number <- copy 35:literal
   # pretend array
   1000:number <- copy 5:literal
-  # actual start of this function
+  # actual start of this recipe
   default-space:address:array:location <- copy 1000:literal
   1:address:point <- copy 12:literal
   9:number/raw <- get 1:address:point/deref, 1:offset
@@ -115,7 +131,7 @@ recipe main [
   14:number <- copy 35:literal
   # pretend array
   1000:number <- copy 5:literal
-  # actual start of this function
+  # actual start of this recipe
   default-space:address:array:location <- copy 1000:literal
   1:address:array:number <- copy 12:literal
   9:number/raw <- index 1:address:array:number/deref, 1:literal
@@ -128,14 +144,14 @@ tmp.properties.pus
 //:: helpers
 
 :(code)
-index_t space_base(const reagent& x) {
+long long int space_base(const reagent& x) {
   return Current_routine->calls.front().default_space;
 }
 
-index_t address(index_t offset, index_t base) {
+long long int address(long long int offset, long long int base) {
   if (base == 0) return offset;  // raw
 //?   cout << base << '\n'; //? 2
-  if (offset >= static_cast<index_t>(Memory[base])) {
+  if (offset >= static_cast<long long int>(Memory[base])) {
     // todo: test
     raise << "location " << offset << " is out of bounds " << Memory[base] << '\n';
   }
@@ -144,7 +160,7 @@ index_t address(index_t offset:(after "void write_memory(reagent x, vector<double> data)")
   if (x.name == "default-space") {
-    assert(data.size() == 1);
+    assert(scalar(data));
     Current_routine->calls.front().default_space = data.at(0);
 //?     cout << "AAA " << Current_routine->calls.front().default_space << '\n'; //? 1
     return;
-- 
cgit 1.4.1-2-gfad0