From da925d0697d61db6d265fd78cab3d1adf214950c Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 16 Aug 2016 17:13:26 -0700 Subject: 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. --- filesystem.mu | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 filesystem.mu (limited to 'filesystem.mu') 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 +] -- cgit 1.4.1-2-gfad0