From ad9d6a199db7c28f8b20f131dfb55a26e0e251de Mon Sep 17 00:00:00 2001 From: Nakidai Date: Sun, 23 Mar 2025 21:11:13 +0300 Subject: Again... --- src/3cl.c | 80 --------------------------------------------------------------- 1 file changed, 80 deletions(-) delete mode 100644 src/3cl.c (limited to 'src/3cl.c') diff --git a/src/3cl.c b/src/3cl.c deleted file mode 100644 index bcadf4d..0000000 --- a/src/3cl.c +++ /dev/null @@ -1,80 +0,0 @@ -#include "3cl.h" - -#include -#include -#include -#include - -#include "instruction.h" - - -int ccl_init(struct CCL *ccl, const char *code, int (*in)(), void (*out)(int)) -{ - *ccl = (struct CCL) - { - .code = code, - .stopped = false, - .in = in, - .out = out, - .rootframe = (struct CCLFrame) - { - .prev = NULL, .next = NULL, - .type = CCL_ROOT, - .ep = 0, - .vars = (struct CCLVariable) - { - .prev = NULL, - .next = NULL, - .name = '_', - .value = 0 - }, - }, - .stack = (struct CCLStack) - { - .length = CCL_STACKSIZE, - .stack = (CCLNum *)malloc(CCL_STACKSIZE) - }, - }; - - return errno; -} - -void ccl_free(struct CCL *ccl) -{ - free(ccl->stack.stack); - if (ccl->rootframe.next != NULL) - { - for (struct CCLFrame *frame = ccl->rootframe.next, *new;;) - { - if (frame->vars.next != NULL) - { - for (struct CCLVariable *var = frame->vars.next, *new;;) - { - if (var->next == NULL) - break; - new = var->next; - free(var); - var = new; - } - } - - if (frame->next == NULL) - break; - new = frame->next; - free(frame); - frame = new; - } - } -} - -void ccl_exec(struct CCL *ccl) -{ - struct CCLFrame *curframe = &ccl->rootframe; - - for (;;) - { - curframe = ccl_instruction(ccl, curframe); - if (ccl->stopped) - break; - } -} -- cgit 1.4.1