summaryrefslogtreecommitdiffstats
path: root/lisplib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-09-07 19:50:59 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-09-07 19:50:59 -0700
commitb8ee64789e18cbfe5e1dc7e64e0c9160e9c265b7 (patch)
tree1eb6626a69914732686d88fd767c0db199a691fc /lisplib.c
parentafdedf2289b5462b76d8a48e6c2d6f7c653f664d (diff)
downloadtxr-b8ee64789e18cbfe5e1dc7e64e0c9160e9c265b7.tar.gz
txr-b8ee64789e18cbfe5e1dc7e64e0c9160e9c265b7.tar.bz2
txr-b8ee64789e18cbfe5e1dc7e64e0c9160e9c265b7.zip
Awk comes to TXR via a macro.
* lisplib.c (awk_set_entries, awk_instantiate): New static functions. (lisplib_init): Register auto-loading for awk module via new functions. * share/txr/stdlib/awk.tl: New file.
Diffstat (limited to 'lisplib.c')
-rw-r--r--lisplib.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lisplib.c b/lisplib.c
index b9b58f45..bc664683 100644
--- a/lisplib.c
+++ b/lisplib.c
@@ -336,6 +336,23 @@ static val termios_instantiate(val set_fun)
#endif
+static val awk_set_entries(val dlt, val fun)
+{
+ val name[] = {
+ lit("awk"), nil
+ };
+ set_dlt_entries(dlt, name, fun);
+ return nil;
+}
+
+static val awk_instantiate(val set_fun)
+{
+ funcall1(set_fun, nil);
+ load(format(nil, lit("~aawk.tl"), stdlib_path, nao));
+ sock_load_init();
+ return nil;
+}
+
val dlt_register(val dlt,
val (*instantiate)(val),
val (*set_entries)(val, val))
@@ -365,6 +382,7 @@ void lisplib_init(void)
#if HAVE_TERMIOS
dlt_register(dl_table, termios_instantiate, termios_set_entries);
#endif
+ dlt_register(dl_table, awk_instantiate, awk_set_entries);
}
val lisplib_try_load(val sym)