diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-10-23 21:15:43 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-10-23 21:15:43 -0700 |
commit | 0606f4ace4fc6f610c89d8b7f561e09cc486b952 (patch) | |
tree | 39c15b3d0929ec575b083630bc8977bea849ee77 /088file.mu | |
parent | b1f0fa4dc98a65dd956ded0eadce3bd9d010d100 (diff) | |
download | mu-0606f4ace4fc6f610c89d8b7f561e09cc486b952.tar.gz |
3574
Shorter branches above longer ones.
Diffstat (limited to '088file.mu')
-rw-r--r-- | 088file.mu | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/088file.mu b/088file.mu index f00eb7bf..3c31e66f 100644 --- a/088file.mu +++ b/088file.mu @@ -14,16 +14,16 @@ def start-reading resources:&:resources, filename:text -> contents:&:source:char local-scope load-ingredients { - break-if resources - # real file system - file:num <- $open-file-for-reading filename - assert file, [file not found] - contents:&:source:char, sink:&:sink:char <- new-channel 30 - start-running receive-from-file file, sink + break-unless resources + # fake file system + contents <- start-reading-from-fake-resources resources, filename return } - # fake file system - contents <- start-reading-from-fake-resources resources, filename + # real file system + file:num <- $open-file-for-reading filename + assert file, [file not found] + contents:&:source:char, sink:&:sink:char <- new-channel 30 + start-running receive-from-file file, sink ] def start-reading-from-fake-resources resources:&:resources, resource:text -> contents:&:source:char [ @@ -82,16 +82,16 @@ def start-writing resources:&:resources, filename:text -> sink:&:sink:char, rout load-ingredients source:&:source:char, sink:&:sink:char <- new-channel 30 { - break-if resources - # real file system - file:num <- $open-file-for-writing filename - assert file, [no such file] - routine-id <- start-running transmit-to-file file, source + break-unless resources + # fake file system + # beware: doesn't support multiple concurrent writes yet + routine-id <- start-running transmit-to-fake-file resources, filename, source reply } - # fake file system - # beware: doesn't support multiple concurrent writes yet - routine-id <- start-running transmit-to-fake-file resources, filename, source + # real file system + file:num <- $open-file-for-writing filename + assert file, [no such file] + routine-id <- start-running transmit-to-file file, source ] def transmit-to-file file:num, source:&:source:char -> source:&:source:char [ |