diff options
| author | 2025-11-07 23:28:54 -0600 | |
|---|---|---|
| committer | 2025-11-07 23:28:54 -0600 | |
| commit | 28ba35171bca7d911bcd74724bf4dfdca46b4590 (patch) | |
| tree | cd90e78aa7f947bbf2ce51f5ea91b7c1b353d642 /main.c | |
initial commit
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 57 |
1 files changed, 57 insertions, 0 deletions
@@ -0,0 +1,57 @@ +#include "pipeline.h" + +#define UNUSED(_v) ((void)(_v)) + +PIPELINE_STAGE int stage(struct pipeline_ctx_t *ctx, void *data, size_t len) +{ + UNUSED(ctx); + UNUSED(data); + UNUSED(len); + return 1; +} + +PIPELINE_STAGE int identity_stage(struct pipeline_ctx_t *ctx, void *data, size_t len) { + return pipeline_next(ctx, data, len); +} + +/* mockup: + * Pipeline signature: D -> D*1 + * int simple_1to1_stage(struct pipeline_ctx *ctx, void *data, size_t len) { + * void *out = ... transform data ...; + * size_t out_len = ^^^; + * return pipeline_next(ctx, out, out_len); + * } + * + * Pipeline signature: D -> D*(0,n) + * int complex_1tomany_stage(struct pipeline_ctx *ctx, void *data, size_t len) { + * int err; + * for (void *out; has_data(data, len); out = next_data(data, &len)) { + * if (!out) { + * return -1; ... next_data failed somehow ... + * } + * + * if ((err = pipeline_next(ctx, out, out_len)) < 0) { + * return err; + * } + * } + * return 0; + * } + * + * Pipeline signature: D -> D*1 + * int stateful_stage(struct pipeline_ctx *ctx, void *data, size_t len) { + * my_stage_t *stg = ctx->me; + * stg->stat_in += len; + * return pipeline_next(ctx, data, len); + * } + * + * Pipeline signature: D -> void (i.e., never calls next) + * int terminal_stage(struct pipeline_ctx *ctx, void *data, size_t len) { + * my_handler_t *handler = ctx->me; + * handler->do_handle(data, len); + * return 0; ... return values should indicate pipeline (i.e., parsing) errors, not application errors ... + * } + */ + +int main(void) { + return 0; +} |
