diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-03-31 16:00:52 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-03-31 16:00:52 -0700 |
commit | 13a861377a55a77d2ad2072fd700b720aa71d4d0 (patch) | |
tree | bd4818196f87985f47169030885bdbd59ecddd16 /unwind.c | |
parent | b7f1f4c5bbea86e288b6a4d68595c1d2d07217bd (diff) | |
download | txr-13a861377a55a77d2ad2072fd700b720aa71d4d0.tar.gz txr-13a861377a55a77d2ad2072fd700b720aa71d4d0.tar.bz2 txr-13a861377a55a77d2ad2072fd700b720aa71d4d0.zip |
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.
Diffstat (limited to 'unwind.c')
-rw-r--r-- | unwind.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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(); |