diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-05-29 15:18:06 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-05-29 15:18:06 -0700 |
commit | d2578eedcfa4666b8243a1617dfe4bf1a8832f60 (patch) | |
tree | eab04a8930d3d6cd2c0cb8beba4e47227b5279b0 | |
parent | dac00bd94379ce5dfd7f839d54a1d3789777ebe1 (diff) | |
download | mu-d2578eedcfa4666b8243a1617dfe4bf1a8832f60.tar.gz |
6430
Perhaps the lack of safety just forces us to make smaller functions, like Forth.
-rw-r--r-- | apps/browse.mu | 7 |
1 files 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) { |