From 288727f09a1b3458c268497d111349e608c3f9fa Mon Sep 17 00:00:00 2001 From: "bozo.kopic" Date: Tue, 2 Aug 2022 01:20:12 +0200 Subject: init --- docs/stream.rst | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 docs/stream.rst (limited to 'docs/stream.rst') 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 -- cgit v1.2.3-70-g09d2