From 3350c34a74844e21ea69077e01efff3bae64bdcd Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 23 Mar 2021 17:31:08 -0700 Subject: . --- html/linux/410file.mu.html | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 html/linux/410file.mu.html (limited to 'html/linux/410file.mu.html') diff --git a/html/linux/410file.mu.html b/html/linux/410file.mu.html new file mode 100644 index 00000000..da7bdbb4 --- /dev/null +++ b/html/linux/410file.mu.html @@ -0,0 +1,82 @@ + + + + +Mu - linux/410file.mu + + + + + + + + + + +https://github.com/akkartik/mu/blob/main/linux/410file.mu +
+ 1 fn read-lines in: (addr buffered-file), out: (addr handle array (handle array byte)) {
+ 2   var stream: (stream (handle array byte) 0x10)
+ 3   var stream-a/edi: (addr stream (handle array byte)) <- address stream
+ 4   var line: (stream byte 0x10)
+ 5   var line-a/esi: (addr stream byte) <- address line
+ 6   {
+ 7     clear-stream line-a
+ 8     read-line-buffered in, line-a
+ 9     var done?/eax: boolean <- stream-empty? line-a
+10     compare done?, 0/false
+11     break-if-!=
+12 #?     print-string 0, "AAA\n"
+13     var h: (handle array byte)
+14     var ah/eax: (addr handle array byte) <- address h
+15     stream-to-array line-a, ah
+16     write-to-stream stream-a, ah
+17     loop
+18   }
+19   stream-to-array stream-a, out
+20 }
+
+ + + -- cgit 1.4.1-2-gfad0