From 5c9480ab1b5bb99d885584feab97aa058bc11ea6 Mon Sep 17 00:00:00 2001 From: Ludovic 'Archivist' Lagouardette Date: Sat, 26 Apr 2025 12:03:44 +0200 Subject: [PATCH] Compile time constant for parser state size added --- lib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib.c b/lib.c index 99eb54c..78ab5fc 100644 --- a/lib.c +++ b/lib.c @@ -36,6 +36,10 @@ #define unlikely(x) (!!(x)) #endif +#ifndef MAX_MAIN_SIZE +#define MAX_MAIN_SIZE 256 +#endif + struct label { int active; int dest; @@ -1083,7 +1087,7 @@ int ink_step(struct context *pContext) { int ink_compile(struct context *pContext, const char* buffer) { int routine, saved, executable_buffer_top; /* Main function has a size limit of 256 (need to know that for REPL */ - struct elem executable_buffer[256]; + struct elem executable_buffer[MAX_MAIN_SIZE]; struct ink_routine* currentRoutine; int err; struct stack_frame frame;