diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/tile/environment.mu | 6 | ||||
-rw-r--r-- | apps/tile/table.mu | 27 |
2 files changed, 31 insertions, 2 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu index e2eaa13c..597cad95 100644 --- a/apps/tile/environment.mu +++ b/apps/tile/environment.mu @@ -1363,7 +1363,10 @@ fn render-line screen: (addr screen), functions: (addr handle function), binding #? print-string 0, "rendering column from " #? print-int32-decimal 0, curr-col #? print-string 0, "\n" - curr-col <- render-column screen, functions, bindings, first-line, line, curr-word, top-row, curr-col + var bindings2-storage: table + var bindings2/ebx: (addr table) <- address bindings2-storage + shallow-copy-table-values bindings, bindings2 + curr-col <- render-column screen, functions, bindings2, first-line, line, curr-word, top-row, curr-col # cache cursor column if necessary $render-line:cache-cursor-column: { #? print-string 0, "cache cursor? " @@ -1431,7 +1434,6 @@ fn render-column screen: (addr screen), functions: (addr handle function), bindi var stack: value-stack var stack-addr/edi: (addr value-stack) <- address stack initialize-value-stack stack-addr, 0x10 # max-words - initialize-table bindings, 0x10 evaluate functions, bindings, first-line, final-word, stack-addr # render stack var curr-row/edx: int <- copy top-row diff --git a/apps/tile/table.mu b/apps/tile/table.mu index a4a2bae6..23924d16 100644 --- a/apps/tile/table.mu +++ b/apps/tile/table.mu @@ -4,6 +4,33 @@ fn initialize-table _self: (addr table), n: int { populate data-ah, n } +fn shallow-copy-table-values _src: (addr table), dest: (addr table) { + var src/eax: (addr table) <- copy _src + var src-data-ah/eax: (addr handle array bind) <- get src, data + var _src-data/eax: (addr array bind) <- lookup *src-data-ah + var src-data/esi: (addr array bind) <- copy _src-data + var n/ecx: int <- length src-data + initialize-table dest, n + var i/eax: int <- copy 0 + { + compare i, n + break-if->= + { + var offset/edx: (offset bind) <- compute-offset src-data, i + var src-bind/ecx: (addr bind) <- index src-data, offset + var key-ah/ebx: (addr handle array byte) <- get src-bind, key + var key/eax: (addr array byte) <- lookup *key-ah + compare key, 0 + break-if-= + var val-ah/eax: (addr handle value) <- get src-bind, value + var val/eax: (addr value) <- lookup *val-ah + bind-in-table dest, key-ah, val + } + i <- increment + loop + } +} + fn bind-in-table _self: (addr table), key: (addr handle array byte), val: (addr value) { var self/esi: (addr table) <- copy _self var data-ah/esi: (addr handle array bind) <- get self, data |