about summary refs log tree commit diff stats
path: root/mu.arc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-11-04 18:35:13 -0800
committerKartik K. Agaram <vc@akkartik.com>2014-11-04 18:35:13 -0800
commite7d75e0bfa9015d18b8babc4ec9c5c1937658d69 (patch)
tree88db5ef8f20c544e73d94c35a5f993b6f87bd170 /mu.arc
parentebdb363695503e32d9003319ca33dde4b691e24f (diff)
downloadmu-e7d75e0bfa9015d18b8babc4ec9c5c1937658d69.tar.gz
228 - rudimentary read from channel
Diffstat (limited to 'mu.arc')
-rw-r--r--mu.arc9
1 files changed, 9 insertions, 0 deletions
diff --git a/mu.arc b/mu.arc
index 774da3e0..28009cc5 100644
--- a/mu.arc
+++ b/mu.arc
@@ -819,6 +819,15 @@
   ((free integer-address deref) <- add (free integer-address deref) (1 literal))
   (reply (chan channel)))
 
+(init-fn read
+  ((default-scope scope-address) <- new (scope literal) (30 literal))
+  ((chan channel) <- arg)
+  ((full integer-address) <- get-address (chan channel) (first-full offset))
+  ((q tagged-value-array-address) <- get (chan channel) (circular-buffer offset))
+  ((result tagged-value) <- index (q tagged-value-array-address deref) (full integer-address deref))
+  ((full integer-address deref) <- add (full integer-address deref) (1 literal))
+  (reply (result tagged-value) (chan channel)))
+
 ; drop all traces while processing above functions
 (on-init
   (= traces* (queue)))