summaryrefslogtreecommitdiffstats
path: root/autoload.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-02-19 09:03:41 -0800
committerKaz Kylheku <kaz@kylheku.com>2022-02-19 09:03:41 -0800
commitf20db9ab6cacd73f4276c6541d3009e731811a7e (patch)
tree0c6217de89a535784f7001803d84893a1440af4a /autoload.c
parentcaf46a07285ce2b214fdfce1b2af3375966c52f9 (diff)
downloadtxr-f20db9ab6cacd73f4276c6541d3009e731811a7e.tar.gz
txr-f20db9ab6cacd73f4276c6541d3009e731811a7e.tar.bz2
txr-f20db9ab6cacd73f4276c6541d3009e731811a7e.zip
autoload: move socket material into socket module.
* autoload.c (sock_set_entries, sock_instantiate): Functions removed from here. (autoload_init): autoload_reg call for above functions removed from here. (autoload_intern): New function, wrapper for intern_only. sock_set_entries uses intern_only which is static, so we need to expose this. * autoload.h (autoload_intern): Declared. * socket.c (sock_set_entries, sock_instantiate): Functions moved here. intern_only call replaced with autoload_intern. (sock_load_init): Function removed: body moved into sock_instantiate, which no longer calls sock_load_init.
Diffstat (limited to 'autoload.c')
-rw-r--r--autoload.c72
1 files changed, 5 insertions, 67 deletions
diff --git a/autoload.c b/autoload.c
index 33029170..bfe53a51 100644
--- a/autoload.c
+++ b/autoload.c
@@ -38,7 +38,6 @@
#include "gc.h"
#include "debug.h"
#include "txr.h"
-#include "socket.h"
#include "autoload.h"
int opt_dbg_autoload;
@@ -331,69 +330,6 @@ static val yield_instantiate(void)
return nil;
}
-#if HAVE_SOCKETS
-static val sock_set_entries(val fun)
-{
- val sname[] = {
- lit("sockaddr"), lit("sockaddr-in"), lit("sockaddr-in6"),
- lit("sockaddr-un"), lit("addrinfo"),
- nil
- };
- val vname[] = {
- lit("af-unspec"), lit("af-unix"), lit("af-inet"), lit("af-inet6"),
- lit("sock-stream"), lit("sock-dgram"),
- lit("inaddr-any"), lit("inaddr-loopback"),
- lit("in6addr-any"), lit("in6addr-loopback"),
- lit("sock-nonblock"), lit("sock-cloexec"),
- lit("ai-passive"), lit("ai-canonname"), lit("ai-numerichost"),
- lit("ai-v4mapped"), lit("ai-all"), lit("ai-addrconfig"),
- lit("ai-numericserv"), lit("sol-socket"), lit("ipproto-ip"),
- lit("ipproto-ipv6"), lit("ipproto-tcp"), lit("ipproto-udp"),
- lit("so-acceptconn"), lit("so-broadcast"), lit("so-debug"),
- lit("so-dontroute"), lit("so-error"), lit("so-keepalive"),
- lit("so-linger"), lit("so-oobinline"), lit("so-rcvbuf"),
- lit("so-rcvlowat"), lit("so-rcvtimeo"), lit("so-reuseaddr"),
- lit("so-sndbuf"), lit("so-sndlowat"), lit("so-sndtimeo"),
- lit("so-type"), lit("ipv6-join-group"), lit("ipv6-leave-group"),
- lit("ipv6-multicast-hops"), lit("ipv6-multicast-if"),
- lit("ipv6-multicast-loop"), lit("ipv6-unicast-hops"),
- lit("ipv6-v6only"), lit("tcp-nodelay"),
- nil
- };
- val name[] = {
- lit("getaddrinfo"),
- lit("str-inaddr"), lit("str-in6addr"),
- lit("str-inaddr-net"), lit("str-in6addr-net"),
- lit("inaddr-str"), lit("in6addr-str"),
- lit("shut-rd"), lit("shut-wr"), lit("shut-rdwr"),
- lit("open-socket"), lit("open-socket-pair"),
- lit("sock-bind"), lit("sock-connect"), lit("sock-listen"),
- lit("sock-accept"), lit("sock-shutdown"), lit("open-socket"),
- lit("open-socket-pair"), lit("sock-send-timeout"), lit("sock-recv-timeout"),
- lit("sock-opt"), lit("sock-set-opt"),
- nil
- };
- val name_noload[] = {
- lit("family"), lit("addr"), lit("port"), lit("flow-info"),
- lit("scope-id"), lit("prefix"), lit("path"), lit("flags"), lit("socktype"),
- lit("protocol"), lit("canonname"), nil
- };
- autoload_set(al_struct, sname, fun);
- autoload_set(al_var, vname, fun);
- autoload_set(al_fun, name, fun);
- intern_only(name_noload);
- return nil;
-}
-
-static val sock_instantiate(void)
-{
- sock_load_init();
- load(scat2(stdlib_path, lit("socket")));
- return nil;
-}
-
-#endif
-
static val awk_set_entries(val fun)
{
val sys_sname[] = {
@@ -1002,9 +938,6 @@ void autoload_init(void)
autoload_reg(except_instantiate, except_set_entries);
autoload_reg(type_instantiate, type_set_entries);
autoload_reg(yield_instantiate, yield_set_entries);
-#if HAVE_SOCKETS
- autoload_reg(sock_instantiate, sock_set_entries);
-#endif
autoload_reg(awk_instantiate, awk_set_entries);
autoload_reg(build_instantiate, build_set_entries);
autoload_reg(trace_instantiate, trace_set_entries);
@@ -1093,3 +1026,8 @@ val autoload_try_keyword(val sym)
{
return autoload_try(al_key, sym);
}
+
+void autoload_intern(val *namearray)
+{
+ intern_only(namearray);
+}