diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-02-19 08:52:59 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-02-19 08:52:59 -0800 |
commit | df01f5a994146401df17aea575d011e0a806d515 (patch) | |
tree | edd6620d7e47e331a71e4630a55b49e9e55c50b6 | |
parent | 269b97fb52fd397590583646e91c456830305cf7 (diff) | |
download | txr-df01f5a994146401df17aea575d011e0a806d515.tar.gz txr-df01f5a994146401df17aea575d011e0a806d515.tar.bz2 txr-df01f5a994146401df17aea575d011e0a806d515.zip |
autoload: move termios material into termios module.
* autoload.c (termios_set_entries, termios_instantiate):
Static functions removed from here.
(autoload_init): autoload_reg call for above functions removed
from here.
* termios.c (termios_set_entries, termios_instantiate): Static
functions moved here.
(termios_init): autoload_reg call moved here.
-rw-r--r-- | autoload.c | 25 | ||||
-rw-r--r-- | termios.c | 22 |
2 files changed, 22 insertions, 25 deletions
@@ -394,28 +394,6 @@ static val sock_instantiate(void) #endif -#if HAVE_TERMIOS - -static val termios_set_entries(val fun) -{ - val slname[] = { - 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 - }; - autoload_set(al_slot, slname, fun); - return nil; -} - -static val termios_instantiate(void) -{ - load(scat2(stdlib_path, lit("termios"))); - return nil; -} - -#endif - static val awk_set_entries(val fun) { val sys_sname[] = { @@ -1027,9 +1005,6 @@ void autoload_init(void) #if HAVE_SOCKETS autoload_reg(sock_instantiate, sock_set_entries); #endif -#if HAVE_TERMIOS - autoload_reg(termios_instantiate, termios_set_entries); -#endif autoload_reg(awk_instantiate, awk_set_entries); autoload_reg(build_instantiate, build_set_entries); autoload_reg(trace_instantiate, trace_set_entries); @@ -46,6 +46,8 @@ #include "stream.h" #include "struct.h" #include "sysif.h" +#include "txr.h" +#include "autoload.h" #include "termios.h" val termios_s, iflag_s, oflag_s, cflag_s, lflag_s, cc_s, ispeed_s, ospeed_s; @@ -371,6 +373,24 @@ static val decode_speeds(val termios) return termios; } +static val termios_set_entries(val fun) +{ + val slname[] = { + 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 + }; + autoload_set(al_slot, slname, fun); + return nil; +} + +static val termios_instantiate(void) +{ + load(scat2(stdlib_path, lit("termios"))); + return nil; +} + void termios_init(void) { val termios_t; @@ -583,4 +603,6 @@ void termios_init(void) reg_varl(intern(lit("tcsanow"), user_package), num_fast(TCSANOW)); reg_varl(intern(lit("tcsadrain"), user_package), num_fast(TCSADRAIN)); reg_varl(intern(lit("tcsaflush"), user_package), num_fast(TCSAFLUSH)); + + autoload_reg(termios_instantiate, termios_set_entries); } |