From 348c64f97b133a7f346d242bb4658df3b5a99719 Mon Sep 17 00:00:00 2001 From: Zuhaitz Méndez Fernández de Aránguiz Date: Sun, 11 Jan 2026 15:51:21 +0000 Subject: Plugins time. --- plugins/zprep_plugin.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 plugins/zprep_plugin.h (limited to 'plugins/zprep_plugin.h') diff --git a/plugins/zprep_plugin.h b/plugins/zprep_plugin.h new file mode 100644 index 0000000..b51cffd --- /dev/null +++ b/plugins/zprep_plugin.h @@ -0,0 +1,30 @@ + +#ifndef ZPREP_PLUGIN_H +#define ZPREP_PLUGIN_H + +#include +#include + +// The Host provides this API to the Plugin. +typedef struct +{ + // Context Information (Where are we?). + const char *filename; + int current_line; + FILE *out; // Inline output (expression context) + FILE *hoist_out; // Hoisted output (file scope / top level) +} ZApi; + +// The Plugin Function Signature. +// Returns void. All output is done via 'api'. +typedef void (*ZPluginTranspileFn)(const char *input_body, const ZApi *api); + +typedef struct +{ + char name[32]; + ZPluginTranspileFn fn; +} ZPlugin; + +typedef ZPlugin *(*ZPluginInitFn)(void); + +#endif -- cgit v1.2.3