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.h | |
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.h')
-rw-r--r-- | unwind.h | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -43,6 +43,7 @@ struct uw_block { uw_frtype_t type; val tag; val result; + val protocol; jmp_buf jb; }; @@ -91,7 +92,11 @@ val uw_get_func(val sym); val uw_set_func(val sym, val value); val uw_get_match_context(void); val uw_set_match_context(val context); -val uw_block_return(val tag, val result); +val uw_block_return_proto(val tag, val result, val protocol); +INLINE val uw_block_return(val tag, val result) +{ + return uw_block_return_proto(tag, result, nil); +} void uw_push_catch(uw_frame_t *, val matches); noreturn val uw_throw(val sym, val exception); noreturn val uw_throwf(val sym, val fmt, ...); @@ -106,6 +111,7 @@ void uw_push_debug(uw_frame_t *, val func, val args, val line, val chr); void uw_pop_frame(uw_frame_t *); uw_frame_t *uw_current_frame(void); +uw_frame_t *uw_current_exit_point(void); void uw_init(void); noreturn val type_mismatch(val, ...); |