Merge branch 'master' into boehm-demers-weiser-gc
[bpt/guile.git] / libguile / modules.c
index ea7305c..04527a5 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998,2000,2001,2002,2003,2004,2006,2007 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000,2001,2002,2003,2004,2006,2007,2008 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -17,6 +17,9 @@
 
 
 \f
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
 
 #include <stdarg.h>
 
@@ -252,7 +255,13 @@ scm_lookup_closure_module (SCM proc)
     return SCM_PACK (SCM_SMOB_DATA (proc));
   else
     {
-      SCM mod = scm_procedure_property (proc, sym_module);
+      SCM mod;
+
+      /* FIXME: The `module' property is no longer set.  See
+        `set-module-eval-closure!' in `boot-9.scm'.  */
+      abort ();
+
+      mod = scm_procedure_property (proc, sym_module);
       if (scm_is_false (mod))
        mod = the_root_module ();
       return mod;
@@ -774,8 +783,18 @@ SCM_DEFINE (scm_module_reverse_lookup, "module-reverse-lookup", 2, 0, 0,
       while (!scm_is_null (ls))
        {
          handle = SCM_CAR (ls);
-         if (SCM_CDR (handle) == variable)
-           return SCM_CAR (handle);
+
+         if (SCM_CAR (handle) == SCM_PACK (NULL))
+           {
+             /* FIXME: We hit a weak pair whose car has become unreachable.
+                We should remove the pair in question or something.  */
+           }
+         else
+           {
+             if (SCM_CDR (handle) == variable)
+               return SCM_CAR (handle);
+           }
+
          ls = SCM_CDR (ls);
        }
     }
@@ -835,7 +854,6 @@ scm_init_modules ()
   module_make_local_var_x_var = scm_c_define ("module-make-local-var!",
                                            SCM_UNDEFINED);
   scm_tc16_eval_closure = scm_make_smob_type ("eval-closure", 0);
-  scm_set_smob_mark (scm_tc16_eval_closure, scm_markcdr);
   scm_set_smob_apply (scm_tc16_eval_closure, scm_eval_closure_lookup, 2, 0, 0);
 
   the_module = scm_permanent_object (scm_make_fluid ());