aboutsummaryrefslogtreecommitdiff
path: root/sys/base/bufio/dump.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/base/bufio/dump.c')
-rw-r--r--sys/base/bufio/dump.c66
1 files changed, 0 insertions, 66 deletions
diff --git a/sys/base/bufio/dump.c b/sys/base/bufio/dump.c
deleted file mode 100644
index 0b527e2..0000000
--- a/sys/base/bufio/dump.c
+++ /dev/null
@@ -1,66 +0,0 @@
-// -----------------------------------------------------------------------
-// reader
-
-#if 0
-rune
-bufio·getrune(io·Buffer *buf)
-{
- ubyte b;
- int i;
- byte str[UTFmax+1];
- rune r;
-
- // NOTE: I'm worried about the sign here...
- b = bufio·getbyte(buf);
- if (b < RuneSelf) {
- buf->runesize = 1;
- return b;
- }
-
- i = 0;
- str[i++] = b;
-
-nextbyte:
- b = bufio·getbyte(buf);
- if (b < 0) return b;
- if (i >= arrlen(str)) return RuneErr;
- str[i++] = b;
- if (!utf8·fullrune(str, i))
- goto nextbyte;
-
- buf->runesize = utf8·bytetorune(&r, str);
- if (r == RuneErr && b == 1) {
- errorf("illegal UTF-8 sequence");
- for (; i >= 0; i--)
- errorf("%s%.2x", i > 0 ? " " : "", *(ubyte*)(str+i));
- errorf("\n");
-
- buf->runesize = 0;
- } else
- for (; i > buf->runesize; i--)
- bufio·ungetbyte(buf, str[i]);
-
- return r;
-}
-
-// TODO: Check that we are given the correct rune!
-error
-bufio·ungetrune(io·Buffer *buf, rune r)
-{
- if (buf->state & bufio·rdr) {
- errorf("attempted to unget on non-active reader");
- return bufio·err;
- }
-
- if (buf->pos == buf->buf) {
- errorf("attempted to unget past end of buffer");
- return bufio·err;
- }
-
- buf->pos -= buf->runesize;
- return 0;
-}
-#endif
-
-// -----------------------------------------------------------------------
-// writer