|
|
@ -31,6 +31,42 @@ static enum fh_error w_colon(struct fh_thread_s *fh, const struct fh_word_s *w) |
|
|
|
return FH_OK; |
|
|
|
return FH_OK; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static enum fh_error rt_marker(struct fh_thread_s *fh, const struct fh_word_s *w) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
LOG("Restore dict to landmark sate \"%s\"", w->name); |
|
|
|
|
|
|
|
fh->dict_last = w->param; |
|
|
|
|
|
|
|
return FH_OK; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static enum fh_error w_marker(struct fh_thread_s *fh, const struct fh_word_s *w) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
(void) w; |
|
|
|
|
|
|
|
enum fh_error rv; |
|
|
|
|
|
|
|
ENSURE_STATE(FH_STATE_INTERPRET); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *wordname = NULL; |
|
|
|
|
|
|
|
size_t namelen = 0; |
|
|
|
|
|
|
|
fh_input_consume_spaces(fh); |
|
|
|
|
|
|
|
TRY(fh_input_read_word(fh, &wordname, &namelen)); |
|
|
|
|
|
|
|
LOG("Marker name: %.*s", namelen, wordname); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t ptr; |
|
|
|
|
|
|
|
TRY(fh_heap_reserve(fh, DICTWORD_SIZE, &ptr)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct fh_word_s *new_word = fh_word_at(fh, ptr); |
|
|
|
|
|
|
|
if (!new_word) return FH_ERR_INTERNAL; |
|
|
|
|
|
|
|
new_word->previous = fh->dict_last; |
|
|
|
|
|
|
|
new_word->param = fh->dict_last; |
|
|
|
|
|
|
|
new_word->handler = rt_marker; |
|
|
|
|
|
|
|
strncpy(new_word->name, wordname, namelen); |
|
|
|
|
|
|
|
new_word->name[namelen] = 0; |
|
|
|
|
|
|
|
new_word->flags = WORDFLAG_WORD; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fh->dict_last = ptr; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return FH_OK; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static enum fh_error w_colon_noname(struct fh_thread_s *fh, const struct fh_word_s *w) |
|
|
|
static enum fh_error w_colon_noname(struct fh_thread_s *fh, const struct fh_word_s *w) |
|
|
|
{ |
|
|
|
{ |
|
|
|
(void) w; |
|
|
|
(void) w; |
|
|
@ -655,5 +691,6 @@ const struct name_and_handler fh_builtins_meta[] = { |
|
|
|
{"[']", wp_tick, 1, 1}, |
|
|
|
{"[']", wp_tick, 1, 1}, |
|
|
|
{"execute", w_execute, 0, 0}, |
|
|
|
{"execute", w_execute, 0, 0}, |
|
|
|
{"environment?", w_env_query, 0, 0}, |
|
|
|
{"environment?", w_env_query, 0, 0}, |
|
|
|
|
|
|
|
{"marker", w_marker, 0, 0}, |
|
|
|
{ /* end marker */ } |
|
|
|
{ /* end marker */ } |
|
|
|
}; |
|
|
|
}; |
|
|
|