summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libguile/modules.c15
-rw-r--r--libguile/modules.h3
2 files changed, 12 insertions, 6 deletions
diff --git a/libguile/modules.c b/libguile/modules.c
index b469a1a64..b5fdbf6ef 100644
--- a/libguile/modules.c
+++ b/libguile/modules.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998,2000,2001,2002,2003,2004,2006,2007,2008,2009,2010,2011,2012,2017 Free Software Foundation, Inc.
+/* Copyright (C) 1998,2000-2004,2006-2012,2017-2018 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
@@ -177,6 +177,13 @@ scm_resolve_module (SCM name)
}
SCM
+scm_maybe_resolve_module (SCM name)
+{
+ return scm_call_3 (SCM_VARIABLE_REF (resolve_module_var), name,
+ k_ensure, SCM_BOOL_F);
+}
+
+SCM
scm_c_define_module (const char *name,
void (*init)(void *), void *data)
{
@@ -633,8 +640,7 @@ scm_public_variable (SCM module_name, SCM name)
{
SCM mod, iface;
- mod = scm_call_3 (scm_variable_ref (resolve_module_var), module_name,
- k_ensure, SCM_BOOL_F);
+ mod = scm_maybe_resolve_module (module_name);
if (scm_is_false (mod))
scm_misc_error ("public-lookup", "Module named ~s does not exist",
@@ -654,8 +660,7 @@ scm_private_variable (SCM module_name, SCM name)
{
SCM mod;
- mod = scm_call_3 (scm_variable_ref (resolve_module_var), module_name,
- k_ensure, SCM_BOOL_F);
+ mod = scm_maybe_resolve_module (module_name);
if (scm_is_false (mod))
scm_misc_error ("private-lookup", "Module named ~s does not exist",
diff --git a/libguile/modules.h b/libguile/modules.h
index 28df6c6ea..207ec4470 100644
--- a/libguile/modules.h
+++ b/libguile/modules.h
@@ -3,7 +3,7 @@
#ifndef SCM_MODULES_H
#define SCM_MODULES_H
-/* Copyright (C) 1998, 2000, 2001, 2002, 2003, 2006, 2007, 2008, 2011, 2012 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2001, 2002, 2003, 2006, 2007, 2008, 2011, 2012, 2018 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
@@ -108,6 +108,7 @@ SCM_API SCM scm_c_private_ref (const char *module_name, const char *name);
SCM_API SCM scm_c_resolve_module (const char *name);
SCM_API SCM scm_resolve_module (SCM name);
+SCM_API SCM scm_maybe_resolve_module (SCM name);
SCM_API SCM scm_c_define_module (const char *name,
void (*init)(void *), void *data);
SCM_API void scm_c_use_module (const char *name);