From 41c152718b1ef950b43979b497349f93951fd19e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sat, 27 Nov 2021 17:23:27 +0100 Subject: [PATCH] fixes --- src/fh_builtins_meta.c | 11 +++++++++++ testfiles/combinedtest.f | 1 - 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/fh_builtins_meta.c b/src/fh_builtins_meta.c index de27bbc..d6bd743 100644 --- a/src/fh_builtins_meta.c +++ b/src/fh_builtins_meta.c @@ -911,6 +911,16 @@ static enum fh_error w_parse_name(struct fh_thread_s *fh, const struct fh_word_s return FH_OK; } +static enum fh_error w_refill(struct fh_thread_s *fh, const struct fh_word_s *w) +{ + (void) w; + enum fh_error rv; + bool suc = fh->input->refill_input_buffer(fh, fh->input); + if (fh->input->source_id == -1) suc = false; // string always says it can't refill + TRY(ds_push(fh, TOBOOL(suc))); + return FH_OK; +} + const struct name_and_handler fh_builtins_meta[] = { {"depth", w_depth, 0, 0}, {"unused", w_unused, 0, 0}, @@ -957,5 +967,6 @@ const struct name_and_handler fh_builtins_meta[] = { {"evaluate", w_evaluate, 0, 0}, {"included", w_included, 0, 0}, {"include", w_include, 0, 0}, + {"refill", w_refill, 0, 0}, { /* end marker */ } }; diff --git a/testfiles/combinedtest.f b/testfiles/combinedtest.f index 66eccfb..a134c12 100644 --- a/testfiles/combinedtest.f +++ b/testfiles/combinedtest.f @@ -1788,7 +1788,6 @@ TESTING REFILL SOURCE-ID \ REFILL and SOURCE-ID from the user input device can't be tested from a file, \ can only be tested from a string via EVALUATE -1 debug T{ : RF1 S" REFILL" EVALUATE ; RF1 -> FALSE }T T{ : SID1 S" SOURCE-ID" EVALUATE ; SID1 -> -1 }T