BinaryReader :: struct {
stream: &Stream
}
BinaryWriter :: struct {
stream: &Stream
}
BufferStream :: struct {
stream: Stream
data: [..] u8
curr_pos: i32
write_enabled: bool
fixed: bool
}
Reader :: struct {
stream: &Stream
buffer: [] u8
buffer_allocator: Allocator
start: u32
end: u32
last_byte: i32
error: Error
done: bool
newline_format: NewLineFormat
}
Reader.advance_line :: (reader: &Reader) -> void
Reader.empty :: (reader: &Reader) -> bool
Reader.ensure_buffered :: (reader: &Reader, bytes: u32) -> Error
Reader.free :: (reader: &Reader) -> void
Reader.from_string :: (s: [] u8) -> (Reader, &BufferStream)
Reader.get_buffered :: (reader: &Reader) -> i32
Reader.is_empty :: (reader: &Reader) -> bool
Reader.lines :: (r: &Reader, inplace: bool, allocator: Allocator) -> Iterator([] u8)
Reader.make :: (s: &Stream, buffer_size: i32, allocator: Allocator, newline_format: NewLineFormat) -> Reader
Reader.peek_byte :: (reader: &Reader, advance: i32) -> (u8, Error)
Reader.peek_bytes :: (reader: &Reader, advance: u32, length: u32) -> ([] u8, Error)
Reader.read_all :: (reader: &Reader, allocator: Allocator) -> [] u8
Reader.read_byte :: (reader: &Reader) -> u8
Reader.read_bytes :: (reader: &Reader, bytes: [] u8) -> (i32, Error)
Reader.read_fill_buffer :: (reader: &Reader, bytes: [] u8) -> Error
Reader.read_i32 :: (reader: &Reader) -> i32
Reader.read_i64 :: (reader: &Reader) -> i64
Reader.read_line :: (reader: &Reader, consume_newline: bool, allocator: Allocator, inplace: bool) -> [] u8
Reader.read_string :: (reader: &Reader, bytes: i32, allocator: Allocator) -> [] u8
Reader.read_u32 :: (reader: &Reader) -> u32
Reader.read_u64 :: (reader: &Reader) -> u64
Reader.read_until :: (reader: &Reader, until: u8, skip: u32, allocator: Allocator, consume_end: bool, inplace: bool) -> [] u8
Reader.read_word :: (reader: &Reader, numeric_allowed: bool, allocator: Allocator, inplace: bool) -> [] u8
Reader.reset :: (reader: &Reader) -> void
Reader.skip_bytes :: (reader: &Reader, bytes: u32) -> (i32, Error)
Reader.skip_whitespace :: (reader: &Reader) -> void
Reader.unread_byte :: (reader: &Reader) -> Error
Stream :: struct {
vtable: &Stream_Vtable
flags: Stream_Flags
}
Stream_Vtable :: struct {
seek: (&Stream, i32, SeekFrom) -> Error
tell: (&Stream) -> Result(u32, Error)
read: (&Stream, [] u8) -> Result(u32, Error)
read_at: (&Stream, u32, [] u8) -> Result(u32, Error)
read_byte: (&Stream) -> Result(u8, Error)
write: (&Stream, [] u8) -> Result(u32, Error)
write_at: (&Stream, u32, [] u8) -> Result(u32, Error)
write_byte: (&Stream, u8) -> Error
close: (&Stream) -> Error
flush: (&Stream) -> Error
size: (&Stream) -> i32
poll: (&Stream, PollEvent, i32) -> Result(bool, Error)
}
Writer :: struct {
stream: &Stream
error: Error
buffer: [] u8
buffer_filled: u32
}
Writer.consume_error :: (w: &Writer) -> Error
Writer.flush :: (w: &Writer) -> void
Writer.free :: (w: &Writer) -> void
Writer.make :: (s: &Stream, buffer_size: i32) -> Writer
Writer.remaining_capacity :: (w: &Writer) -> u32
Writer.write :: (writer: &Writer, s: [] u8) -> void
Writer.write :: (writer: &Writer, cs: [&] u8) -> void
Writer.write :: (writer: &Writer, n: i32, base: u32) -> void
Writer.write :: (writer: &Writer, f: f32) -> void
Writer.write :: (writer: &Writer, n: i64, base: u64) -> void
Writer.write :: (writer: &Writer, f: f64) -> void
Writer.write :: (writer: &Writer, b: bool) -> void
Writer.write :: (writer: &Writer, p: &void) -> void
Writer.write :: (writer: &Writer, r: range, sep: [] u8) -> void
Writer.write :: (writer: &Writer, format: [] u8, va: ..any) -> void
Writer.write :: macro (w: &Writer, a: $T) -> void
Writer.write_bool :: (writer: &Writer, b: bool) -> void
Writer.write_byte :: (writer: &Writer, byte: u8) -> void
Writer.write_cstr :: (writer: &Writer, cs: [&] u8) -> void
Writer.write_escaped_str :: (writer: &Writer, s: [] u8) -> void
Writer.write_f32 :: (writer: &Writer, f: f32) -> void
Writer.write_f64 :: (writer: &Writer, f: f64) -> void
Writer.write_i32 :: (writer: &Writer, n: i32, base: u32) -> void
Writer.write_i64 :: (writer: &Writer, n: i64, base: u64) -> void
Writer.write_ptr :: (writer: &Writer, p: &void) -> void
Writer.write_range :: (writer: &Writer, r: range, sep: [] u8) -> void
Writer.write_str :: (writer: &Writer, s: [] u8) -> void
Error :: enum {
None :: 0
NotImplemented :: 1
EOF :: 2
NoVtable :: 3
OutOfBounds :: 4
NotFound :: 5
BadFile :: 6
BufferFull :: 7
NoProgress :: 8
InvalidUnread :: 9
ReadPending :: 10
ReadLater :: 11
ConnectFailed :: 12
NoData :: 13
CreationFailed :: 14
OperationFailed :: 15
}
PollEvent :: enum {
None :: 0
Read :: 1
Write :: 2
Closed :: 3
}
SeekFrom :: enum {
Start :: 0
Current :: 1
End :: 2
}
Stream_Flags :: enum #flags {
Block_On_Read :: 1
}
advance_line :: (reader: &Reader) -> void
binary_read :: (br: &BinaryReader, $T: type_expr) -> T
binary_read_byte :: (br: &BinaryReader) -> u8
binary_read_slice :: (br: &BinaryReader, $T: type_expr, size, read_size, allocator) -> [] T
binary_reader_make :: (s: &Stream) -> BinaryReader
binary_write :: (bw: &BinaryWriter, $T: type_expr, v: &T) -> void
binary_write_byte :: (bw: &BinaryWriter, byte: u8) -> void
binary_write_slice :: (bw: &BinaryWriter, sl: [] $T, output_size) -> void
binary_writer_make :: (s: &Stream) -> BinaryWriter
buffer_stream_free :: (bs: &BufferStream) -> void
buffer_stream_make :: (initial_data: [] u8, allocator: Allocator, fixed: bool, write_enabled: bool) -> BufferStream
buffer_stream_make :: (initial_size: i32, allocator: Allocator) -> BufferStream
buffer_stream_to_str :: (bs: &BufferStream) -> [] u8
lines :: (r: &Reader, inplace: bool, allocator: Allocator) -> Iterator([] u8)
peek_byte :: (reader: &Reader, advance: i32) -> (u8, Error)
peek_bytes :: (reader: &Reader, advance: u32, length: u32) -> ([] u8, Error)
read_all :: (reader: &Reader, allocator: Allocator) -> [] u8
read_byte :: (reader: &Reader) -> u8
read_bytes :: (reader: &Reader, bytes: [] u8) -> (i32, Error)
read_fill_buffer :: (reader: &Reader, bytes: [] u8) -> Error
read_i32 :: (reader: &Reader) -> i32
read_i64 :: (reader: &Reader) -> i64
read_line :: (reader: &Reader, consume_newline: bool, allocator: Allocator, inplace: bool) -> [] u8
read_string :: (reader: &Reader, bytes: i32, allocator: Allocator) -> [] u8
read_u32 :: (reader: &Reader) -> u32
read_u64 :: (reader: &Reader) -> u64
read_until :: (reader: &Reader, until: u8, skip: u32, allocator: Allocator, consume_end: bool, inplace: bool) -> [] u8
read_word :: (reader: &Reader, numeric_allowed: bool, allocator: Allocator, inplace: bool) -> [] u8
reader_empty :: (reader: &Reader) -> bool
reader_ensure_buffered :: (reader: &Reader, bytes: u32) -> Error
reader_free :: (reader: &Reader) -> void
reader_from_string :: (s: [] u8) -> (Reader, &BufferStream)
reader_get_buffered :: (reader: &Reader) -> i32
reader_make :: (s: &Stream, buffer_size: i32, allocator: Allocator, newline_format: NewLineFormat) -> Reader
reader_reset :: (reader: &Reader) -> void
skip_bytes :: (reader: &Reader, bytes: u32) -> (i32, Error)
skip_whitespace :: (reader: &Reader) -> void
stream_close :: (s: &Stream) -> Error
stream_flush :: (s: &Stream) -> Error
stream_poll :: (s: &Stream, ev: PollEvent, timeout: i32) -> Result(bool, Error)
Waits until a stream is able to be read from or written to.
If timeout
< 0, then there is an indefinite timeout.
If timeout
= 0, then there is no timeout, and this function returns immediately.
If timeout
> 0, then there is a timeout
millisecond delay before returning false.
stream_read :: (s: &Stream, buffer: [] u8) -> Result(u32, Error)
stream_read_at :: (s: &Stream, at: u32, buffer: [] u8) -> Result(u32, Error)
stream_read_byte :: (s: &Stream) -> Result(u8, Error)
stream_read_until_full :: (s: &Stream, buffer: [] u8) -> Result(u32, Error)
stream_seek :: (s: &Stream, to: i32, whence: SeekFrom) -> Error
stream_size :: (s: &Stream) -> i32
stream_tell :: (s: &Stream) -> Result(u32, Error)
stream_write :: (s: &Stream, buffer: [] u8) -> Result(u32, Error)
stream_write_at :: (s: &Stream, at: u32, buffer: [] u8) -> Result(u32, Error)
stream_write_byte :: (s: &Stream, byte: u8) -> Error
string_builder :: (allocator: Allocator) -> (Writer, &BufferStream)
unread_byte :: (reader: &Reader) -> Error
write :: (writer: &Writer, s: [] u8) -> void
write :: (writer: &Writer, cs: [&] u8) -> void
write :: (writer: &Writer, n: i32, base: u32) -> void
write :: (writer: &Writer, f: f32) -> void
write :: (writer: &Writer, n: i64, base: u64) -> void
write :: (writer: &Writer, f: f64) -> void
write :: (writer: &Writer, b: bool) -> void
write :: (writer: &Writer, p: &void) -> void
write :: (writer: &Writer, r: range, sep: [] u8) -> void
write :: (writer: &Writer, format: [] u8, va: ..any) -> void
write :: macro (w: &Writer, a: $T) -> void
write_bool :: (writer: &Writer, b: bool) -> void
write_byte :: (writer: &Writer, byte: u8) -> void
write_cstr :: (writer: &Writer, cs: [&] u8) -> void
write_escaped_str :: (writer: &Writer, s: [] u8) -> void
write_f32 :: (writer: &Writer, f: f32) -> void
write_f64 :: (writer: &Writer, f: f64) -> void
write_i32 :: (writer: &Writer, n: i32, base: u32) -> void
write_i64 :: (writer: &Writer, n: i64, base: u64) -> void
write_ptr :: (writer: &Writer, p: &void) -> void
write_range :: (writer: &Writer, r: range, sep: [] u8) -> void
write_str :: (writer: &Writer, s: [] u8) -> void
writer_consume_error :: (w: &Writer) -> Error
writer_flush :: (w: &Writer) -> void
writer_free :: (w: &Writer) -> void
writer_make :: (s: &Stream, buffer_size: i32) -> Writer
writer_remaining_capacity :: (w: &Writer) -> u32