From 3ae62cfd79a5435a2c230da5a8dfd8a1a8fa4abd Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 10 Nov 2020 19:32:54 -0800 Subject: 7222 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ok, I found a failing manual test for files as well. Here are the two steelman tests, one for screens and one for files: 1. 5 5 fake-screen =s s 1 down 1 right ctrl-d foo expand final state: s foo foo s 1 down 1 right ⇗ ┌─────┐ ┌─────┐ ┌─────┐ 1 ┌─────┐ 1 ┌─────┐ │ ┌─────┐ │ ┌─────┐ │ ─ │ │ │ │ ─ └─────┘ └─────┘ └─────┘ └─────┘ └─────┘ └─────┘ └─────┘ 2. "x" open =f f read f read ctrl-d read2 expand final state: f read2 read2 f read f read ⇗ FILE ❝def❞ FILE ❝abc❞ FILE ❝❞ ❝def❞ ❝ghi❞ In both cases there are 3 levels of issues: - getting a single-line expression to work - getting a single-line expression to work when operating on a binding defined in a previous line - getting an expanded function call to work The third is where the rub is right now. And what both examples above share is that the function performs 2 mutations to the screen/file. So we need a deep copy after all. And it's not very clear how to copy a file descriptor including the seek location. Linux's dup() syscall creates an alias to the file descriptor. And opening /proc seems awfully Linux-specific: https://stackoverflow.com/questions/54727231/duplicating-file-descriptor-and-seeking-through-both-of-them-independently/54727424#54727424 --- apps/tile/value.mu | 5 ----- 1 file changed, 5 deletions(-) (limited to 'apps/tile/value.mu') diff --git a/apps/tile/value.mu b/apps/tile/value.mu index cc046a04..ad526901 100644 --- a/apps/tile/value.mu +++ b/apps/tile/value.mu @@ -5,9 +5,6 @@ fn render-value-at screen: (addr screen), row: int, col: int, _val: (addr value) move-cursor screen, row, col var val/esi: (addr value) <- copy _val var val-type/ecx: (addr int) <- get val, type -#? print-string-to-real-screen "value type: " -#? print-int32-decimal-to-real-screen *val-type -#? print-string-to-real-screen "\n" # per-type rendering logic goes here compare *val-type, 1 # string { @@ -148,7 +145,6 @@ fn render-screen screen: (addr screen), row: int, col: int, _target-screen: (add break-if-> increment row # mutate arg move-cursor screen, row, col -#? print-string screen, "\n" print-string screen, " " var c/edi: int <- copy 1 { @@ -163,7 +159,6 @@ fn render-screen screen: (addr screen), row: int, col: int, _target-screen: (add loop } increment row # mutate arg -#? print-string screen, "\n" move-cursor screen, row, col start-color screen, 0xf2, 7 print-lower-border screen, *ncols-a -- cgit 1.4.1-2-gfad0