summaryrefslogtreecommitdiff
path: root/libguile/modules.c
diff options
context:
space:
mode:
authorMikael Djurfeldt <djurfeldt@nada.kth.se>2003-03-11 15:58:02 +0000
committerMikael Djurfeldt <djurfeldt@nada.kth.se>2003-03-11 15:58:02 +0000
commit109c2c9f29c206ee05e68fb3a08093dc7767f275 (patch)
tree9b84957653fcc615e20038e254d82bb7540f0de2 /libguile/modules.c
parentf8af5c6d355b2c05e0aff4bcb2f1651b6f5c7824 (diff)
downloadguile-109c2c9f29c206ee05e68fb3a08093dc7767f275.tar.gz
* modules.c (scm_module_import_interface): New function.
* boot-9.scm (process-duplicates): Use module-import-interface. (module-symbol-interface): Removed.
Diffstat (limited to 'libguile/modules.c')
-rw-r--r--libguile/modules.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/libguile/modules.c b/libguile/modules.c
index a0031af9c..46b9e7f88 100644
--- a/libguile/modules.c
+++ b/libguile/modules.c
@@ -413,6 +413,42 @@ scm_current_module_transformer ()
return SCM_BOOL_F;
}
+SCM_DEFINE (scm_module_import_interface, "module-import-interface", 2, 0, 0,
+ (SCM module, SCM sym),
+ "")
+#define FUNC_NAME s_scm_module_import_interface
+{
+#define SCM_BOUND_THING_P(b) (!SCM_FALSEP (b))
+ SCM_VALIDATE_MODULE (SCM_ARG1, module);
+ /* Search the use list */
+ SCM uses = SCM_MODULE_USES (module);
+ while (SCM_CONSP (uses))
+ {
+ SCM interface = SCM_CAR (uses);
+ /* 1. Check module obarray */
+ SCM b = scm_hashq_ref (SCM_MODULE_OBARRAY (interface), sym, SCM_BOOL_F);
+ if (SCM_BOUND_THING_P (b))
+ return interface;
+ {
+ SCM binder = SCM_MODULE_BINDER (interface);
+ if (!SCM_FALSEP (binder))
+ /* 2. Custom binder */
+ {
+ b = scm_call_3 (binder, interface, sym, SCM_BOOL_F);
+ if (SCM_BOUND_THING_P (b))
+ return interface;
+ }
+ }
+ /* 3. Search use list recursively. */
+ interface = scm_module_import_interface (interface, sym);
+ if (!SCM_FALSEP (interface))
+ return interface;
+ uses = SCM_CDR (uses);
+ }
+ return SCM_BOOL_F;
+}
+#undef FUNC_NAME
+
/* scm_sym2var
*
* looks up the variable bound to SYM according to PROC. PROC should be