diff --git a/src/post4.c b/src/post4.c index 32d608f..53fdb98 100755 --- a/src/post4.c +++ b/src/post4.c @@ -1043,7 +1043,7 @@ p4Repl(P4_Ctx *ctx, int thrown) #define w_semi words[2] P4_WORD("_abort", &&_abort, 0, 0x00), // p4 #define w_abort words[3] - P4_WORD("_quit", &&_quit, 0, 0x00), // p4 + P4_WORD("QUIT", &&_quit, 0, 0x00), #define w_quit words[4] P4_WORD("_interpret", &&_interpret, 0, 0x00), // p4 #define w_interpret words[5] @@ -1314,6 +1314,9 @@ _abort: P4_RESET(ctx->ds); #ifdef HAVE_MATH_H P4_RESET(ctx->fs); #endif + if (!is_tty) { + exit(P4_EXIT_EXCEPTION); + } /*@fallthrough@*/ case P4_THROW_QUIT: _quit: P4_RESET(ctx->rs); @@ -1323,9 +1326,6 @@ _quit: P4_RESET(ctx->rs); ctx->frame = 0; /* Reset level, else next trace the indentation might be skewed. */ ctx->level = 0; - if (!is_tty) { - exit(P4_EXIT_EXCEPTION); - } /*@fallthrough@*/ case P4_THROW_OK: ; diff --git a/src/post4.p4 b/src/post4.p4 index 59711ad..8cc211e 100644 --- a/src/post4.p4 +++ b/src/post4.p4 @@ -2,9 +2,6 @@ \ Post4 Copyright 2007, 2024 by Anthony Howe. All rights reserved. -\ ( -- ⊥ ) -: QUIT -56 _longjmp ; - \ ( -- ⊥ ) : BYE 0 bye-status ; diff --git a/test/makefile.in b/test/makefile.in index 7e08df4..5683660 100644 --- a/test/makefile.in +++ b/test/makefile.in @@ -75,17 +75,17 @@ test_quit_catch : ${PROG} ! printf "' QUIT CATCH \n -123 THROW" | ${PROG} -c ${WORDS} printf 'S" 0 THROW" '\'' EVALUATE CATCH' | ${PROG} -c ${WORDS} printf 'S" -1 THROW" '\'' EVALUATE CATCH' | ${PROG} -c ${WORDS} - ! printf ": tw_keep_ds [: 123 QUIT ;] CATCH 456 . THROW ;\n tw_keep_ds \n . CR" | ${PROG} -c ${WORDS} + printf ": tw_keep_ds [: 123 QUIT ;] CATCH 456 . THROW ;\n tw_keep_ds \n . CR" | ${PROG} -c ${WORDS} @echo "-OK-" # GH-54 test_include_quit: ${PROG} @printf "==== Testing INCLUDE with QUIT\n" - ! ${PROG} -c ${WORDS} <${top_srcdir}/test/data/quit0.p4 - ! echo | ${PROG} -c ${WORDS} ${top_srcdir}/test/data/quit0.p4 - ! echo | ${PROG} -c ${WORDS} -i ${top_srcdir}/test/data/quit0.p4 - ! printf "INCLUDE ${top_srcdir}/test/data/quit0.p4" | ${PROG} -c ${WORDS} - ! printf "INCLUDE ${top_srcdir}/test/data/quit0.p4 \n BYE" | ${PROG} -c ${WORDS} + ${PROG} -c ${WORDS} <${top_srcdir}/test/data/quit0.p4 + echo | ${PROG} -c ${WORDS} ${top_srcdir}/test/data/quit0.p4 + echo | ${PROG} -c ${WORDS} -i ${top_srcdir}/test/data/quit0.p4 + printf "INCLUDE ${top_srcdir}/test/data/quit0.p4" | ${PROG} -c ${WORDS} + printf "INCLUDE ${top_srcdir}/test/data/quit0.p4 \n BYE" | ${PROG} -c ${WORDS} @echo "-OK-" # GH-54