From cbfcf24ca27df81f51c0f17f6de0730d03e74655 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sun, 19 Oct 2025 22:22:23 +0100 Subject: stream: Introduce PIPE type Main reason to have this at all is to make char-by-char reading feasible. This occurs at `stream_chunk`, and previously if we passed in STDIN for `stream_init_file`, STDIN will only terminate once STREAM_DEFAULT_CHUNK number of characters have been fed into the pipe. This isn't desirable for STDIN (we really want to read char-by-char for expressions), nor would it necessarily be desirable in network applications. So any stream marked STREAM_TYPE_PIPE will only chunk character-by-character rather than genuine chunks. --- alisp.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'alisp.h') diff --git a/alisp.h b/alisp.h index a1f1748..57ab9c7 100644 --- a/alisp.h +++ b/alisp.h @@ -100,6 +100,7 @@ void sym_table_cleanup(sym_table_t *); typedef enum { STREAM_TYPE_STRING, + STREAM_TYPE_PIPE, STREAM_TYPE_FILE, } stream_type_t; @@ -133,6 +134,7 @@ typedef struct #define STREAM_DEFAULT_CHUNK 64 stream_err_t stream_init_string(stream_t *, char *, sv_t); +stream_err_t stream_init_pipe(stream_t *, char *, FILE *); stream_err_t stream_init_file(stream_t *, char *, FILE *); void stream_stop(stream_t *); -- cgit v1.2.3-13-gbd6f