summaryrefslogtreecommitdiffstats
path: root/lisplib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-10-28 06:08:23 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-10-28 06:08:23 -0700
commitc39c6e6b72c750180dd13c38db8c69a609dbf574 (patch)
tree31006331bd5a327328369e8a01b255b270c6b8e1 /lisplib.c
parentacfd125f2351a294f8872da5736169ea3c51786b (diff)
downloadtxr-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.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lisplib.c b/lisplib.c
index 09e0386f..d4d71724 100644
--- a/lisplib.c
+++ b/lisplib.c
@@ -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)