From acfab363d334d0248adb771f655a74fb2a09c099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Mon, 15 Nov 2021 00:31:07 +0100 Subject: [PATCH] add depth and unused --- src/fh_builtins.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/fh_builtins.c b/src/fh_builtins.c index 5fc9650..a13caa7 100644 --- a/src/fh_builtins.c +++ b/src/fh_builtins.c @@ -985,7 +985,15 @@ static enum fh_error w_depth(struct fh_thread_s *fh, const struct fh_word_s *w) { (void) w; enum fh_error rv; - TRY(ds_push(fh, w->param)); + TRY(ds_push(fh, fh->data_stack_top)); + return FH_OK; +} + +static enum fh_error w_unused(struct fh_thread_s *fh, const struct fh_word_s *w) +{ + (void) w; + enum fh_error rv; + TRY(ds_push(fh, HEAP_SIZE - fh->heap_top)); return FH_OK; } @@ -1123,6 +1131,8 @@ enum fh_error register_builtin_words(struct fh_thread_s *fh) {"aligned", w_aligned, 0, 0}, {"allot", w_allot, 0, 0}, {"align", w_align, 0, 0}, + {"depth", w_depth, 0, 0}, + {"unused", w_unused, 0, 0}, {",", w_comma, 0, 0}, // TODO +! // TODO pictured numbers (#)