diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-02-07 22:34:35 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-02-07 22:34:35 -0800 |
commit | f97f2187e2dd72eec034f6a9b7f93e4174a4c24b (patch) | |
tree | f4be3f81e3cec33887c8186843618cc434e67581 | |
parent | 5e7b57f4bff740ca42ad49e7ee4e58404a816329 (diff) | |
download | txr-f97f2187e2dd72eec034f6a9b7f93e4174a4c24b.tar.gz txr-f97f2187e2dd72eec034f6a9b7f93e4174a4c24b.tar.bz2 txr-f97f2187e2dd72eec034f6a9b7f93e4174a4c24b.zip |
bugfix: intern public symbols in autoload files.
This commit addresses a bug of the following type:
(defpackage p (:fallback usr))
(in-package p)
(let ((lb (new list-builder)))
lb.(add 1)) ;; problem: this add is p:add
the add symbol is not on the auto-load list; it occurs
as a slot of the list-builder class, but is not interned
when TXR starts. Thus the (:fallback usr) doesn't pick it up.
Expected behavior is that add is usr:add.
* lisplib.c (intern_only): New static function.
(sock_set_entries, build_set_entries, getopts_set_entries,
stream_wrap_set_entries): Define additional lists of
supplemenary symbols which are passed to intern_only
just to be interned in the usr package without autoload
registratiions. These symbols are all slots documented for
public use in various structures defined by the respective
modules managed by these autoload functions.
-rw-r--r-- | lisplib.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -58,6 +58,12 @@ void set_dlt_entries(val dlt, val *name, val fun) } } +static void intern_only(val *name) +{ + for (; *name; name++) + intern(*name, user_package); +} + static val place_set_entries(val dlt, val fun) { val name[] = { @@ -313,7 +319,13 @@ static val sock_set_entries(val dlt, val fun) lit("open-socket-pair"), lit("sock-send-timeout"), lit("sock-recv-timeout"), nil }; + val name_noload[] = { + lit("family"), lit("addr"), lit("port"), lit("flow-info"), + lit("scope-id"), lit("path"), lit("flags"), lit("socktype"), + lit("protocol"), lit("canonname"), nil + }; set_dlt_entries(dlt, name, fun); + intern_only(name_noload); return nil; } @@ -373,7 +385,13 @@ static val build_set_entries(val dlt, val fun) val name[] = { lit("list-builder"), lit("build-list"), lit("build"), nil }; + val name_noload[] = { + lit("head"), lit("tail"), lit("add"), lit("add*"), lit("pend"), + lit("pend*"), lit("ncon"), lit("ncon*"), lit("get"), nil + }; + set_dlt_entries(dlt, name, fun); + intern_only(name_noload); return nil; } @@ -409,7 +427,12 @@ static val getopts_set_entries(val dlt, val fun) lit("opt"), lit("getopts"), lit("opthelp"), nil }; + val name_noload[] = { + lit("short"), lit("long"), lit("helptext"), lit("type"), + lit("in-args"), lit("out-args"), nil + }; set_dlt_entries(dlt, name, fun); + intern_only(name_noload); return nil; } @@ -571,7 +594,13 @@ static val stream_wrap_set_entries(val dlt, val fun) lit("stream-wrap"), nil }; + val name_noload[] = { + lit("close"), lit("flush"), lit("seek"), lit("truncate"), + lit("get-prop"), lit("set-prop"), lit("get-fd"), nil + }; + set_dlt_entries(dlt, name, fun); + intern_only(name_noload); return nil; } |