diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-09-07 19:50:59 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-09-07 19:50:59 -0700 |
commit | b8ee64789e18cbfe5e1dc7e64e0c9160e9c265b7 (patch) | |
tree | 1eb6626a69914732686d88fd767c0db199a691fc /lisplib.c | |
parent | afdedf2289b5462b76d8a48e6c2d6f7c653f664d (diff) | |
download | txr-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.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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) |