diff options
Diffstat (limited to 'src/bufio/impl.h')
-rw-r--r-- | src/bufio/impl.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/bufio/impl.h b/src/bufio/impl.h new file mode 100644 index 0000000..f5c3bcf --- /dev/null +++ b/src/bufio/impl.h @@ -0,0 +1,34 @@ +#pragma once + +#include <u.h> +#include <io.h> +#include <bufio.h> + +enum +{ + BUF·max = 4 * 8096, + BUF·size = 4 * 4096, + BUF·ungets = 8, + BUF·err = -1, + BUF·eof = +1, +}; + +typedef struct Buffer +{ + uint8 eof; + int64 off; + int64 size; + + byte* base; + byte* pos; + byte* end; + byte b[]; +} Buffer; + +void* newbuffer(uintptr off, uintptr size); + +struct bufio·Scanner +{ + io·Reader r; + Buffer buf; +}; |