aboutsummaryrefslogtreecommitdiff
path: root/alisp.h
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2025-10-19 22:22:23 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2025-10-19 22:25:10 +0100
commitcbfcf24ca27df81f51c0f17f6de0730d03e74655 (patch)
tree855ad69b679bb7685296af4c88fa3e7988e7e45d /alisp.h
parent030a289497db1fcbd22eafb99d7d8827bca94563 (diff)
downloadalisp-cbfcf24ca27df81f51c0f17f6de0730d03e74655.tar.gz
alisp-cbfcf24ca27df81f51c0f17f6de0730d03e74655.tar.bz2
alisp-cbfcf24ca27df81f51c0f17f6de0730d03e74655.zip
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.
Diffstat (limited to 'alisp.h')
-rw-r--r--alisp.h2
1 files changed, 2 insertions, 0 deletions
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 *);