about summary refs log tree commit diff
path: root/src/3cl.c
diff options
context:
space:
mode:
authorNakidai <plaza521@inbox.ru>2024-08-24 14:29:55 +0300
committerNakidai <plaza521@inbox.ru>2024-08-24 14:29:55 +0300
commitc74aea420c662039072f606b2d5ef1c73426e481 (patch)
tree4790fa17644df9e11380d6c02b8928c923c20aba /src/3cl.c
parent2b0e05cbc1e4d9beccd3a5867c8730880f6ecc10 (diff)
download3cl-c74aea420c662039072f606b2d5ef1c73426e481.tar.gz
3cl-c74aea420c662039072f606b2d5ef1c73426e481.zip
Add more code
Add some funcitons to work with variables, add more instructions and add
ability to stop the code from `ccl_instruction`
Diffstat (limited to 'src/3cl.c')
-rw-r--r--src/3cl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/3cl.c b/src/3cl.c
index c8016a9..bcadf4d 100644
--- a/src/3cl.c
+++ b/src/3cl.c
@@ -1,6 +1,7 @@
 #include "3cl.h"
 
 #include <errno.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -12,6 +13,7 @@ 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)
@@ -69,6 +71,10 @@ void ccl_exec(struct CCL *ccl)
 {
     struct CCLFrame *curframe = &ccl->rootframe;
 
-    for (;;++curframe->ep)
+    for (;;)
+    {
         curframe = ccl_instruction(ccl, curframe);
+        if (ccl->stopped)
+            break;
+    }
 }