diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-10-28 06:08:23 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-10-28 06:08:23 -0700 |
commit | c39c6e6b72c750180dd13c38db8c69a609dbf574 (patch) | |
tree | 31006331bd5a327328369e8a01b255b270c6b8e1 /lisplib.c | |
parent | acfd125f2351a294f8872da5736169ea3c51786b (diff) | |
download | txr-c39c6e6b72c750180dd13c38db8c69a609dbf574.tar.gz txr-c39c6e6b72c750180dd13c38db8c69a609dbf574.tar.bz2 txr-c39c6e6b72c750180dd13c38db8c69a609dbf574.zip |
Add obtain/yield macros interface to continuations.
* lisplib.c (yield_set_entries, yield_instantiate):
New static functions.
(dlt_register): Registered new functions.
* share/txr/stdlib/yield.tl: New file.
* txr.1: Documented obtain, yield-from, obtain-block
and yield.
Diffstat (limited to 'lisplib.c')
-rw-r--r-- | lisplib.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -256,7 +256,22 @@ static val type_instantiate(val set_fun) return nil; } +static val yield_set_entries(val dlt, val fun) +{ + val name[] = { + lit("obtain"), lit("obtain-block"), lit("yield-from"), lit("yield"), + nil + }; + set_dlt_entries(dlt, name, fun); + return nil; +} +static val yield_instantiate(val set_fun) +{ + funcall1(set_fun, nil); + load(format(nil, lit("~a/yield.tl"), stdlib_path, nao)); + return nil; +} val dlt_register(val dlt, val (*instantiate)(val), @@ -280,6 +295,7 @@ void lisplib_init(void) dlt_register(dl_table, hash_instantiate, hash_set_entries); dlt_register(dl_table, except_instantiate, except_set_entries); dlt_register(dl_table, type_instantiate, type_set_entries); + dlt_register(dl_table, yield_instantiate, yield_set_entries); } val lisplib_try_load(val sym) |