Skip to content

Commit

Permalink
GH-21 Make the internal _quit the only QUIT.
Browse files Browse the repository at this point in the history
  • Loading branch information
SirWumpus committed Aug 28, 2024
1 parent c22ca16 commit 3e161e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/post4.c
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ p4Repl(P4_Ctx *ctx, int rc)
#define w_semi words[1]
P4_WORD("_abort", &&_abort, 0, 0x00),
#define w_abort words[2]
P4_WORD("_quit", &&_quit, 0, 0x00),
P4_WORD("QUIT", &&_quit, 0, 0x00),
#define w_quit words[3]
P4_WORD("_interpret", &&_interpret, 0, 0x00),
#define w_interpret words[4]
Expand Down Expand Up @@ -1644,6 +1644,7 @@ _quit: P4_RESET(ctx->rs);
/* Discard the current input buffer. */
ctx->input.offset = ctx->input.length = 0;
ctx->state = P4_STATE_INTERPRET;
ctx->frame = 0;
/*@fallthrough@*/
case P4_THROW_OK:
;
Expand Down
10 changes: 0 additions & 10 deletions src/post4.p4
Original file line number Diff line number Diff line change
Expand Up @@ -650,16 +650,6 @@ DEFER _fsp!
\ ( i*x -- ⊥ )(F: k*x -- ⊥ )( R: j*x -- ⊥ )
: ABORT -1 THROW ;

\ GH-18
\ QUIT resumes the REPL and never returns to the caller.
\ Need to be sure to reset the catch_frame for future
\ THROW CATCH ABORT or QUIT.
\
\ printf "' quit catch \n abort" | ./post4 ; echo $?
\
\ ( i*x -- ⊥ )(F: k*x -- ⊥ )
: QUIT 0 catch_frame ! _quit ;

\ ( xt -- )
: execute-compiling
STATE @ IF EXECUTE EXIT THEN
Expand Down

0 comments on commit 3e161e6

Please sign in to comment.