diff options
author | Andy Wingo <wingo@pobox.com> | 2012-05-23 11:46:30 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2012-05-23 11:49:16 +0200 |
commit | 62e15979b5d773dda79c4f44c07e919b5d0f6e18 (patch) | |
tree | 6df6724acbac08a6fb1baa6736d1687e84e75f3a /doc/ref | |
parent | 15bb587f45b718f08756993fec9274212cc7df58 (diff) | |
download | guile-62e15979b5d773dda79c4f44c07e919b5d0f6e18.tar.gz |
deprecate scm_sym2var
* libguile/deprecated.h:
* libguile/deprecated.c (scm_sym2var): Deprecate this function.
* libguile/modules.h:
* libguile/modules.c (scm_module_ensure_local_variable): New public
function, replacing scm_sym2var with a true definep, without going
through eval closures (which are deprecated).
(scm_current_module): Rework to do something sensible before modules
are booted.
(scm_module_lookup, scm_lookup): Refactor to use scm_module_variable.
(scm_module_define, scm_define): Refactor to use
scm_module_ensure_local_variable.
* libguile/vm-i-system.c (define!): Use scm_define.
* libguile/vm.c (resolve_variable): Use scm_module_lookup.
* libguile/macros.c (scm_make_syntax_transformer): Use
scm_module_variable.
* libguile/gdbint.c (gdb_binding): Use scm_define.
* doc/ref/api-modules.texi (Accessing Modules from C): Add docs for
scm_module_ensure_local_variable.
Diffstat (limited to 'doc/ref')
-rw-r--r-- | doc/ref/api-modules.texi | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/ref/api-modules.texi b/doc/ref/api-modules.texi index c91c2d409..17ab46277 100644 --- a/doc/ref/api-modules.texi +++ b/doc/ref/api-modules.texi @@ -1008,6 +1008,17 @@ Like @code{scm_c_define} and @code{scm_define}, but the specified module is used instead of the current one. @end deftypefn +In some rare cases, you may need to access the variable that +@code{scm_module_define} would have accessed, without changing the +binding of the existing variable, if one is present. In that case, use +@code{scm_module_ensure_local_variable}: + +@deftypefn {C Function} SCM scm_module_ensure_local_variable (SCM @var{module}, SCM @var{sym}) +Like @code{scm_module_define}, but if the @var{sym} is already locally +bound in that module, the variable's existing binding is not reset. +Returns a variable. +@end deftypefn + @deftypefn {C Function} SCM scm_module_reverse_lookup (SCM @var{module}, SCM @var{variable}) Find the symbol that is bound to @var{variable} in @var{module}. When no such binding is found, return @code{#f}. @end deftypefn |