From 66d61a5546e5e0173f92e941ab489a1c6474473e Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 30 May 2023 17:10:55 -0400 Subject: feat: JIT-compiled ops are in an array --- optable.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'optable.h') diff --git a/optable.h b/optable.h index b378a9f..9675678 100644 --- a/optable.h +++ b/optable.h @@ -10,14 +10,20 @@ #define WORD_LEN_LIMIT 255 typedef struct optable optable; +typedef struct wordop wordop; typedef void (*stackop)(stack *); typedef void (*directiveop)(stack *, int len, char* line, int* i, optable* optable); +#ifdef __EMSCRIPTEN__ +extern char outputbuffer[1024]; +extern int* outputline; +#endif + typedef struct { bool isliteral; union { - stackop stackop; + wordop* wordop; stackitem literal; }; } compileditem; @@ -29,7 +35,7 @@ typedef enum { compiled = 3, } optype; -typedef struct { +struct wordop { char* word; optype optype; union { @@ -44,7 +50,7 @@ typedef struct { int oplistlen; }; }; -} wordop; +}; struct optable { int len; @@ -57,6 +63,6 @@ struct optable { */ wordop* optable_getop(optable* optable, char *word); -optable* optable_init(); +optable* optable_new(); #endif //OPTABLE_H -- cgit v1.2.3