diff --git a/src/fh_builtins_meta.c b/src/fh_builtins_meta.c index b2667d2..de27bbc 100644 --- a/src/fh_builtins_meta.c +++ b/src/fh_builtins_meta.c @@ -10,12 +10,14 @@ static enum fh_error w_colon(struct fh_thread_s *fh, const struct fh_word_s *w) size_t namelen = 0; fh_input_consume_spaces(fh); TRY(fh_input_read_word(fh, &wordname, &namelen)); - LOG("Name: %.*s", (int) namelen, wordname); fh_setstate(fh, FH_STATE_COMPILE, 0); uint32_t ptr; + fh_align(fh); TRY(fh_heap_reserve(fh, DICTWORD_SIZE, &ptr)); + + LOG("New word \"%.*s\", head at 0x%08x, exec at 0x%08x", (int) namelen, wordname, ptr, fh->here); struct fh_word_s *new_word = fh_word_at(fh, ptr); if (!new_word) { return FH_ERR_INTERNAL; } @@ -89,6 +91,7 @@ static enum fh_error w_colon_noname(struct fh_thread_s *fh, const struct fh_word fh_setstate(fh, FH_STATE_COMPILE, 0); uint32_t ptr; + fh_align(fh); TRY(fh_heap_reserve(fh, DICTWORD_SIZE, &ptr)); struct fh_word_s *new_word = fh_word_at(fh, ptr); @@ -218,6 +221,7 @@ static enum fh_error wp_variable(struct fh_thread_s *fh, const struct fh_word_s TRY(ds_pop(fh, &value)); } + fh_align(fh); TRY(fh_heap_reserve(fh, DICTWORD_SIZE, &ptr)); struct fh_word_s *new_word = fh_word_at(fh, ptr); @@ -536,6 +540,7 @@ static enum fh_error w_defer(struct fh_thread_s *fh, const struct fh_word_s *w) uint32_t ptr; + fh_align(fh); TRY(fh_heap_reserve(fh, DICTWORD_SIZE, &ptr)); struct fh_word_s *new_word = fh_word_at(fh, ptr); diff --git a/src/fh_runtime.c b/src/fh_runtime.c index 13e6c95..ae051bb 100644 --- a/src/fh_runtime.c +++ b/src/fh_runtime.c @@ -55,6 +55,7 @@ void fh_abort(struct fh_thread_s *fh) { void fh_drop_to_interactive(struct fh_thread_s *fh) { fh_input_teardown(fh); + fh_push_input(fh, fh_create_input_from_filestruct(stdin, NULL)); fh->return_stack_top = 0; fh->execptr = MAGICADDR_EXEC_INTERACTIVE; diff --git a/testfiles/refill_sid.f b/testfiles/refill_sid.f index 2daf557..380132e 100644 --- a/testfiles/refill_sid.f +++ b/testfiles/refill_sid.f @@ -1,4 +1 @@ - -: RF1 S" REFILL" EVALUATE ; - -RF1 +: RF1 S" REFILL" EVALUATE ; RF1