summaryrefslogtreecommitdiffstats
path: root/lisplib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-09-20 06:31:41 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-09-20 06:31:41 -0700
commit9bf70a553426b49ae0a2967207472bcd35b2754c (patch)
tree82feb69595a0aff616992b8712287c284ef19157 /lisplib.c
parent8b3c5afed5d60c2e12deffcf463448c26c79c953 (diff)
downloadtxr-9bf70a553426b49ae0a2967207472bcd35b2754c.tar.gz
txr-9bf70a553426b49ae0a2967207472bcd35b2754c.tar.bz2
txr-9bf70a553426b49ae0a2967207472bcd35b2754c.zip
New library feature: imperative list building.
* lisplib.c (build_set_entries, build_instantiate): New static functions. (dlt_register): Register dynamic loading of build.tl via the two new functions. * share/txr/stdlib/build.tl: New file. * txr.1: Documented everything.
Diffstat (limited to 'lisplib.c')
-rw-r--r--lisplib.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lisplib.c b/lisplib.c
index e74c925e..b33cd593 100644
--- a/lisplib.c
+++ b/lisplib.c
@@ -353,6 +353,24 @@ static val awk_instantiate(val set_fun)
return nil;
}
+static val build_set_entries(val dlt, val fun)
+{
+ val name[] = {
+ lit("list-builder"), lit("build-list"), lit("build"), nil
+ };
+ set_dlt_entries(dlt, name, fun);
+ return nil;
+}
+
+static val build_instantiate(val set_fun)
+{
+ funcall1(set_fun, nil);
+ load(format(nil, lit("~abuild.tl"), stdlib_path, nao));
+ sock_load_init();
+ return nil;
+}
+
+
val dlt_register(val dlt,
val (*instantiate)(val),
val (*set_entries)(val, val))
@@ -383,6 +401,7 @@ void lisplib_init(void)
dlt_register(dl_table, termios_instantiate, termios_set_entries);
#endif
dlt_register(dl_table, awk_instantiate, awk_set_entries);
+ dlt_register(dl_table, build_instantiate, build_set_entries);
}
val lisplib_try_load(val sym)