/** * Copyright (c) 2026 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #pragma once #include "core/scriptcore.h" #include "core/scriptsource.h" #include "parser/scriptnode.h" typedef struct { char name[SCRIPT_NAME_MAX]; scriptnode_t *defaultValue; } scriptparam_t; // Bits of a function's flags, see scriptfuncnode_t. #define SCRIPT_FUNCNODE_FLAG_ASYNC (1 << 0) #define SCRIPT_FUNCNODE_FLAG_INLINE (1 << 1) // declared with inline, which is made in place of every call it can be #define SCRIPT_FUNCNODE_FLAG_NOINLINE (1 << 2) // declared with noinline, which is never made in place #define SCRIPT_FUNCNODE_FLAG_ROOT (1 << 3) #define SCRIPT_FUNCNODE_FLAG_SCRIPT (1 << 4) // the top level of a script, which is not a function that was written in it typedef struct scriptfuncnode_s { char name[SCRIPT_NAME_MAX]; scriptparam_t params[SCRIPT_PARAMS_MAX]; uint8_t paramCount; scriptnode_t *body; uint8_t flags; // SCRIPT_FUNCNODE_FLAG_* uint16_t uses; // how many times its name is used in the script, a function that is used once is made in place uint16_t line; uint16_t column; const scriptsource_t *source; } scriptfuncnode_t;