summaryrefslogtreecommitdiff
path: root/libguile/modules.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2018-05-14 10:38:05 +0200
committerAndy Wingo <wingo@pobox.com>2018-05-14 11:27:30 +0200
commit16a996f052f381d915288bc4f39dfc4c21930295 (patch)
tree1cd76aae340eb8c2b915b0756f4ba56ab428a71e /libguile/modules.c
parentad96291ffe2a32b85c94639b6f250fd9be846c59 (diff)
downloadguile-16a996f052f381d915288bc4f39dfc4c21930295.tar.gz
Add scm_maybe_resolve_module
* libguile/modules.c (scm_maybe_resolve_module): New API function, like resolve-module but not ensuring that the module is created. (scm_public_variable, scm_private_variable): Adapt to call scm_maybe_resolve_module. * libguile/modules.h (scm_maybe_resolve_module): Declare new API.
Diffstat (limited to 'libguile/modules.c')
-rw-r--r--libguile/modules.c15
1 files changed, 10 insertions, 5 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",