aboutsummaryrefslogtreecommitdiffstats
path: root/optable.h
diff options
context:
space:
mode:
authordan <[email protected]>2023-05-30 17:10:55 -0400
committerdan <[email protected]>2023-05-30 17:10:55 -0400
commit66d61a5546e5e0173f92e941ab489a1c6474473e (patch)
tree17ccb05b23b3c86bae385ec2f49f6a7fc424ff76 /optable.h
parent0ba0482710f0a3300c0743a2a986e117972e6ec8 (diff)
downloadforth-66d61a5546e5e0173f92e941ab489a1c6474473e.tar.gz
forth-66d61a5546e5e0173f92e941ab489a1c6474473e.tar.bz2
forth-66d61a5546e5e0173f92e941ab489a1c6474473e.zip
feat: JIT-compiled ops are in an array
Diffstat (limited to 'optable.h')
-rw-r--r--optable.h14
1 files changed, 10 insertions, 4 deletions
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