21 lines
458 B
C
21 lines
458 B
C
#ifndef STREAM_H
|
|
#define STREAM_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#define STREAM_GET_BYTE(stream, out) stream->get_byte(stream, out)
|
|
#define STREAM_PEEK_BYTE(stream, out) stream->peek_byte(stream, out)
|
|
|
|
typedef enum {
|
|
STREAM_STATUS_OK,
|
|
STREAM_STATUS_ERROR,
|
|
STREAM_STATUS_END,
|
|
} stream_status_t;
|
|
|
|
typedef struct stream {
|
|
stream_status_t (*get_byte)(struct stream *s, uint8_t *out);
|
|
stream_status_t (*peek_byte)(struct stream *s, uint8_t *out);
|
|
} stream_t;
|
|
|
|
#endif
|