postpone works now
This commit is contained in:
+22
-6
@@ -43,6 +43,9 @@ enum fb_instruction_kind {
|
||||
|
||||
/* Jump if zero */
|
||||
FH_INSTR_JUMPZERO,
|
||||
|
||||
/* Postponed word */
|
||||
FH_INSTR_POSTPONED_WORD,
|
||||
};
|
||||
|
||||
/** One instruction in bytecode */
|
||||
@@ -65,9 +68,13 @@ _Static_assert(sizeof(struct fh_instruction_s) % 4 == 0, "Instruction struct is
|
||||
|
||||
/** Forth runtime major state */
|
||||
enum fh_state {
|
||||
/** Interactive interpret mode */
|
||||
FH_STATE_INTERPRET = 0,
|
||||
/** Compiling */
|
||||
FH_STATE_COMPILE,
|
||||
/** Quit from RUN to interpret */
|
||||
FH_STATE_QUIT,
|
||||
/** Shutting down the runtime */
|
||||
FH_STATE_SHUTDOWN,
|
||||
FH_STATE_MAX,
|
||||
};
|
||||
@@ -75,18 +82,20 @@ enum fh_state {
|
||||
/** Forth runtime minor state */
|
||||
enum fh_substate {
|
||||
FH_SUBSTATE_NONE = 0,
|
||||
FH_SUBSTATE_COLONNAME,
|
||||
FH_SUBSTATE_SQUOTE,
|
||||
FH_SUBSTATE_DOTQUOTE,
|
||||
FH_SUBSTATE_PARENCOMMENT,
|
||||
FH_SUBSTATE_LINECOMMENT,
|
||||
FH_SUBSTATE_COLON_NAME,
|
||||
FH_SUBSTATE_S_QUOTE,
|
||||
FH_SUBSTATE_DOT_QUOTE,
|
||||
FH_SUBSTATE_PAREN_COMMENT,
|
||||
FH_SUBSTATE_LINE_COMMENT,
|
||||
FH_SUBSTATE_EXIT,
|
||||
FH_SUBSTATE_SEENAME,
|
||||
FH_SUBSTATE_SEE_NAME,
|
||||
FH_SUBSTATE_POSTPONE_NAME,
|
||||
FH_SUBSTATE_MAX,
|
||||
};
|
||||
|
||||
/** Word struct as they are stored in the dictionary */
|
||||
struct fh_word_s {
|
||||
uint32_t index;
|
||||
/** Word name */
|
||||
char name[MAX_NAME_LEN];
|
||||
/**
|
||||
@@ -185,5 +194,12 @@ _Static_assert(WORDALIGNED(1024) == 1024, "word align");
|
||||
if (FH_OK != (rv = (x))) return rv; \
|
||||
} while (0)
|
||||
|
||||
enum fh_error fh_handle_ascii_word(
|
||||
struct fh_thread_s *fh,
|
||||
const char *name,
|
||||
size_t wordlen
|
||||
);
|
||||
|
||||
enum fh_error fh_handle_word(struct fh_thread_s *fh, const struct fh_word_s *w);
|
||||
|
||||
#endif //FORTH_FH_RUNTIME_H
|
||||
|
||||
Reference in New Issue
Block a user