diff options
author | dan <[email protected]> | 2023-05-29 17:16:01 -0400 |
---|---|---|
committer | dan <[email protected]> | 2023-05-29 17:16:01 -0400 |
commit | 0ba0482710f0a3300c0743a2a986e117972e6ec8 (patch) | |
tree | 09156b4ebfcf0177e883829f3ebec1525e9c64ad /optable.h | |
parent | bf791d062597784a7f4ebc143ada4cc87d4fdebd (diff) | |
download | forth-0ba0482710f0a3300c0743a2a986e117972e6ec8.tar.gz forth-0ba0482710f0a3300c0743a2a986e117972e6ec8.tar.bz2 forth-0ba0482710f0a3300c0743a2a986e117972e6ec8.zip |
refactor: optable no longer global
Diffstat (limited to 'optable.h')
-rw-r--r-- | optable.h | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -9,8 +9,10 @@ #define DEFINED_FUNC_MAX_LENGTH 1024 #define WORD_LEN_LIMIT 255 +typedef struct optable optable; + typedef void (*stackop)(stack *); -typedef void (*directiveop)(stack *, int len, char* line, int* i); +typedef void (*directiveop)(stack *, int len, char* line, int* i, optable* optable); typedef struct { bool isliteral; @@ -44,12 +46,17 @@ typedef struct { }; } wordop; +struct optable { + int len; + wordop* optable; +}; + /** * getop returns the first wordop in the optable which is called by the word given as a parameter * if none exist, returns 0 */ -wordop* getop(char *word); +wordop* optable_getop(optable* optable, char *word); -void optable_init(); +optable* optable_init(); #endif //OPTABLE_H |