summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-26 02:45:47 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-26 02:45:47 +0000
commit2022012d6514578bd53a91b3048d08cf8686e233 (patch)
treee9fb39723214d58fc54456109c3cc0878155280b /plugins
parent894e4c69cc10242fc49bcaadf76b672607867d67 (diff)
Improved documentation for header files in src/ and plugins/
Diffstat (limited to 'plugins')
-rw-r--r--plugins/zprep_plugin.h36
1 files changed, 27 insertions, 9 deletions
diff --git a/plugins/zprep_plugin.h b/plugins/zprep_plugin.h
index b51cffd..1cea813 100644
--- a/plugins/zprep_plugin.h
+++ b/plugins/zprep_plugin.h
@@ -5,26 +5,44 @@
#include <stddef.h>
#include <stdio.h>
-// The Host provides this API to the Plugin.
+/**
+ * @brief Host API provided to plugins.
+ *
+ * Plugins use this structure to interact with the compiler/codegen environment.
+ */
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)
+ const char *filename; ///< Current file name being processed.
+ int current_line; ///< Current line number.
+ FILE *out; ///< Inline output stream (replaces the macro call).
+ FILE *hoist_out; ///< Hoisted output stream (writes to file scope/header).
} ZApi;
-// The Plugin Function Signature.
-// Returns void. All output is done via 'api'.
+/**
+ * @brief The Plugin Function Signature.
+ *
+ * Plugins must implement a function with this signature to handle transpilation.
+ *
+ * @param input_body The raw text content inside the plugin call.
+ * @param api Pointer to the host API structure.
+ */
typedef void (*ZPluginTranspileFn)(const char *input_body, const ZApi *api);
+/**
+ * @brief Plugin definition structure.
+ */
typedef struct
{
- char name[32];
- ZPluginTranspileFn fn;
+ char name[32]; ///< Name of the plugin.
+ ZPluginTranspileFn fn; ///< Pointer to the transpilation function.
} ZPlugin;
+/**
+ * @brief Signature for the plugin entry point.
+ *
+ * Dynamic libraries must export a function named `z_init` matching this signature.
+ */
typedef ZPlugin *(*ZPluginInitFn)(void);
#endif