#include <stdint.h>
#include <stdbool.h>
#include <platform_mutex.h>
Go to the source code of this file.
|
bool | lbm_channel_more (lbm_char_channel_t *chan) |
|
int | lbm_channel_peek (lbm_char_channel_t *chan, unsigned int n, char *res) |
|
bool | lbm_channel_read (lbm_char_channel_t *chan, char *res) |
|
bool | lbm_channel_drop (lbm_char_channel_t *chan, unsigned int n) |
|
bool | lbm_channel_comment (lbm_char_channel_t *chan) |
|
void | lbm_channel_set_comment (lbm_char_channel_t *chan, bool comment) |
|
void | lbm_channel_reader_close (lbm_char_channel_t *chan) |
|
bool | lbm_channel_reader_is_closed (lbm_char_channel_t *chan) |
|
bool | lbm_channel_is_empty (lbm_char_channel_t *chan) |
|
bool | lbm_channel_is_full (lbm_char_channel_t *chan) |
|
int | lbm_channel_write (lbm_char_channel_t *chan, char c) |
|
void | lbm_channel_writer_close (lbm_char_channel_t *chan) |
|
unsigned int | lbm_channel_row (lbm_char_channel_t *chan) |
|
unsigned int | lbm_channel_column (lbm_char_channel_t *chan) |
|
bool | lbm_channel_may_block (lbm_char_channel_t *chan) |
|
void | lbm_create_string_char_channel (lbm_string_channel_state_t *st, lbm_char_channel_t *chan, char *str) |
|
void | lbm_create_string_char_channel_size (lbm_string_channel_state_t *st, lbm_char_channel_t *chan, char *str, unsigned int size) |
|
void | lbm_create_buffered_char_channel (lbm_buffered_channel_state_t *st, lbm_char_channel_t *chan) |
|
◆ CHANNEL_END
◆ CHANNEL_FULL
◆ CHANNEL_MORE
◆ CHANNEL_READER_CLOSED
#define CHANNEL_READER_CLOSED 1000 |
◆ CHANNEL_SUCCESS
#define CHANNEL_SUCCESS 1 |
◆ TOKENIZER_BUFFER_SIZE
#define TOKENIZER_BUFFER_SIZE 257 |
◆ lbm_char_channel_t
Struct describing the interface to a character channel.
◆ lbm_channel_column()
Obtain current column from a channel.
- Parameters
-
chan | The channel to query. |
◆ lbm_channel_comment()
Comment mode. Check if a channel is currently in comment mode.
- Parameters
-
- Returns
- true if the channel is in comment mode, false otherwise.
◆ lbm_channel_drop()
Drop n characters from a channel.
- Parameters
-
chan | The channel to drop characters from. |
n | The number of characters to drop. |
- Returns
- true on successfully dropping n characters, false otherwise.
◆ lbm_channel_is_empty()
Check if a channel is empty. Data cannot be read from an empty channel.
- Parameters
-
- Returns
- True if empty, false otherwise.
◆ lbm_channel_is_full()
Check if a channel is full. Data cannot be written into a full channel.
- Parameters
-
- Returns
- True if channel is full, false otherwise.
◆ lbm_channel_may_block()
query if a channel has a potentially blocking interface. Buffered channels do, string backed channels don't.
◆ lbm_channel_more()
Check if there are more characters comming on a character channel. This returns false if the sender has closed the send side of the channel.
- Parameters
-
- Returns
- True if sender end is still open false if closed.
◆ lbm_channel_peek()
Peek into a character channel.
- Parameters
-
chan | The channel to peek into. |
n | The position to peek at. |
res | Pointer to a character that will hold the result. |
- Returns
- CHANNEL_SUCCESS: successfully peeked.
- CHANNEL_MORE: The data you try to peek at has not yet arrived into the channel.
- CHANNEL_END: The sender side is closed and you are peeking outside of valid data.
◆ lbm_channel_read()
Read a character from the head of the channel.
- Parameters
-
chan | The channel to read from. |
res | The resulting character is stored here. |
- Returns
- true on success, otherwise false.
◆ lbm_channel_reader_close()
Close a channel reader side.
- Parameters
-
chan | Channel to close the reader side of. |
◆ lbm_channel_reader_is_closed()
Check if the reader side of channel is closed.
- Parameters
-
- Returns
- True if closed, false otherwise.
◆ lbm_channel_row()
Obtain current row number from a channel.
- Parameters
-
chan | The channel to query. |
- Returns
- The current row as seen by the calls to "read".
◆ lbm_channel_set_comment()
Enter into or exit from comment mode.
- Parameters
-
chan | Channel to change mode of. |
comment | True to enter into comment mode and false to exit. |
◆ lbm_channel_write()
Write a character onto the end of a channel.
- Parameters
-
chan | Channel to write to. |
c | Character to place onto the channel. |
- Returns
- CHANNEL_SUCCESS: Successfully wrote.
- CHANNEL_READER_CLOSED: The reader end is closed, you should abort writing.
- CHANNEL_FULL: The channel is full and cannot accept the character. Try again later.
◆ lbm_channel_writer_close()
Close the writer side of a channel. \ param chan The channel to close the writer side of.
◆ lbm_create_buffered_char_channel()
Create a buffered channel that can be read from and written to.
- Parameters
-
◆ lbm_create_string_char_channel()
Create a channel from a string. This channel can be read from but not written to.
- Parameters
-
st | Pointer to lbm_string_channel_state. |
chan | Pointer to lbm_char_channel_t. |
str | The string to base the channel contents upon. |
◆ lbm_create_string_char_channel_size()