diff options
| author | physick <mynameisgennadiy@vk.com> | 2026-07-12 12:55:19 +0500 |
|---|---|---|
| committer | physick <mynameisgennadiy@vk.com> | 2026-07-12 12:55:19 +0500 |
| commit | 71e1f2dc8e9e1b3ee595a2712ec24d11ce243f1c (patch) | |
| tree | fe5d83589ef618dee9c34ff1a229cee851300f09 /src/puzzles | |
| parent | 58a26ca05aacb4736e9e7e652badd43a8085d1f1 (diff) | |
Result view
Diffstat (limited to 'src/puzzles')
| -rw-r--r-- | src/puzzles/puzzle.c | 8 | ||||
| -rw-r--r-- | src/puzzles/puzzle.h | 25 |
2 files changed, 21 insertions, 12 deletions
diff --git a/src/puzzles/puzzle.c b/src/puzzles/puzzle.c index 1bfb6be..cbad998 100644 --- a/src/puzzles/puzzle.c +++ b/src/puzzles/puzzle.c @@ -13,9 +13,9 @@ Puzzle *GetTestPuzzle() { } void FreePuzzle(Puzzle *self) { - free(self->Name); - free(self->Description); - free(self->PrivateTests); - free(self->PublicTests); + if (self == NULL) return; + if (self->Name != NULL) free(self->Name); + if (self->Description != NULL) free(self->Description); + if (self->Tests != NULL) free(self->Tests); free(self); } diff --git a/src/puzzles/puzzle.h b/src/puzzles/puzzle.h index 8f7ef0d..d530a89 100644 --- a/src/puzzles/puzzle.h +++ b/src/puzzles/puzzle.h @@ -1,11 +1,23 @@ #include <stddef.h> +#include <wren.h> #ifndef PUZZLE_H +// This is a param that would be placed in a slot +// https://wren.io/embedding/slots-and-handles.html#writing-slots typedef struct { - // TODO: figure it out - char *LuaSnippet; - char *ExpectedOutput; + WrenType type; + // We store this value as void * to generalize. The downside of this approach + // is an extenciva allocation + void *value; +} PuzzleIO; + +typedef struct { + // https://wren.io/embedding/calling-wren-from-c.html#getting-a-method-handle + char *MainMethodSignature; + + size_t argc; + PuzzleIO *argv; } Test; typedef struct { @@ -13,11 +25,8 @@ typedef struct { char *Description; /// The tests that are accessible for an end user - size_t PublicTestC; - Test *PublicTests; - - size_t PrivateTestC; - Test *PrivateTests; + size_t TestC; + Test *Tests; } Puzzle; // TODO |
