From 6ca427f995a76ed9c5bae2ab86f864ea5ae4d376 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 18 May 2016 06:18:54 -0700 Subject: 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. --- lisplib.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'lisplib.c') 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) -- cgit v1.2.3