[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 08/16: Add scm_maybe_resolve_module
From: |
Andy Wingo |
Subject: |
[Guile-commits] 08/16: Add scm_maybe_resolve_module |
Date: |
Mon, 14 May 2018 10:48:35 -0400 (EDT) |
wingo pushed a commit to branch master
in repository guile.
commit 16a996f052f381d915288bc4f39dfc4c21930295
Author: Andy Wingo <address@hidden>
Date: Mon May 14 10:38:05 2018 +0200
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.
---
libguile/modules.c | 15 ++++++++++-----
libguile/modules.h | 3 ++-
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/libguile/modules.c b/libguile/modules.c
index b469a1a..b5fdbf6 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 28df6c6..207ec44 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);
- [Guile-commits] branch master updated (e014bf3 -> 601d0ea), Andy Wingo, 2018/05/14
- [Guile-commits] 02/16: Remove implementation of lsh, rsh instructions, Andy Wingo, 2018/05/14
- [Guile-commits] 05/16: VM calls =? through intrinsic, Andy Wingo, 2018/05/14
- [Guile-commits] 04/16: VM calls "<?" through intrinsic., Andy Wingo, 2018/05/14
- [Guile-commits] 06/16: Remove unused macros in VM, Andy Wingo, 2018/05/14
- [Guile-commits] 08/16: Add scm_maybe_resolve_module,
Andy Wingo <=
- [Guile-commits] 07/16: Mark call-scm<-scm-u64 as defining a result, Andy Wingo, 2018/05/14
- [Guile-commits] 12/16: Instruction explosion for cache-current-module, cached-toplevel-box, Andy Wingo, 2018/05/14
- [Guile-commits] 10/16: Add cache-ref, cache-set! macro-instructions, Andy Wingo, 2018/05/14
- [Guile-commits] 03/16: VM calls out to heap-numbers-equal? through intrinsics, Andy Wingo, 2018/05/14
- [Guile-commits] 15/16: Use intrinsics for top-level refs outside captured scopes, Andy Wingo, 2018/05/14
- [Guile-commits] 16/16: Remove implementations of now-unused toplevel-box et al instructions, Andy Wingo, 2018/05/14
- [Guile-commits] 13/16: Remove backend support for cached-module-box et al., Andy Wingo, 2018/05/14
- [Guile-commits] 11/16: Instruction explosion for cached-module-box, Andy Wingo, 2018/05/14
- [Guile-commits] 09/16: Add intrinsics for module operations, Andy Wingo, 2018/05/14
- [Guile-commits] 01/16: lsh, rsh etc are intrinsics, Andy Wingo, 2018/05/14