diff options
author | Ludovic Courtès <ludo@gnu.org> | 2008-09-10 23:09:30 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2008-09-10 23:09:30 +0200 |
commit | 6f03035fe80d1c25ffadc42ec59c473402f65f60 (patch) | |
tree | a552a077bafe408ced8737674aecdf3007f31679 /libguile/modules.c | |
parent | 328efeb9a66dddcf78a24fad96d3db58e9c3375d (diff) | |
parent | c5cd474d8c37bf32d7236e63d754a0eee9eb9071 (diff) | |
download | guile-6f03035fe80d1c25ffadc42ec59c473402f65f60.tar.gz |
Merge branch 'master' into boehm-demers-weiser-gc
Conflicts:
libguile/Makefile.am
libguile/coop-defs.h
libguile/gc-card.c
libguile/gc-freelist.c
libguile/gc-malloc.c
libguile/gc-mark.c
libguile/gc-segment.c
libguile/gc.c
libguile/gc.h
libguile/gc_os_dep.c
libguile/hashtab.c
libguile/hashtab.h
libguile/inline.h
libguile/private-gc.h
libguile/struct.c
libguile/struct.h
libguile/threads.c
libguile/threads.h
libguile/vectors.h
libguile/weaks.h
test-suite/tests/gc.test
Diffstat (limited to 'libguile/modules.c')
-rw-r--r-- | libguile/modules.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/libguile/modules.c b/libguile/modules.c index e4a2df037..e524eb518 100644 --- a/libguile/modules.c +++ b/libguile/modules.c @@ -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 @@ -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 @@ -230,17 +243,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) { |