diff options
Diffstat (limited to 'libguile/modules.c')
-rw-r--r-- | libguile/modules.c | 50 |
1 files changed, 36 insertions, 14 deletions
diff --git a/libguile/modules.c b/libguile/modules.c index c6b8bbd94..deae23a59 100644 --- a/libguile/modules.c +++ b/libguile/modules.c @@ -1,18 +1,19 @@ /* 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 - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA */ @@ -418,13 +419,13 @@ SCM_DEFINE (scm_module_local_variable, "module-local-variable", 2, 0, 0, register SCM b; - /* SCM_MODULE_TAG is not initialized yet when `boot-9.scm' is being - evaluated. */ if (scm_module_system_booted_p) SCM_VALIDATE_MODULE (1, module); SCM_VALIDATE_SYMBOL (2, sym); + if (scm_is_false (module)) + return scm_hashq_ref (scm_pre_modules_obarray, sym, SCM_UNDEFINED); /* 1. Check module obarray */ b = scm_hashq_ref (SCM_MODULE_OBARRAY (module), sym, SCM_UNDEFINED); @@ -550,6 +551,21 @@ SCM_DEFINE (scm_standard_interface_eval_closure, } #undef FUNC_NAME +SCM_DEFINE (scm_eval_closure_module, + "eval-closure-module", 1, 0, 0, + (SCM eval_closure), + "Return the module associated with this eval closure.") +/* the idea is that eval closures are really not the way to do things, they're + superfluous given our module system. this function lets mmacros migrate away + from eval closures. */ +#define FUNC_NAME s_scm_eval_closure_module +{ + SCM_MAKE_VALIDATE_MSG (SCM_ARG1, eval_closure, EVAL_CLOSURE_P, + "eval-closure"); + return SCM_SMOB_OBJECT (eval_closure); +} +#undef FUNC_NAME + SCM scm_module_lookup_closure (SCM module) { @@ -568,11 +584,20 @@ scm_current_module_lookup_closure () return SCM_BOOL_F; } +SCM_SYMBOL (sym_sys_pre_modules_transformer, "%pre-modules-transformer"); + SCM scm_module_transformer (SCM module) { - if (scm_is_false (module)) - return SCM_BOOL_F; + if (SCM_UNLIKELY (scm_is_false (module))) + { SCM v = scm_hashq_ref (scm_pre_modules_obarray, + sym_sys_pre_modules_transformer, + SCM_BOOL_F); + if (scm_is_false (v)) + return SCM_BOOL_F; + else + return SCM_VARIABLE_REF (v); + } else return SCM_MODULE_TRANSFORMER (module); } @@ -580,10 +605,7 @@ scm_module_transformer (SCM module) SCM scm_current_module_transformer () { - if (scm_module_system_booted_p) - return scm_module_transformer (scm_current_module ()); - else - return SCM_BOOL_F; + return scm_module_transformer (scm_current_module ()); } SCM_DEFINE (scm_module_import_interface, "module-import-interface", 2, 0, 0, |