From d2578eedcfa4666b8243a1617dfe4bf1a8832f60 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 29 May 2020 15:18:06 -0700 Subject: 6430 Perhaps the lack of safety just forces us to make smaller functions, like Forth. --- apps/browse.mu | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/browse.mu b/apps/browse.mu index 0a5c81bd..7b7e329a 100644 --- a/apps/browse.mu +++ b/apps/browse.mu @@ -2,7 +2,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int { var filename/eax: (addr array byte) <- first-arg args - var file-contents/ecx: (addr buffered-file) <- load-file filename + var file-contents/eax: (addr buffered-file) <- load-file filename dump file-contents flush-stdout exit-status <- copy 0 @@ -14,14 +14,13 @@ fn first-arg args-on-stack: (addr array (addr array byte)) -> out/eax: (addr arr out <- copy *result } -fn load-file filename: (addr array byte) -> out/ecx: (addr buffered-file) { +fn load-file filename: (addr array byte) -> out/eax: (addr buffered-file) { var result: (handle buffered-file) { var tmp1/eax: (addr handle buffered-file) <- address result open filename, 0, tmp1 } - var tmp2/eax: (addr buffered-file) <- lookup result - out <- copy tmp2 + out <- lookup result } fn dump in: (addr buffered-file) { -- cgit 1.4.1-2-gfad0