diff options
Diffstat (limited to '066stream.mu')
-rw-r--r-- | 066stream.mu | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/066stream.mu b/066stream.mu index 4c77319a..36c311c1 100644 --- a/066stream.mu +++ b/066stream.mu @@ -7,38 +7,38 @@ container stream [ recipe new-stream [ local-scope result:address:stream <- new stream:type - i:address:number <- get-address result:address:stream/deref, index:offset - i:address:number/deref <- copy 0 - d:address:address:array:character <- get-address result:address:stream/deref, data:offset - d:address:address:array:character/deref <- next-ingredient + i:address:number <- get-address result:address:stream/lookup, index:offset + i:address:number/lookup <- copy 0 + d:address:address:array:character <- get-address result:address:stream/lookup, data:offset + d:address:address:array:character/lookup <- next-ingredient reply result:address:stream ] recipe rewind-stream [ local-scope in:address:stream <- next-ingredient - x:address:number <- get-address in:address:stream/deref, index:offset - x:address:number/deref <- copy 0 + x:address:number <- get-address in:address:stream/lookup, index:offset + x:address:number/lookup <- copy 0 reply in:address:stream/same-as-arg:0 ] recipe read-line [ local-scope in:address:stream <- next-ingredient - idx:address:number <- get-address in:address:stream/deref, index:offset - s:address:array:character <- get in:address:stream/deref, data:offset - next-idx:number <- find-next s:address:array:character, 10/newline, idx:address:number/deref - result:address:array:character <- string-copy s:address:array:character, idx:address:number/deref, next-idx:number - idx:address:number/deref <- add next-idx:number, 1 # skip newline + idx:address:number <- get-address in:address:stream/lookup, index:offset + s:address:array:character <- get in:address:stream/lookup, data:offset + next-idx:number <- find-next s:address:array:character, 10/newline, idx:address:number/lookup + result:address:array:character <- string-copy s:address:array:character, idx:address:number/lookup, next-idx:number + idx:address:number/lookup <- add next-idx:number, 1 # skip newline reply result:address:array:character ] recipe end-of-stream? [ local-scope in:address:stream <- next-ingredient - idx:number <- get in:address:stream/deref, index:offset - s:address:array:character <- get in:address:stream/deref, data:offset - len:number <- length s:address:array:character/deref + idx:number <- get in:address:stream/lookup, index:offset + s:address:array:character <- get in:address:stream/lookup, data:offset + len:number <- length s:address:array:character/lookup result:boolean <- greater-or-equal idx:number, len:number reply result:boolean ] |