From: Tim Vaughan Date: Sun, 12 Jun 2016 00:16:33 +0000 (+1200) Subject: Abort now resets the input stream. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=b2b707fe1502c612ee247f098d1987f67e62017d;p=forth.jl.git Abort now resets the input stream. --- diff --git a/src/forth.jl b/src/forth.jl index f10ea04..609897a 100644 --- a/src/forth.jl +++ b/src/forth.jl @@ -585,6 +585,14 @@ end) sources = Array{Any,1}() currentSource() = sources[length(sources)] +CLOSEFILES_CFA = defPrimWord("CLOSEFILES", () -> begin + while currentSource() != STDIN + close(pop!(sources)) + end + + return NEXT +end) + EOF_CFA = defPrimWord("\x04", () -> begin if currentSource() != STDIN close(pop!(sources)) @@ -1031,7 +1039,7 @@ QUIT_CFA = defWord("QUIT", BRANCH_CFA,-4]) ABORT_CFA = defWord("ABORT", - [PSP0_CFA, PSPSTORE_CFA, QUIT_CFA]) + [CLOSEFILES_CFA, PSP0_CFA, PSPSTORE_CFA, QUIT_CFA]) BYE_CFA = defPrimWord("BYE", () -> begin println("\nBye!")