From 13a861377a55a77d2ad2072fd700b720aa71d4d0 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 31 Mar 2012 16:00:52 -0700 Subject: If one of the blocks which are subordinate to a @(trailer) happen to request a successful termination by invoking @(accept) the position must not advance into the trailer material. * match.c (v_trailer): Added an unwind protect which detects that an accept is taking place and adjusts the return value to restrict the input position at the point given to trailer. (accept_fail): Use uw_block_return_proto instead of uw_block_return and pass the symbol as the protocol identifier. * unwind.c (uw_current_exit_point): New function. (uw_block_return): Function renamed to uw_block_return_proto; takes new parameter which is stored in the block structure. * unwind.h (struct uw_block): New member, protocol. (uw_block_return): Becomes an inline wrapper for uw_block_return_proto. (uw_block_return_proto, uw_current_exit_point): Declared. * txr.1: Interaction between @(trailer) and @(accept) documented. --- unwind.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'unwind.c') diff --git a/unwind.c b/unwind.c index 34ef821a..a51ef98f 100644 --- a/unwind.c +++ b/unwind.c @@ -192,7 +192,12 @@ uw_frame_t *uw_current_frame(void) return uw_stack; } -val uw_block_return(val tag, val result) +uw_frame_t *uw_current_exit_point(void) +{ + return uw_exit_point; +} + +val uw_block_return_proto(val tag, val result, val protocol) { uw_frame_t *ex; @@ -205,6 +210,7 @@ val uw_block_return(val tag, val result) return nil; ex->bl.result = result; + ex->bl.protocol = protocol; uw_exit_point = ex; uw_unwind_to_exit_point(); abort(); -- cgit v1.2.3