master
Ondřej Hruška 3 years ago
parent d6c30d5414
commit 3eae9abada
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 14
      src/fh_builtins.c

@ -306,6 +306,17 @@ static enum fh_error w_dupe(struct fh_thread_s *fh, const struct fh_word_s *w)
return FH_OK; return FH_OK;
} }
static enum fh_error w_nip(struct fh_thread_s *fh, const struct fh_word_s *w)
{
(void) w;
enum fh_error rv;
uint32_t a = 0, discard = 0;
TRY(ds_pop(fh, &a));
TRY(ds_pop(fh, &discard));
TRY(ds_push(fh, a));
return FH_OK;
}
static enum fh_error w_question_dupe(struct fh_thread_s *fh, const struct fh_word_s *w) static enum fh_error w_question_dupe(struct fh_thread_s *fh, const struct fh_word_s *w)
{ {
(void) w; (void) w;
@ -752,6 +763,8 @@ enum fh_error register_builtin_words(struct fh_thread_s *fh)
{"decimal", wp_setbase, 0, 10}, {"decimal", wp_setbase, 0, 10},
{"hex", wp_setbase, 0, 16}, {"hex", wp_setbase, 0, 16},
{"base", wp_const, 0, MAGICADDR_BASE}, {"base", wp_const, 0, MAGICADDR_BASE},
{"false", wp_const, 0, 0},
{"true", wp_const, 0, 0xFFFFFFFF},
{"depth", w_depth, 0, 0}, {"depth", w_depth, 0, 0},
{"+", w_plus, 0, 0}, {"+", w_plus, 0, 0},
{"-", w_minus, 0, 0}, {"-", w_minus, 0, 0},
@ -781,6 +794,7 @@ enum fh_error register_builtin_words(struct fh_thread_s *fh)
/* Stack manip */ /* Stack manip */
{"drop", w_drop, 0, 0}, {"drop", w_drop, 0, 0},
{"dup", w_dupe, 0, 0}, {"dup", w_dupe, 0, 0},
{"nip", w_nip, 0, 0},
{"?dup", w_question_dupe, 0, 0}, {"?dup", w_question_dupe, 0, 0},
{"over", w_over, 0, 0}, {"over", w_over, 0, 0},
{"swap", w_swap, 0, 0}, {"swap", w_swap, 0, 0},

Loading…
Cancel
Save