diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-08-16 17:13:26 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-08-16 17:13:26 -0700 |
commit | da925d0697d61db6d265fd78cab3d1adf214950c (patch) | |
tree | 24fcbd533c7c4fb1393b02497b62964178094fe7 /filesystem.mu | |
parent | 78a12c9d706f6197d3710ece04e9bd8d4eebe713 (diff) | |
download | mu-da925d0697d61db6d265fd78cab3d1adf214950c.tar.gz |
3203 - testable interface for reading a file
This commit was written by Stephen Malina. Thanks also to Stephen for running into the bug of commit 3202.
Diffstat (limited to 'filesystem.mu')
-rw-r--r-- | filesystem.mu | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/filesystem.mu b/filesystem.mu new file mode 100644 index 00000000..7aa919e6 --- /dev/null +++ b/filesystem.mu @@ -0,0 +1,16 @@ +def main [ + local-scope + $print [file to read from: ], [/tmp/mu-fs] + # initialize filesystem + fs:address:filesystem <- copy 0/real-filesystem + content-source:address:source:character <- start-reading fs, [/tmp/mu-fs] + # read from channel until exhausted and print out characters + { + c:character, done?:boolean, content-source <- read content-source + break-if done? + $print [Next: ], c, 10/newline + loop + } + $print [Done reading], 10/newline + # TODO: writing to file +] |