summaryrefslogtreecommitdiffstats
path: root/lisplib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-05-18 06:18:54 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-05-18 06:18:54 -0700
commit6ca427f995a76ed9c5bae2ab86f864ea5ae4d376 (patch)
tree144ba53e9636aec6418c37225a74359bc20ac626 /lisplib.c
parentd2bc824b4f91f6aa462e27f8b5dde6dee1cc031f (diff)
downloadtxr-6ca427f995a76ed9c5bae2ab86f864ea5ae4d376.tar.gz
txr-6ca427f995a76ed9c5bae2ab86f864ea5ae4d376.tar.bz2
txr-6ca427f995a76ed9c5bae2ab86f864ea5ae4d376.zip
Adding termios support.
* Makefile (termios.o): New object file. * lib.c (init): Call termios_init. * lisplib.c (termios_set_entries, termios_instantiate): New functions. (lisplib_init): Register new functions in autoload table. * share/txr/stdlib/termios.tl: New file. * termios.c, termios.h: New files. * txr.1: Documented termios.
Diffstat (limited to 'lisplib.c')
-rw-r--r--lisplib.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/lisplib.c b/lisplib.c
index f98ddf1a..1c65cd92 100644
--- a/lisplib.c
+++ b/lisplib.c
@@ -281,7 +281,6 @@ static val yield_instantiate(val set_fun)
}
#if HAVE_SOCKETS
-
static val sock_set_entries(val dlt, val fun)
{
val name[] = {
@@ -313,6 +312,30 @@ static val sock_instantiate(val set_fun)
#endif
+#if HAVE_TERMIOS
+
+static val termios_set_entries(val dlt, val fun)
+{
+ val name[] = {
+ lit("set-iflags"), lit("set-oflags"), lit("set-cflags"), lit("set-lflags"),
+ lit("clear-iflags"), lit("clear-oflags"), lit("clear-cflags"), lit("clear-lflags"),
+ lit("go-raw"), lit("go-cbreak"), lit("go-canon"),
+ lit("string-encode"), lit("string-decode"), nil
+ };
+ set_dlt_entries(dlt, name, fun);
+ return nil;
+}
+
+static val termios_instantiate(val set_fun)
+{
+ funcall1(set_fun, nil);
+ load(format(nil, lit("~a/termios.tl"), stdlib_path, nao));
+ sock_load_init();
+ return nil;
+}
+
+#endif
+
val dlt_register(val dlt,
val (*instantiate)(val),
val (*set_entries)(val, val))
@@ -339,6 +362,9 @@ void lisplib_init(void)
#if HAVE_SOCKETS
dlt_register(dl_table, sock_instantiate, sock_set_entries);
#endif
+#if HAVE_TERMIOS
+ dlt_register(dl_table, termios_instantiate, termios_set_entries);
+#endif
}
val lisplib_try_load(val sym)