summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-04-15 05:50:07 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-04-15 05:50:07 -0700
commite1a681d66738eedbfdbd351e9ca4d2aaf1b3fb69 (patch)
treed094cd94133dc29fe2ce14396687d420abdf6be8 /share
parent424696dc09a91939c8c5fb66975be0f737fac9aa (diff)
downloadtxr-e1a681d66738eedbfdbd351e9ca4d2aaf1b3fb69.tar.gz
txr-e1a681d66738eedbfdbd351e9ca4d2aaf1b3fb69.tar.bz2
txr-e1a681d66738eedbfdbd351e9ca4d2aaf1b3fb69.zip
Macros obtain* and obtain*-block.
* lisplib.c (yield_set_entries): Add obtain* and obtain*-block to autoload list. * share/txr/stdlib/yield.tl (obtain*, obtain*-block): New macros. * txr.1: Documented.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/yield.tl12
1 files changed, 12 insertions, 0 deletions
diff --git a/share/txr/stdlib/yield.tl b/share/txr/stdlib/yield.tl
index d3dac917..6bcf8a46 100644
--- a/share/txr/stdlib/yield.tl
+++ b/share/txr/stdlib/yield.tl
@@ -54,6 +54,18 @@
(defmacro obtain-block (name . body)
^(obtain (block ,name ,*body)))
+(defmacro obtain* (. body)
+ (let ((arg (gensym "arg"))
+ (fun (gensym "fun")))
+ ^(let ((,fun (sys:obtain-impl (lambda (,arg)
+ (unless (eq ,arg 'sys:cont-free)
+ ,*body)))))
+ (call ,fun nil)
+ ,fun)))
+
+(defmacro obtain*-block (name . body)
+ ^(obtain* (block ,name ,*body)))
+
(defmacro yield-from (:form ctx-form name : (form nil have-form-p))
(let ((cont-sym (gensym)))
^(sys:capture-cont ',name