diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-04-16 11:47:41 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-04-16 11:47:41 -0700 |
commit | 748b6865fc333d517905aba6cdd17d920a2ba53c (patch) | |
tree | af276ba5e287435eff1aa51c99dbfcebd6c2b88b | |
parent | 15f3b222f699b12e87c148aad5e33d877e934aef (diff) | |
download | mu-748b6865fc333d517905aba6cdd17d920a2ba53c.tar.gz |
2842 - purge get-address until layer 80
-rw-r--r-- | 077stream.mu | 19 | ||||
-rw-r--r-- | 079table.mu | 6 |
2 files changed, 11 insertions, 14 deletions
diff --git a/077stream.mu b/077stream.mu index c3af2ddf..305a150f 100644 --- a/077stream.mu +++ b/077stream.mu @@ -8,27 +8,26 @@ def new-stream s:address:shared:array:character -> result:address:shared:stream local-scope load-ingredients result <- new stream:type - i:address:number <- get-address *result, index:offset - *i <- copy 0 - d:address:address:shared:array:character <- get-address *result, data:offset - *d <- copy s + *result <- put *result, index:offset, 0 + *result <- put *result, data:offset, s ] def rewind-stream in:address:shared:stream -> in:address:shared:stream [ local-scope load-ingredients - x:address:number <- get-address *in, index:offset - *x <- copy 0 + *in <- put *in, index:offset, 0 ] def read-line in:address:shared:stream -> result:address:shared:array:character, in:address:shared:stream [ local-scope load-ingredients - idx:address:number <- get-address *in, index:offset + idx:number <- get *in, index:offset s:address:shared:array:character <- get *in, data:offset - next-idx:number <- find-next s, 10/newline, *idx - result <- copy-range s, *idx, next-idx - *idx <- add next-idx, 1 # skip newline + next-idx:number <- find-next s, 10/newline, idx + result <- copy-range s, idx, next-idx + idx <- add next-idx, 1 # skip newline + # write back + *in <- put *in, index:offset, idx ] def end-of-stream? in:address:shared:stream -> result:boolean [ diff --git a/079table.mu b/079table.mu index 56b7c9fd..2ef03fa6 100644 --- a/079table.mu +++ b/079table.mu @@ -40,10 +40,8 @@ def new-table capacity:number -> result:address:shared:table:_key:_value [ local-scope load-ingredients result <- new {(table _key _value): type} - tmp:address:number <- get-address *result, capacity:offset - *tmp <- copy capacity - data:address:address:shared:array:table_row:_key:_value <- get-address *result, data:offset - *data <- new {(table_row _key _value): type}, capacity + data:address:shared:array:table_row:_key:_value <- new {(table_row _key _value): type}, capacity + *result <- merge 0/length, capacity, data ] def put table:address:shared:table:_key:_value, key:_key, value:_value -> table:address:shared:table:_key:_value [ |