summaryrefslogtreecommitdiffstats
path: root/cadr.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-02-18 21:34:44 -0800
committerKaz Kylheku <kaz@kylheku.com>2022-02-18 21:34:44 -0800
commit3cf469537b318388a3dde41d47d5a2c2d9fe0e70 (patch)
tree8d34e1438a8b94833ba97a7967c631bfd47861e0 /cadr.c
parentf6b8a4a199c9ba358e3571ae9486dd6e3b93e5b2 (diff)
downloadtxr-3cf469537b318388a3dde41d47d5a2c2d9fe0e70.tar.gz
txr-3cf469537b318388a3dde41d47d5a2c2d9fe0e70.tar.bz2
txr-3cf469537b318388a3dde41d47d5a2c2d9fe0e70.zip
lisplib: split autoload entries into namespaces.
Autoloads are now keyed to spearate namespaces for functions/macros, variables, structures, slots and a keyword namespace for autoloading miscellaneous things tied to keywords like parameter macros. There is some renaming going on as part of this. The "dlt" acronym is replaced by "autload". Some functions in lisplib.c were in an inconsistent order, and were reordered. Motivation: the one namespace autoload causes hidden problems in the standard library, due to inappropriate loads. This shows up particularly when then uncompiled library is used. Tests no longer execute as they should. Story time: when struct.tl is autloaded, it loads param.tl for parameter parsing, param.tl defines a structure that has an opt slot, and accesses it with an expression like me.opt. When this expression is expanded, the qref macro checks whether opt is a valid slot, and for that, autoload is triggered. But, oops, opt is a function in getopts.tl, Thus param.tl autoloads getopt.tl. Paul A. Patience recently introduced changes into getopt.tl that make use of pattern matching. So getopt.tl auto-loads match.tl. But match.tl uses structures. But, oops, that material is defined in struct.tl, which is in progress of being auto-loaded. Thus, a false circular dependency exists, caused by a check of the opt slot triggering the loading of the irrelevant getopts.tl module. These irrelevant loads will also slow down the compiling of the library also, as well as test cases when the library is not compiled: especially tests run under the GC torture test. * lisplib.c (dl_table): Global variable removed. (autoload_hash): New static array. (set_dlt_entries_impl): Renamed to autoload_set_impl. (autoload_set_impl): Takes al_ns_t namespace enum argument. Operates on the hash table indicated by that argument. (set_dlt_entries): Renamed to autoload_set. (set_dlt_entries_sys): Renamed to autoload_sys_set. (autoload_key_set): New static function. (place_set_entries, ver_set_entries, ifa_set_entries, txr_case_set_entries, with_resources_set_entries, path_test_set_entries, struct_set_entries, with_stream_set_entries, hash_set_entries, except_set_entries, type_set_entries, yield_set_entries, sock_set_entries, termios_set_entries, awk_set_entries, build_set_entries, trace_set_entries, getopts_set_entries, package_set_entries, getput_set_entries, tagbody_set_entries, pmac_set_entries, error_set_entries, keyparams_set_entries, ffi_set_entries, doloop_set_entries, stream_wrap_set_entries, asm_set_entries, compiler_set_entries, debugger_set_entries, op_set_entries, save_exe_set_entries, defset_set_entries, copy_file_set_entries, arith_each_set_entries, each_prod_set_entries, quips_set_entries, match_set_entries, doc_set_entries, pic_set_entries, constfun_set_entries): Separate name arrays into multipel namespaces as appropriate and register using approprate namespace enums. (dlt_register): Renamed to autoload_reg. (autoload_reg): dlt parameter removed. (lisplib_try_load): Take namespace enum argument, and check against the corresponding hash. (lisplib_try_load_fun, lisplib_try_load_var, lisplib_try_load_slot, lisblib_try_load_struct, lisplib_try_load_keyword): Pass appropriate enum value to lisplib_try_load to request the right namespace. (lisplib_try_load_fun_var): Call lisplib_try_load_fun, and if that does nothing, lisplib_try_load_var. (lisplib_init_tables): New function. (lisplib_init): References to dl_table removed. Call to dlt_register replaced with autoload_reg. * lisplib.h (dl_table): Declaration removed. (enum autoload_ns, al_ns_t): New enum. (set_dlt_entries, dlt_register): Declarations removed. (autoload_set, autoload_reg): Declared. * gencadr.txr (cadr_set_entries): Drop dlt parameter, call autoload_set instead of set_dlt_entries. (cadr_init): Call autoload_reg instead of dlt_register. * cadr.c: regenerated.
Diffstat (limited to 'cadr.c')
-rw-r--r--cadr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/cadr.c b/cadr.c
index 8eff2bfd..d0c7765a 100644
--- a/cadr.c
+++ b/cadr.c
@@ -407,7 +407,7 @@ static val cadr_register(val set_fun)
return nil;
}
-static val cadr_set_entries(val dlt, val fun)
+static val cadr_set_entries(val fun)
{
val name[] = {
lit("caar"),
@@ -473,11 +473,11 @@ static val cadr_set_entries(val dlt, val fun)
nil
};
- set_dlt_entries(dlt, name, fun);
+ autoload_set(al_fun, name, fun);
return nil;
}
void cadr_init(void)
{
- dlt_register(dl_table, cadr_register, cadr_set_entries);
+ autoload_reg(cadr_register, cadr_set_entries);
}