LexLeo 0.0.0-dev+f8e5087-dirty
Technical documentation
Loading...
Searching...
No Matches
stream.h File Reference

Borrower-facing runtime operations for the stream port. More...

Include dependency graph for stream.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

size_t stream_read (stream_t *s, void *buf, size_t n, stream_status_t *st)
 Read bytes from a stream.
 
size_t stream_write (stream_t *s, const void *buf, size_t n, stream_status_t *st)
 Write bytes to a stream.
 
stream_status_t stream_flush (stream_t *s)
 Flush a stream.
 

Detailed Description

This header exposes the public runtime operations used to interact with a borrowed stream_t handle.

Definition in file stream.h.

Function Documentation

◆ stream_flush()

stream_status_t stream_flush ( stream_t s)
Parameters
[in]sStream handle to flush.
Returns
Operation status.

This function exposes the borrower-facing flush operation of the stream port.

Definition at line 62 of file stream.c.

◆ stream_read()

size_t stream_read ( stream_t s,
void *  buf,
size_t  n,
stream_status_t st 
)
Parameters
[in]sStream handle to read from.
[out]bufDestination buffer receiving up to n bytes.
[in]nMaximum number of bytes to read.
[out]stOptional status output.
Returns
Number of bytes actually read.

This function exposes the borrower-facing read operation of the stream port.

If n == 0, the function returns 0 and, when st != NULL, reports STREAM_STATUS_OK.

Definition at line 19 of file stream.c.

◆ stream_write()

size_t stream_write ( stream_t s,
const void *  buf,
size_t  n,
stream_status_t st 
)
Parameters
[in]sStream handle to write to.
[in]bufSource buffer containing up to n bytes to write.
[in]nMaximum number of bytes to write.
[out]stOptional status output.
Returns
Number of bytes actually written.

This function exposes the borrower-facing write operation of the stream port.

If n == 0, the function returns 0 and, when st != NULL, reports STREAM_STATUS_OK.

Definition at line 38 of file stream.c.