noxos (docs): documented streams
This commit is contained in:
parent
f3bd5cd0e7
commit
5a4c42635c
|
@ -2,6 +2,7 @@ baseURL = 'https://nerdcult.net/'
|
||||||
languageCode = 'en-us'
|
languageCode = 'en-us'
|
||||||
title = 'NerdCult'
|
title = 'NerdCult'
|
||||||
theme = 'terminal'
|
theme = 'terminal'
|
||||||
|
paginate = 16
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
themeColor = 'pink'
|
themeColor = 'pink'
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
---
|
||||||
|
title: "stream.h"
|
||||||
|
date: 2023-04-20T22:15:05+02:00
|
||||||
|
summary: "Streams are cycled buffers, that have __one__ input and __one__ output."
|
||||||
|
---
|
||||||
|
|
||||||
|
Streams are cycled buffers, that have __one__ input and __one__ output.
|
||||||
|
|
||||||
|
# `stream_T` - struct
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
|--------------|----------|----------------------------------------------------------------------------------|
|
||||||
|
| buffer | uint8_t* | The buffer where all the streams data is stored in. |
|
||||||
|
| size | uint32_t | The size of _buffer_ in bytes. |
|
||||||
|
| pos_sender | uint32_t | The senders (input) position in the buffer. |
|
||||||
|
| pos_receiver | uint32_t | The receivers (output) position in the buffer. This is always behind the sender. |
|
||||||
|
|
||||||
|
|
||||||
|
# `stream_alloc(size)` - function (stream_T*)
|
||||||
|
Allocates and returns a new stream, with a buffer of size **_size_**.
|
||||||
|
|
||||||
|
# `stream_destruct(stream)` - function (void)
|
||||||
|
Frees the resources of a stream.
|
||||||
|
|
||||||
|
# `stream_write(stream, buffer_in, n)` - function (uint32_t)
|
||||||
|
Writes at most **_n_** bytes from **_buffer_in_** into **_stream_**.
|
||||||
|
Returns the amount of bytes, that where actually written into the stream.
|
||||||
|
|
||||||
|
# `stream_read(stream, buffer_out, n)` - function (uint32_t)
|
||||||
|
Reads at most **_n_** bytes from **_stream_** into **_buffer_out_**.
|
||||||
|
Returns the amount of bytes, that where actually read from the stream.
|
Reference in New Issue