#include "forth.h" #include "fh_error.h" #include "fh_runtime.h" #include "fh_mem.h" #include "fh_stack.h" #include "fh_print.h" #include "fh_builtins.h" // extension static enum fh_error w_reset(struct fh_thread_s *fh, const struct fh_word_s *w) { (void) w; enum fh_error rv; ENSURE_STATE(FH_STATE_INTERPRET); fh_init(fh); return FH_OK; } static enum fh_error w_bye(struct fh_thread_s *fh, const struct fh_word_s *w) { (void) w; fh_setstate(fh, FH_STATE_SHUTDOWN, 0); return FH_OK; } static enum fh_error w_debug(struct fh_thread_s *fh, const struct fh_word_s *w) { (void) w; enum fh_error rv; uint32_t val; TRY(ds_pop(fh, &val)); fh_globals.verbose = val; return FH_OK; } const struct name_and_handler fh_builtins_system[] = { {"reset", w_reset, 1, 0}, {"bye", w_bye, 0, 0}, {"debug", w_debug, 0, 0}, { /* end marker */ } };