diff options
Diffstat (limited to 'forthmachine.h')
-rw-r--r-- | forthmachine.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/forthmachine.h b/forthmachine.h index 8854eac..50eb4d8 100644 --- a/forthmachine.h +++ b/forthmachine.h @@ -20,32 +20,34 @@ typedef void (*directiveop)(forthmachine* fm, int len, char* line, int* i); extern char* outputbuffer; extern int outputline; +typedef enum { + compileditem_stackop = 0, + compileditem_literal = 1, + compileditem_ifcontrol = 2, +} compileditem_type; + typedef struct { - bool isliteral; + compileditem_type type; union { wordop* wordop; stackitem literal; + struct { + int jumpto; + }; }; } compileditem; typedef enum { - directive = 0, - builtin = 1, - script = 2, - compiled = 3, + builtin = 0, + compiled = 1, } optype; struct wordop { char* word; optype optype; union { - directiveop directive; stackop op; struct { - char* script; - int scriptlen; - }; - struct { compileditem* oplist; int oplistlen; }; @@ -63,6 +65,8 @@ struct optable { */ wordop* optable_getop(optable* optable, char *word); +void defineop(forthmachine* fm, char *input, int* starti); + optable* optable_new(); struct forthmachine { |