\f
-/* scm_sym2var
- *
- * looks up the variable bound to SYM according to PROC. PROC should be
- * a `eval closure' of some module.
- *
- * When no binding exists, and DEFINEP is true, create a new binding
- * with a initial value of SCM_UNDEFINED. Return `#f' when DEFINEP as
- * false and no binding exists.
- *
- * When PROC is `#f', it is ignored and the binding is searched for in
- * the scm_pre_modules_obarray (a `eq' hash table).
- */
-
-SCM
-scm_sym2var (SCM sym, SCM proc, SCM definep)
-#define FUNC_NAME "scm_sym2var"
-{
- SCM var;
-
- if (definep)
- scm_c_issue_deprecation_warning
- ("scm_sym2var is deprecated. Use scm_define or scm_module_define\n"
- "to define variables. In some rare cases you may need\n"
- "scm_module_ensure_local_variable.");
- else
- scm_c_issue_deprecation_warning
- ("scm_sym2var is deprecated. Use scm_module_variable to look up\n"
- "variables.");
-
- if (SCM_NIMP (proc))
- {
- if (SCM_EVAL_CLOSURE_P (proc))
- {
- /* Bypass evaluator in the standard case. */
- var = scm_eval_closure_lookup (proc, sym, definep);
- }
- else
- var = scm_call_2 (proc, sym, definep);
- }
- else
- {
- if (scm_is_false (definep))
- var = scm_module_variable (scm_the_root_module (), sym);
- else
- var = scm_module_ensure_local_variable (scm_the_root_module (), sym);
- }
-
- if (scm_is_true (var) && !SCM_VARIABLEP (var))
- SCM_MISC_ERROR ("~S is not bound to a variable", scm_list_1 (sym));
-
- return var;
-}
-#undef FUNC_NAME
-
-SCM
-scm_lookup_closure_module (SCM proc)
-{
- scm_c_issue_deprecation_warning
- ("Eval closures are deprecated. See \"Accessing Modules From C\" in\n"
- "the manual, for replacements.");
-
- if (scm_is_false (proc))
- return scm_the_root_module ();
- else if (SCM_EVAL_CLOSURE_P (proc))
- return SCM_PACK (SCM_SMOB_DATA (proc));
- else
- /* FIXME: The `module' property is no longer set on eval closures, as it
- introduced a circular reference that precludes garbage collection of
- modules with the current weak hash table semantics (see
- http://lists.gnu.org/archive/html/guile-devel/2009-01/msg00102.html and
- http://thread.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/2465
- for details). Since it doesn't appear to be used (only in this
- function, which has 1 caller), we no longer extend
- `set-module-eval-closure!' to set the `module' property. */
- abort ();
-}
-
-SCM
-scm_module_lookup_closure (SCM module)
-{
- scm_c_issue_deprecation_warning
- ("Eval closures are deprecated. See \"Accessing Modules From C\" in\n"
- "the manual, for replacements.");
-
- if (scm_is_false (module))
- return SCM_BOOL_F;
- else
- return SCM_MODULE_EVAL_CLOSURE (module);
-}
-
-SCM
-scm_current_module_lookup_closure ()
-{
- scm_c_issue_deprecation_warning
- ("Eval closures are deprecated. See \"Accessing Modules From C\" in\n"
- "the manual, for replacements.");
-
- if (scm_module_system_booted_p)
- return scm_module_lookup_closure (scm_current_module ());
- else
- return SCM_BOOL_F;
-}
-
-scm_t_bits scm_tc16_eval_closure;
-
-#define SCM_F_EVAL_CLOSURE_INTERFACE (1<<0)
-#define SCM_EVAL_CLOSURE_INTERFACE_P(e) \
- (SCM_SMOB_FLAGS (e) & SCM_F_EVAL_CLOSURE_INTERFACE)
-
-/* NOTE: This function may be called by a smob application
- or from another C function directly. */
-SCM
-scm_eval_closure_lookup (SCM eclo, SCM sym, SCM definep)
-{
- SCM module = SCM_PACK (SCM_SMOB_DATA (eclo));
-
- scm_c_issue_deprecation_warning
- ("Eval closures are deprecated. See \"Accessing Modules From C\" in\n"
- "the manual, for replacements.");
-
- if (scm_is_true (definep))
- {
- if (SCM_EVAL_CLOSURE_INTERFACE_P (eclo))
- return SCM_BOOL_F;
- return scm_module_ensure_local_variable (module, sym);
- }
- else
- return scm_module_variable (module, sym);
-}
-
-SCM_DEFINE (scm_standard_eval_closure, "standard-eval-closure", 1, 0, 0,
- (SCM module),
- "Return an eval closure for the module @var{module}.")
-#define FUNC_NAME s_scm_standard_eval_closure
-{
- scm_c_issue_deprecation_warning
- ("Eval closures are deprecated. See \"Accessing Modules From C\" in\n"
- "the manual, for replacements.");
-
- SCM_RETURN_NEWSMOB (scm_tc16_eval_closure, SCM_UNPACK (module));
-}
-#undef FUNC_NAME
-
-
-SCM_DEFINE (scm_standard_interface_eval_closure,
- "standard-interface-eval-closure", 1, 0, 0,
- (SCM module),
- "Return a interface eval closure for the module @var{module}. "
- "Such a closure does not allow new bindings to be added.")
-#define FUNC_NAME s_scm_standard_interface_eval_closure
-{
- scm_c_issue_deprecation_warning
- ("Eval closures are deprecated. See \"Accessing Modules From C\" in\n"
- "the manual, for replacements.");
-
- SCM_RETURN_NEWSMOB (scm_tc16_eval_closure | (SCM_F_EVAL_CLOSURE_INTERFACE<<16),
- SCM_UNPACK (module));
-}
-#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_c_issue_deprecation_warning
- ("Eval closures are deprecated. See \"Accessing Modules From C\" in\n"
- "the manual, for replacements.");
-
- SCM_MAKE_VALIDATE_MSG (SCM_ARG1, eval_closure, EVAL_CLOSURE_P,
- "eval-closure");
- return SCM_SMOB_OBJECT (eval_closure);
-}
-#undef FUNC_NAME
-
-
-\f
-
+
void
scm_i_init_deprecated ()
{
--;;;; Copyright (C) 1999, 2000, 2001, 2003, 2006, 2008 Free Software Foundation, Inc.
++;;;; Copyright (C) 1999, 2000, 2001, 2003, 2006, 2008, 2012 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
((memv (car l) (cdr l)) (car l))
(else (find-duplicate (cdr l)))))
- (define (top-level-env)
- (let ((mod (current-module)))
- (if mod
- (module-eval-closure mod)
- '())))
-(begin-deprecated
- (define (top-level-env)
- (let ((mod (current-module)))
- (if mod
- (module-eval-closure mod)
- '())))
--
- (define (top-level-env? env)
- (or (null? env)
- (procedure? (car env))))
- (define (top-level-env? env)
- (or (null? env)
- (procedure? (car env))))
-
- (export top-level-env? top-level-env))
--
(define (map* fn . l) ; A map which accepts dotted lists (arg lists
(cond ; must be "isomorph"
((null? (car l)) '())