ref: f4970829ff9ff9885d1e229b12bdaab77995de25
parent: b583c0bdc775e71a87b60f54ea6b1c19a32d2eae
author: Ori Bernstein <[email protected]>
date: Tue Jan 28 16:25:25 EST 2014
Fix botched merge.
--- a/bio.myr
+++ b/bio.myr
@@ -364,6 +364,7 @@
-> readdelim(f, delim, false)
}
+/* same as readto, but drops the read data. */
const skipto = {f, delim
match readdelim(f, delim, true)
| `std.Some ret: -> true
@@ -371,6 +372,11 @@
;;
}
+/* Same as readto, but the delimiter is always a '\n' */
+const readln = {f
+ -> readto(f, "\n")
+}
+
const readdelim = {f, delim, drop
var ret
var i, j
@@ -408,37 +414,6 @@
;;
std.die("unreachable")
}
-
-/* Same as readto, but the delimiter is always a '\n' */
-const readln = {f
- -> readto(f, "\n")
-}
-
-const skipto = {f, delim
- var ret : byte[:]
- var i, j
-
- ret = [][:]
- while true
- if !ensureread(f, delim.len)
- -> ret.len > 0
- ;;
- for i = f.rstart; i < f.rend; i++
- if f.rbuf[i] == delim[0]
- for j = 0; j < delim.len; j++
- if f.rbuf[i + j] != delim[j]
- goto nextiterskip
- ;;
- ;;
- f.rstart += delim.len
- -> true
- ;;
-:nextiterskip
- ;;
- ;;
- std.die("unreachable")
-}
-
/*
Same as std.put, but buffered. Returns the number of bytes written.