about summary refs log tree commit diff stats
path: root/084console.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-04-16 15:50:56 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-04-16 15:50:56 -0700
commit0d2686c751248d0abf8e5f9500aaa6b736666fc4 (patch)
tree40ce2376d6d2f0af2635f3c67c2973f2464110a2 /084console.mu
parent00600d8332b6db6c63d081c90ea67e48a5f1b611 (diff)
downloadmu-0d2686c751248d0abf8e5f9500aaa6b736666fc4.tar.gz
2844 - purge get-address from all layers
Only apps left now, and the wait-for-location uses in the channel
primitives.
Diffstat (limited to '084console.mu')
-rw-r--r--084console.mu14
1 files changed, 6 insertions, 8 deletions
diff --git a/084console.mu b/084console.mu
index cfa0521a..de77c7fe 100644
--- a/084console.mu
+++ b/084console.mu
@@ -29,10 +29,7 @@ def new-fake-console events:address:shared:array:event -> result:address:shared:
   local-scope
   load-ingredients
   result:address:shared:console <- new console:type
-  buf:address:address:shared:array:event <- get-address *result, events:offset
-  *buf <- copy events
-  idx:address:number <- get-address *result, current-event-index:offset
-  *idx <- copy 0
+  *result <- put *result, events:offset, events
 ]
 
 def read-event console:address:shared:console -> result:event, console:address:shared:console, found?:boolean, quit?:boolean [
@@ -40,17 +37,18 @@ def read-event console:address:shared:console -> result:event, console:address:s
   load-ingredients
   {
     break-unless console
-    current-event-index:address:number <- get-address *console, current-event-index:offset
+    current-event-index:number <- get *console, current-event-index:offset
     buf:address:shared:array:event <- get *console, events:offset
     {
       max:number <- length *buf
-      done?:boolean <- greater-or-equal *current-event-index, max
+      done?:boolean <- greater-or-equal current-event-index, max
       break-unless done?
       dummy:address:shared:event <- new event:type
       return *dummy, console/same-as-ingredient:0, 1/found, 1/quit
     }
-    result <- index *buf, *current-event-index
-    *current-event-index <- add *current-event-index, 1
+    result <- index *buf, current-event-index
+    current-event-index <- add current-event-index, 1
+    *console <- put *console, current-event-index:offset, current-event-index
     return result, console/same-as-ingredient:0, 1/found, 0/quit
   }
   switch  # real event source is infrequent; avoid polling it too much