From a18479b21c5ca4c000d01e45fbaf5f086150a9f4 Mon Sep 17 00:00:00 2001 From: Maxwell Jeffress Date: Sun, 25 Jan 2026 14:37:50 +1100 Subject: [PATCH] It compiles on windows now I guess --- src/interpreter.c | 7 +++++++ src/parser.c | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/interpreter.c b/src/interpreter.c index a3246e1..d1d41da 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -5,7 +5,9 @@ #include #include #include +#ifndef _WIN32 #include +#endif #include #include @@ -1925,6 +1927,10 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop } case EXTERN: { + #ifdef _WIN32 + runtimeError(FIXME, "No Windows support for extern, sucker", in, currentInstruction); + #endif + #ifndef _WIN32 if (in->args.length < 1) { runtimeError(TOO_FEW_ARGS, "Expecting 1 arg", in, currentInstruction); } @@ -1974,6 +1980,7 @@ GroundValue interpretGroundInstruction(GroundInstruction inst, GroundScope* scop } initFn(scope); + #endif break; } diff --git a/src/parser.c b/src/parser.c index 7cfad14..0a637a4 100644 --- a/src/parser.c +++ b/src/parser.c @@ -5,6 +5,25 @@ #include #include +#ifdef _WIN32 +size_t strnlen(const char *src, size_t n) { + size_t len = 0; + while (len < n && src[len]) + len++; + return len; +} + +char* strndup(const char *s, size_t n) { + size_t len = strnlen(s, n); + char *p = malloc(len + 1); + if (p) { + memcpy(p, s, len); + p[len] = '\0'; + } + return p; +} +#endif + GroundProgram createGroundProgram() { GroundProgram gp; gp.size = 0;