From 6ce1c89e4bed7da31d05da0e0eb02e6515bee18a Mon Sep 17 00:00:00 2001 From: Maxwell Jeffress Date: Fri, 2 Jan 2026 20:56:00 +1100 Subject: [PATCH] I forgot to upload the header lmao --- include/groundext.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 include/groundext.h diff --git a/include/groundext.h b/include/groundext.h new file mode 100644 index 0000000..e8c35ac --- /dev/null +++ b/include/groundext.h @@ -0,0 +1,37 @@ +#ifndef GROUND_EXT_H +#define GROUND_EXT_H + +#include "groundvm.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Forward declaration of the scope structure used in interpreter +struct GroundScope; +typedef struct GroundScope GroundScope; + +/* + * Function pointer type for native functions. + * scope: The current execution scope (opaque). + * args: A List of arguments passed to the function. + */ +typedef GroundValue (*NativeGroundFunction)(GroundScope* scope, List args); + +/* + * Registers a native function in the given scope. + * + * scope: The scope to register the function in. + * name: The name of the function in Ground. + * fn: The C function to call. + * returnType: The return type of the function. + * argCount: The number of arguments the function expects. + * ...: A sequence of (GroundValueType type, char* name) for each argument. + */ +void groundAddNativeFunction(GroundScope* scope, char* name, NativeGroundFunction fn, GroundValueType returnType, int argCount, ...); + +#ifdef __cplusplus +} +#endif + +#endif