1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 13:00:26 +02:00

* modules.c (the_root_module): Moved before scm_current_module.

(scm_current_module): Return the root module if `the-module' fluid
gives #f.

* standalone/Makefile.am: Add stanza for test-with-guile-module.

* standalone/test-with-guile-module.c: New test.
This commit is contained in:
Neil Jerram 2008-02-01 22:47:53 +00:00
parent 6ba395189f
commit a06872c2bc
7 changed files with 86 additions and 12 deletions

View file

@ -40,12 +40,25 @@ scm_t_bits scm_module_tag;
static SCM the_module;
static SCM the_root_module_var;
static SCM
the_root_module ()
{
if (scm_module_system_booted_p)
return SCM_VARIABLE_REF (the_root_module_var);
else
return SCM_BOOL_F;
}
SCM_DEFINE (scm_current_module, "current-module", 0, 0, 0,
(),
"Return the current module.")
#define FUNC_NAME s_scm_current_module
{
return scm_fluid_ref (the_module);
SCM curr = scm_fluid_ref (the_module);
return scm_is_true (curr) ? curr : the_root_module ();
}
#undef FUNC_NAME
@ -234,17 +247,6 @@ scm_env_top_level (SCM env)
SCM_SYMBOL (sym_module, "module");
static SCM the_root_module_var;
static SCM
the_root_module ()
{
if (scm_module_system_booted_p)
return SCM_VARIABLE_REF (the_root_module_var);
else
return SCM_BOOL_F;
}
SCM
scm_lookup_closure_module (SCM proc)
{