internal io implementation details
More...
|
| typedef size_t(* | io_read_t) (io_t *self, void *dst, size_t size) |
| | io object read callback More...
|
| |
| typedef size_t(* | io_write_t) (io_t *self, const void *src, size_t size) |
| | io write callback More...
|
| |
| typedef size_t(* | io_fwrite_t) (io_t *self, const char *fmt, va_list args) |
| | io write format callback seperate from io_write_t to allow for more efficient implementations if this is not provided, io_write_t will be used instead More...
|
| |
| typedef size_t(* | io_size_t) (io_t *self) |
| | io size callback get the total size of an io objects backing data More...
|
| |
| typedef size_t(* | io_seek_t) (io_t *self, size_t offset) |
| | io seek callback seek from start callback More...
|
| |
| typedef void *(* | io_map_t) (io_t *self, os_protect_t protect) |
| | io map callback map an io objects backing data into memory More...
|
| |
| typedef os_error_t(* | io_close_t) (io_t *self) |
| | io close callback destroy an io objects backing data and any associated resources More...
|
| |
| typedef typedefCT_BEGIN_API struct io_t | io_t |
| | an io object More...
|
| |
internal io implementation details
- Warning
- these are internal structures and should not be used directly
◆ io_close_t
| typedef os_error_t(* io_close_t) (io_t *self) |
io close callback destroy an io objects backing data and any associated resources
- Parameters
-
Definition at line 82 of file impl.h.
◆ io_fwrite_t
| typedef size_t(* io_fwrite_t) (io_t *self, const char *fmt, va_list args) |
io write format callback seperate from io_write_t to allow for more efficient implementations if this is not provided, io_write_t will be used instead
- Parameters
-
| self | the invoked io object |
| fmt | the format string |
| args | the format arguments |
- Returns
- the total number of bytes copied into the io object
Definition at line 50 of file impl.h.
◆ io_map_t
io map callback map an io objects backing data into memory
- Parameters
-
| self | the io object |
| protect | the protection flags for the memory |
- Returns
- the backing memory
Definition at line 76 of file impl.h.
◆ io_read_t
| typedef size_t(* io_read_t) (io_t *self, void *dst, size_t size) |
io object read callback
- Parameters
-
| self | the invoked io object |
| dst | the destination buffer to copy into |
| size | the size of the provided buffer |
- Returns
- the total number of bytes copied to the buffer
Definition at line 30 of file impl.h.
◆ io_seek_t
| typedef size_t(* io_seek_t) (io_t *self, size_t offset) |
io seek callback seek from start callback
- Parameters
-
| self | the io object |
| offset | the offset to seek to |
- Returns
- the actual offset after seeking
Definition at line 67 of file impl.h.
◆ io_size_t
| typedef size_t(* io_size_t) (io_t *self) |
io size callback get the total size of an io objects backing data
- Parameters
-
- Returns
- the total size, in bytes of the backing data
Definition at line 58 of file impl.h.
◆ io_t
an io object
message without source
severity [id]: main message note: note message the = in the => arrow is aligned with the | pipe the : in the note: is aligned with the | pipe all line numbers are right aligned all reports from the same file are grouped together
- are sorted by line number
- pipes in the same file are all aligned together rich message format
severity [id]: main message => lang [path:line] | line | source code | ^~~~ underline message
note: note message
Definition at line 9 of file console.h.
◆ io_write_t
| typedef size_t(* io_write_t) (io_t *self, const void *src, size_t size) |
io write callback
- Parameters
-
| self | the invoked io object |
| src | the source buffer to copy from |
| size | the size of the source buffer |
- Returns
- the total number of bytes copied into the io object
Definition at line 39 of file impl.h.
◆ io_data()
get the user data from an io object
- Warning
- does not perform any validation on the type of the user data
- Parameters
-
- Returns
- the user data
Definition at line 10 of file common.c.
◆ io_init()
initialize an IO object for a given interface
- Note
- this initializes the object in place
-
if the io object does not require allocation,
arena may be NULL
- Precondition
buffer must point to a valid memory region of at least sizeof(io_t) + cb->size bytes
-
cb must point to a valid callback set
-
data must point to a valid memory region of cb->size bytes. if cb->size is 0, data may be NULL
- Parameters
-
| buffer | the buffer to initialize the io object in |
| cb | the callback set |
| flags | the access flags for this object |
| name | the name of the object |
| data | the user data, this is copied into the io object |
| arena | the arena to allocate the io object from |
- Returns
- the initialized IO interface
◆ io_new()
create a new IO object for a given interface
- Precondition
cb must point to a valid callback set
-
data must point to a valid memory region of cb->size bytes. if cb->size is 0, data may be NULL
-
name must be a valid string
-
arena must be a valid arena
- Parameters
-
| cb | the callback set |
| flags | the access flags for this object |
| name | the name of the object |
| data | the user data, this is copied into the io object |
| arena | the arena to allocate the io object from |
- Returns
- a new IO interface