diff options
| author | bozo.kopic <bozo@kopic.xyz> | 2022-08-02 01:20:12 +0200 |
|---|---|---|
| committer | bozo.kopic <bozo@kopic.xyz> | 2022-09-25 02:40:23 +0200 |
| commit | 288727f09a1b3458c268497d111349e608c3f9fa (patch) | |
| tree | d62565249fa3c7127856c65405752572fc41aca9 /docs/stream.rst | |
Diffstat (limited to 'docs/stream.rst')
| -rw-r--r-- | docs/stream.rst | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/docs/stream.rst b/docs/stream.rst new file mode 100644 index 0000000..7b90cec --- /dev/null +++ b/docs/stream.rst @@ -0,0 +1,54 @@ +Input/output stream +=================== + +To enable interaction with interpreter, basic input/output stream abstraction +is needed. This implementation uses platform specific functions defined +by architecture abstraction layer. + + +Input stream +------------ + +Input stream provides functionality of reading unsigned 8bit integers +representing input characters. Implementation utilized `lsp_stream_getchar_t` +function pointer provided during input stream initialization. Together with +`lsp_in_stream_read`, used for reading next available input character, input +stream contains single character buffer used for implementation of +`lsp_in_stream_peek` functionality. + + +Output stream +------------- + +Output stream provides functionality regarding writing character data. +It uses `lsp_stream_putchar_t` function pointer provided during output stream +initialization. Available functions include: + + * `lsp_out_stream_write` + + Write single character to output stream. + + * `lsp_out_stream_write_str` + + Write null terminated character sequence. + + * `lsp_out_stream_write_int` + + Write string representation of signed integer. + + +Source code +----------- + +stream.h +'''''''' + +.. literalinclude:: ../src_c/stream.h + :language: c + + +stream.c +'''''''' + +.. literalinclude:: ../src_c/stream.c + :language: c |
