summaryrefslogtreecommitdiff
path: root/plugins/zprep_plugin.h
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-11 15:51:21 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-11 15:51:21 +0000
commit348c64f97b133a7f346d242bb4658df3b5a99719 (patch)
treeba6a3fe8c8c4973e035d253b8fb50619286a47fc /plugins/zprep_plugin.h
parenta524ba47371503e0a42d395d015dcd83c15c0199 (diff)
Plugins time.
Diffstat (limited to 'plugins/zprep_plugin.h')
-rw-r--r--plugins/zprep_plugin.h30
1 files changed, 30 insertions, 0 deletions
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 <stddef.h>
+#include <stdio.h>
+
+// 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