diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-06-11 19:17:08 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-06-11 19:17:08 -0700 |
commit | 040b60bc6ea97e93d867479a71db47c15a3be637 (patch) | |
tree | de5ab22011e8bc8edf008a9c48b10178dcf82076 /shell | |
parent | 6f64f5d3b69eb817dbef54abb548454a62bde04e (diff) | |
download | mu-040b60bc6ea97e93d867479a71db47c15a3be637.tar.gz |
.
Save a single trace to potentially multiple globals just like a gap buffer (if say we have a single let binding defining multiple functions). I don't have a strong use for this yet, but it seems cleaner. Maybe it's redundant or wrong.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/global.mu | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/shell/global.mu b/shell/global.mu index 96bda579..2b0a5e99 100644 --- a/shell/global.mu +++ b/shell/global.mu @@ -591,15 +591,37 @@ fn is-definition? _expr: (addr cell) -> _/eax: boolean { } # HERE: ..and this -fn read-and-evaluate-and-save-gap-buffer-and-save-trace-to-globals in-ah: (addr handle gap-buffer), globals: (addr global-table) { +fn read-and-evaluate-and-save-gap-buffer-and-save-trace-to-globals in-ah: (addr handle gap-buffer), _globals: (addr global-table) { + var globals/esi: (addr global-table) <- copy _globals var definitions-created-storage: (stream int 0x10) var definitions-created/ebx: (addr stream int) <- address definitions-created-storage - var trace-storage: trace - var trace/edx: (addr trace) <- address trace-storage + var trace-h: (handle trace) + var trace-ah/edx: (addr handle trace) <- address trace-h + allocate trace-ah + var trace/eax: (addr trace) <- lookup *trace-ah initialize-trace trace, 1/only-errors, 0x10/capacity, 0/visible var dummy-result-h: (handle cell) var dummy-result-ah/ecx: (addr handle cell) <- address dummy-result-h read-and-evaluate-and-save-gap-buffer-to-globals in-ah, dummy-result-ah, globals, definitions-created, trace, 0/no-screen-cell, 0/no-keyboard-cell + # + # save trace to all needed globals as well + rewind-stream definitions-created + var globals-data-ah/eax: (addr handle array global) <- get globals, data + var _globals-data/eax: (addr array global) <- lookup *globals-data-ah + var globals-data/edi: (addr array global) <- copy _globals-data + { + var no-definitions?/eax: boolean <- stream-empty? definitions-created + compare no-definitions?, 0/false + break-if-!= + var curr-index: int + var curr-index-a/eax: (addr int) <- address curr-index + read-from-stream definitions-created, curr-index-a + var curr-offset/eax: (offset global) <- compute-offset globals-data, curr-index + var curr-global/ecx: (addr global) <- index globals-data, curr-offset + var curr-trace-ah/eax: (addr handle trace) <- get curr-global, trace + copy-object trace-ah, curr-trace-ah + loop + } } fn set-global-cursor-index _globals: (addr global-table), name-gap: (addr gap-buffer) { |