blob: 7b90cecf74bc1b93974f244f60eb8a8cfc95ebb2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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
|