}
#undef FUNC_NAME
+SCM
+scm_lookup_closure_module (SCM proc)
+{
+ scm_c_issue_deprecation_warning
+ ("Eval closures are deprecated. See \"Accessing Modules From C\" in\n"
+ "the manual, for replacements.");
+
+ if (scm_is_false (proc))
+ return scm_the_root_module ();
+ else if (SCM_EVAL_CLOSURE_P (proc))
+ return SCM_PACK (SCM_SMOB_DATA (proc));
+ else
+ /* FIXME: The `module' property is no longer set on eval closures, as it
+ introduced a circular reference that precludes garbage collection of
+ modules with the current weak hash table semantics (see
+ http://lists.gnu.org/archive/html/guile-devel/2009-01/msg00102.html and
+ http://thread.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/2465
+ for details). Since it doesn't appear to be used (only in this
+ function, which has 1 caller), we no longer extend
+ `set-module-eval-closure!' to set the `module' property. */
+ abort ();
+}
+
+SCM
+scm_module_lookup_closure (SCM module)
+{
+ scm_c_issue_deprecation_warning
+ ("Eval closures are deprecated. See \"Accessing Modules From C\" in\n"
+ "the manual, for replacements.");
+
+ if (scm_is_false (module))
+ return SCM_BOOL_F;
+ else
+ return SCM_MODULE_EVAL_CLOSURE (module);
+}
+
+SCM
+scm_current_module_lookup_closure ()
+{
+ scm_c_issue_deprecation_warning
+ ("Eval closures are deprecated. See \"Accessing Modules From C\" in\n"
+ "the manual, for replacements.");
+
+ if (scm_module_system_booted_p)
+ return scm_module_lookup_closure (scm_current_module ());
+ else
+ return SCM_BOOL_F;
+}
+
\f
\f
+/* Eval closure deprecation, 23-05-2012. */
+#define SCM_TOP_LEVEL_LOOKUP_CLOSURE (scm_current_module_lookup_closure())
+
+SCM_DEPRECATED SCM scm_lookup_closure_module (SCM proc);
+SCM_DEPRECATED SCM scm_module_lookup_closure (SCM module);
+SCM_DEPRECATED SCM scm_current_module_lookup_closure (void);
+
+
+\f
+
void scm_i_init_deprecated (void);
#endif
#ifndef SCM_EVAL_H
#define SCM_EVAL_H
-/* Copyright (C) 1995,1996,1998,1999,2000,2001,2002,2003,2004,2008,2009,2010,2011
+/* Copyright (C) 1995,1996,1998,1999,2000,2001,2002,2003,2004,2008,2009,2010,2011,2012
* Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
#define SCM_EXTEND_ENV scm_acons
-/*fixme* This should probably be removed throught the code. */
-
-#define SCM_TOP_LEVEL_LOOKUP_CLOSURE (scm_current_module_lookup_closure())
-
\f
SCM_API SCM scm_call_0 (SCM proc);
-/* Copyright (C) 1998,1999,2000,2001,2002,2003,2004,2008,2009,2010,2011
+/* Copyright (C) 1998,1999,2000,2001,2002,2003,2004,2008,2009,2010,2011,2012
* Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
SCM
scm_ensure_accessor (SCM name)
{
- SCM gf = scm_call_2 (SCM_TOP_LEVEL_LOOKUP_CLOSURE, name, SCM_BOOL_F);
+ SCM var, gf;
+
+ var = scm_module_variable (scm_current_module (), name);
+ if (SCM_VARIABLEP (var) && !SCM_UNBNDP (SCM_VARIABLE_REF (var)))
+ gf = SCM_VARIABLE_REF (var);
+ else
+ gf = SCM_BOOL_F;
+
if (!SCM_IS_A_P (gf, scm_class_accessor))
{
gf = scm_make (scm_list_3 (scm_class_generic, k_name, name));
gf = scm_make (scm_list_5 (scm_class_accessor,
k_name, name, k_setter, gf));
}
+
return gf;
}
}
-/* Environments */
-
-SCM_SYMBOL (sym_module, "module");
-
-SCM
-scm_lookup_closure_module (SCM proc)
-{
- if (scm_is_false (proc))
- return scm_the_root_module ();
- else if (SCM_EVAL_CLOSURE_P (proc))
- return SCM_PACK (SCM_SMOB_DATA (proc));
- else
- {
- SCM mod;
-
- /* FIXME: The `module' property is no longer set on eval closures, as it
- introduced a circular reference that precludes garbage collection of
- modules with the current weak hash table semantics (see
- http://lists.gnu.org/archive/html/guile-devel/2009-01/msg00102.html and
- http://thread.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/2465
- for details). Since it doesn't appear to be used (only in this
- function, which has 1 caller), we no longer extend
- `set-module-eval-closure!' to set the `module' property. */
- abort ();
-
- mod = scm_procedure_property (proc, sym_module);
- if (scm_is_false (mod))
- mod = scm_the_root_module ();
- return mod;
- }
-}
-
/*
* C level implementation of the standard eval closure
*
}
#undef FUNC_NAME
-SCM
-scm_module_lookup_closure (SCM module)
-{
- if (scm_is_false (module))
- return SCM_BOOL_F;
- else
- return SCM_MODULE_EVAL_CLOSURE (module);
-}
-
-SCM
-scm_current_module_lookup_closure ()
-{
- if (scm_module_system_booted_p)
- return scm_module_lookup_closure (scm_current_module ());
- else
- return SCM_BOOL_F;
-}
-
SCM_SYMBOL (sym_macroexpand, "macroexpand");
SCM_DEFINE (scm_module_transformer, "module-transformer", 1, 0, 0,
SCM_API SCM scm_module_public_interface (SCM module);
SCM_API SCM scm_module_import_interface (SCM module, SCM sym);
-SCM_API SCM scm_module_lookup_closure (SCM module);
SCM_API SCM scm_module_transformer (SCM module);
-SCM_API SCM scm_current_module_lookup_closure (void);
SCM_API SCM scm_current_module_transformer (void);
SCM_API SCM scm_eval_closure_lookup (SCM eclo, SCM sym, SCM definep);
SCM_API SCM scm_standard_eval_closure (SCM module);
SCM_API SCM scm_standard_interface_eval_closure (SCM module);
SCM_API SCM scm_eval_closure_module (SCM eval_closure); /* deprecated already */
SCM_API SCM scm_get_pre_modules_obarray (void);
-SCM_API SCM scm_lookup_closure_module (SCM proc);
SCM_INTERNAL void scm_modules_prehistory (void);
SCM_INTERNAL void scm_init_modules (void);