From b81abc2476cc610120e82d38faae9db193d23ac3 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 29 Oct 2014 22:39:21 -0700 Subject: 175 - have 'new' write array size automatically --- edit.mu | 2 -- mu.arc | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/edit.mu b/edit.mu index 87433cb2..27dd3e68 100644 --- a/edit.mu +++ b/edit.mu @@ -4,13 +4,11 @@ ((601 integer) <- arg) ((602 integer) <- arg) ((603 screen-address) <- new (screen type) (601 integer)) - ((603 integer-address deref) <- copy (601 integer)) ((604 integer) <- copy (0 literal)) { begin ((606 line-address-address) <- index-address (603 screen-address deref) (604 integer)) ((606 line-address-address deref) <- new (line type) (602 integer)) ((605 line-address) <- copy (606 line-address-address deref)) - ((605 integer-address deref) <- copy (602 integer)) ((604 integer) <- add (604 integer) (1 literal)) ((607 boolean) <- neq (604 integer) (601 integer)) (continue-if (607 boolean)) diff --git a/mu.arc b/mu.arc index 47d50cea..de5b1f1e 100644 --- a/mu.arc +++ b/mu.arc @@ -521,7 +521,8 @@ (def new-array (type size) ;? (prn "new array: @type @size") (ret result Memory-in-use-until - (++ Memory-in-use-until (+ 1 (* (sizeof types*.type!elem) size))))) + (++ Memory-in-use-until (+ 1 (* (sizeof types*.type!elem) size))) + (= (memory* result) size))) (def sizeof (type) (trace "sizeof" type) -- cgit 1.4.1-2-gfad0