-/* Copyright (C) 1998,2000,2001 Free Software Foundation, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307 USA
- *
- * As a special exception, the Free Software Foundation gives permission
- * for additional uses of the text contained in its release of GUILE.
- *
- * The exception is that, if you link the GUILE library with other files
- * to produce an executable, this does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * Your use of that executable is in no way restricted on account of
- * linking the GUILE library code into it.
+/* Copyright (C) 1998,2000,2001,2002,2003,2004,2006,2007,2008 Free Software Foundation, Inc.
*
- * This exception does not however invalidate any other reasons why
- * the executable file might be covered by the GNU General Public License.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This exception applies only to the code released by the
- * Free Software Foundation under the name GUILE. If you copy
- * code from other Free Software Foundation releases into a copy of
- * GUILE, as the General Public License permits, the exception does
- * not apply to the code that you add in this way. To avoid misleading
- * anyone as to the status of such modified files, you must delete
- * this exception notice from them.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * If you write modifications of your own for GUILE, it is your choice
- * whether to permit this exception to apply to your modifications.
- * If you do not wish that, delete this exception notice. */
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
\f
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
#include <stdarg.h>
static SCM the_module;
+static SCM the_root_module_var;
+
+static SCM
+the_root_module ()
+{
+ if (scm_module_system_booted_p)
+ return SCM_VARIABLE_REF (the_root_module_var);
+ else
+ return SCM_BOOL_F;
+}
+
SCM_DEFINE (scm_current_module, "current-module", 0, 0, 0,
(),
"Return the current module.")
#define FUNC_NAME s_scm_current_module
{
- return scm_fluid_ref (the_module);
+ SCM curr = scm_fluid_ref (the_module);
+
+ return scm_is_true (curr) ? curr : the_root_module ();
}
#undef FUNC_NAME
SCM_DEFINE (scm_set_current_module, "set-current-module", 1, 0, 0,
(SCM module),
- "Set the current module to @var{module} and return"
+ "Set the current module to @var{module} and return\n"
"the previous current module.")
#define FUNC_NAME s_scm_set_current_module
{
old = scm_current_module ();
scm_fluid_set_x (the_module, module);
-#if SCM_DEBUG_DEPRECATED == 0
- scm_fluid_set_x (SCM_VARIABLE_REF (scm_top_level_lookup_closure_var),
- scm_current_module_lookup_closure ());
- scm_fluid_set_x (SCM_VARIABLE_REF (scm_system_transformer),
- scm_current_module_transformer ());
-#endif
-
return old;
}
#undef FUNC_NAME
return scm_c_with_fluid (the_module, module, func, data);
}
+void
+scm_dynwind_current_module (SCM module)
+{
+ scm_dynwind_fluid (the_module, module);
+}
+
+/*
+ convert "A B C" to scheme list (A B C)
+ */
static SCM
convert_module_name (const char *name)
{
ptr++;
if (ptr > name)
{
- *tail = scm_cons (scm_mem2symbol (name, ptr-name), SCM_EOL);
+ SCM sym = scm_from_locale_symboln (name, ptr-name);
+ *tail = scm_cons (sym, SCM_EOL);
tail = SCM_CDRLOC (*tail);
}
name = ptr;
scm_c_use_module (const char *name)
{
scm_call_1 (SCM_VARIABLE_REF (process_use_modules_var),
- scm_list_1 (convert_module_name (name)));
+ scm_list_1 (scm_list_1 (convert_module_name (name))));
}
static SCM module_export_x_var;
+SCM
+scm_module_export (SCM module, SCM namelist)
+{
+ return scm_call_2 (SCM_VARIABLE_REF (module_export_x_var),
+ module, namelist);
+}
+
+
+/*
+ @code{scm_c_export}(@var{name-list})
+
+ @code{scm_c_export} exports the named bindings from the current
+ module, making them visible to users of the module. This function
+ takes a list of string arguments, terminated by NULL, e.g.
+
+ @example
+ scm_c_export ("add-double-record", "bamboozle-money", NULL);
+ @end example
+*/
void
scm_c_export (const char *name, ...)
{
- va_list ap;
- SCM names = scm_cons (scm_str2symbol (name), SCM_EOL);
- SCM *tail = SCM_CDRLOC (names);
- va_start (ap, name);
- while (1)
+ if (name)
{
- const char *n = va_arg (ap, const char *);
- if (n == NULL)
- break;
- *tail = scm_cons (scm_str2symbol (n), SCM_EOL);
- tail = SCM_CDRLOC (*tail);
+ va_list ap;
+ SCM names = scm_cons (scm_from_locale_symbol (name), SCM_EOL);
+ SCM *tail = SCM_CDRLOC (names);
+ va_start (ap, name);
+ while (1)
+ {
+ const char *n = va_arg (ap, const char *);
+ if (n == NULL)
+ break;
+ *tail = scm_cons (scm_from_locale_symbol (n), SCM_EOL);
+ tail = SCM_CDRLOC (*tail);
+ }
+ va_end (ap);
+ scm_module_export (scm_current_module (), names);
}
- scm_call_2 (SCM_VARIABLE_REF (module_export_x_var),
- scm_current_module (), names);
}
+
/* Environments */
SCM
SCM
scm_env_top_level (SCM env)
{
- while (SCM_NIMP (env))
+ while (scm_is_pair (env))
{
- if (!SCM_CONSP (SCM_CAR (env))
- && SCM_NFALSEP (scm_procedure_p (SCM_CAR (env))))
- return SCM_CAR (env);
+ SCM car_env = SCM_CAR (env);
+ if (!scm_is_pair (car_env) && scm_is_true (scm_procedure_p (car_env)))
+ return car_env;
env = SCM_CDR (env);
}
return SCM_BOOL_F;
SCM_SYMBOL (sym_module, "module");
-static SCM the_root_module_var;
-
-static SCM
-the_root_module ()
-{
- if (scm_module_system_booted_p)
- return SCM_VARIABLE_REF (the_root_module_var);
- else
- return SCM_BOOL_F;
-}
-
SCM
scm_lookup_closure_module (SCM proc)
{
- if (SCM_FALSEP (proc))
+ if (scm_is_false (proc))
return the_root_module ();
else if (SCM_EVAL_CLOSURE_P (proc))
return SCM_PACK (SCM_SMOB_DATA (proc));
else
{
- SCM mod = scm_procedure_property (proc, sym_module);
- if (mod == SCM_BOOL_F)
+ SCM mod;
+
+ /* FIXME: The `module' property is no longer set. See
+ `set-module-eval-closure!' in `boot-9.scm'. */
+ abort ();
+
+ mod = scm_procedure_property (proc, sym_module);
+ if (scm_is_false (mod))
mod = the_root_module ();
return mod;
}
/*
* C level implementation of the standard eval closure
*
- * This increases loading speed substantially.
- * The code will be replaced by the low-level environments in next release.
+ * This increases loading speed substantially. The code may be
+ * replaced by something based on environments.[ch], in a future
+ * release.
*/
-static SCM module_make_local_var_x_var;
+/* The `module-make-local-var!' variable. */
+static SCM module_make_local_var_x_var = SCM_UNSPECIFIED;
-static SCM
-module_variable (SCM module, SCM sym)
+/* The `default-duplicate-binding-procedures' variable. */
+static SCM default_duplicate_binding_procedures_var = SCM_UNSPECIFIED;
+
+/* Return the list of default duplicate binding handlers (procedures). */
+static inline SCM
+default_duplicate_binding_handlers (void)
+{
+ SCM get_handlers;
+
+ get_handlers = SCM_VARIABLE_REF (default_duplicate_binding_procedures_var);
+
+ return (scm_call_0 (get_handlers));
+}
+
+/* Resolve the import of SYM in MODULE, where SYM is currently provided by
+ both IFACE1 as VAR1 and IFACE2 as VAR2. Return the variable chosen by the
+ duplicate binding handlers or `#f'. */
+static inline SCM
+resolve_duplicate_binding (SCM module, SCM sym,
+ SCM iface1, SCM var1,
+ SCM iface2, SCM var2)
+{
+ SCM result = SCM_BOOL_F;
+
+ if (!scm_is_eq (var1, var2))
+ {
+ SCM val1, val2;
+ SCM handlers, h, handler_args;
+
+ val1 = SCM_VARIABLE_REF (var1);
+ val2 = SCM_VARIABLE_REF (var2);
+
+ val1 = (val1 == SCM_UNSPECIFIED) ? SCM_BOOL_F : val1;
+ val2 = (val2 == SCM_UNSPECIFIED) ? SCM_BOOL_F : val2;
+
+ handlers = SCM_MODULE_DUPLICATE_HANDLERS (module);
+ if (scm_is_false (handlers))
+ handlers = default_duplicate_binding_handlers ();
+
+ handler_args = scm_list_n (module, sym,
+ iface1, val1, iface2, val2,
+ var1, val1,
+ SCM_UNDEFINED);
+
+ for (h = handlers;
+ scm_is_pair (h) && scm_is_false (result);
+ h = SCM_CDR (h))
+ {
+ result = scm_apply (SCM_CAR (h), handler_args, SCM_EOL);
+ }
+ }
+ else
+ result = var1;
+
+ return result;
+}
+
+/* Lookup SYM as an imported variable of MODULE. */
+static inline SCM
+module_imported_variable (SCM module, SCM sym)
{
+#define SCM_BOUND_THING_P scm_is_true
+ register SCM var, imports;
+
+ /* Search cached imported bindings. */
+ imports = SCM_MODULE_IMPORT_OBARRAY (module);
+ var = scm_hashq_ref (imports, sym, SCM_UNDEFINED);
+ if (SCM_BOUND_THING_P (var))
+ return var;
+
+ {
+ /* Search the use list for yet uncached imported bindings, possibly
+ resolving duplicates as needed and caching the result in the import
+ obarray. */
+ SCM uses;
+ SCM found_var = SCM_BOOL_F, found_iface = SCM_BOOL_F;
+
+ for (uses = SCM_MODULE_USES (module);
+ scm_is_pair (uses);
+ uses = SCM_CDR (uses))
+ {
+ SCM iface;
+
+ iface = SCM_CAR (uses);
+ var = scm_module_variable (iface, sym);
+
+ if (SCM_BOUND_THING_P (var))
+ {
+ if (SCM_BOUND_THING_P (found_var))
+ {
+ /* SYM is a duplicate binding (imported more than once) so we
+ need to resolve it. */
+ found_var = resolve_duplicate_binding (module, sym,
+ found_iface, found_var,
+ iface, var);
+ if (scm_is_eq (found_var, var))
+ found_iface = iface;
+ }
+ else
+ /* Keep track of the variable we found and check for other
+ occurences of SYM in the use list. */
+ found_var = var, found_iface = iface;
+ }
+ }
+
+ if (SCM_BOUND_THING_P (found_var))
+ {
+ /* Save the lookup result for future reference. */
+ (void) scm_hashq_set_x (imports, sym, found_var);
+ return found_var;
+ }
+ }
+
+ return SCM_BOOL_F;
+#undef SCM_BOUND_THING_P
+}
+
+SCM_DEFINE (scm_module_local_variable, "module-local-variable", 2, 0, 0,
+ (SCM module, SCM sym),
+ "Return the variable bound to @var{sym} in @var{module}. Return "
+ "@code{#f} is @var{sym} is not bound locally in @var{module}.")
+#define FUNC_NAME s_scm_module_local_variable
+{
+#define SCM_BOUND_THING_P(b) \
+ (scm_is_true (b))
+
+ register SCM b;
+
+ /* SCM_MODULE_TAG is not initialized yet when `boot-9.scm' is being
+ evaluated. */
+ if (scm_module_system_booted_p)
+ SCM_VALIDATE_MODULE (1, module);
+
+ SCM_VALIDATE_SYMBOL (2, sym);
+
+
/* 1. Check module obarray */
- SCM b = scm_hashq_ref (SCM_MODULE_OBARRAY (module), sym, SCM_UNDEFINED);
- if (SCM_VARIABLEP (b))
+ b = scm_hashq_ref (SCM_MODULE_OBARRAY (module), sym, SCM_UNDEFINED);
+ if (SCM_BOUND_THING_P (b))
return b;
+
+ /* 2. Search imported bindings. In order to be consistent with
+ `module-variable', the binder gets called only when no imported binding
+ matches SYM. */
+ b = module_imported_variable (module, sym);
+ if (SCM_BOUND_THING_P (b))
+ return SCM_BOOL_F;
+
{
+ /* 3. Query the custom binder. */
SCM binder = SCM_MODULE_BINDER (module);
- if (SCM_NFALSEP (binder))
- /* 2. Custom binder */
+
+ if (scm_is_true (binder))
{
b = scm_call_3 (binder, module, sym, SCM_BOOL_F);
- if (SCM_NFALSEP (b))
+ if (SCM_BOUND_THING_P (b))
return b;
}
}
+
+ return SCM_BOOL_F;
+
+#undef SCM_BOUND_THING_P
+}
+#undef FUNC_NAME
+
+SCM_DEFINE (scm_module_variable, "module-variable", 2, 0, 0,
+ (SCM module, SCM sym),
+ "Return the variable bound to @var{sym} in @var{module}. This "
+ "may be both a local variable or an imported variable. Return "
+ "@code{#f} is @var{sym} is not bound in @var{module}.")
+#define FUNC_NAME s_scm_module_variable
+{
+#define SCM_BOUND_THING_P(b) \
+ (scm_is_true (b))
+
+ register SCM var;
+
+ if (scm_module_system_booted_p)
+ SCM_VALIDATE_MODULE (1, module);
+
+ SCM_VALIDATE_SYMBOL (2, sym);
+
+ /* 1. Check module obarray */
+ var = scm_hashq_ref (SCM_MODULE_OBARRAY (module), sym, SCM_UNDEFINED);
+ if (SCM_BOUND_THING_P (var))
+ return var;
+
+ /* 2. Search among the imported variables. */
+ var = module_imported_variable (module, sym);
+ if (SCM_BOUND_THING_P (var))
+ return var;
+
{
- /* 3. Search the use list */
- SCM uses = SCM_MODULE_USES (module);
- while (SCM_CONSP (uses))
+ /* 3. Query the custom binder. */
+ SCM binder;
+
+ binder = SCM_MODULE_BINDER (module);
+ if (scm_is_true (binder))
{
- b = module_variable (SCM_CAR (uses), sym);
- if (SCM_NFALSEP (b))
- return b;
- uses = SCM_CDR (uses);
+ var = scm_call_3 (binder, module, sym, SCM_BOOL_F);
+ if (SCM_BOUND_THING_P (var))
+ return var;
}
- return SCM_BOOL_F;
}
+
+ return SCM_BOOL_F;
+
+#undef SCM_BOUND_THING_P
}
+#undef FUNC_NAME
scm_t_bits scm_tc16_eval_closure;
scm_eval_closure_lookup (SCM eclo, SCM sym, SCM definep)
{
SCM module = SCM_PACK (SCM_SMOB_DATA (eclo));
- if (SCM_NFALSEP (definep))
+ if (scm_is_true (definep))
{
if (SCM_EVAL_CLOSURE_INTERFACE_P (eclo))
return SCM_BOOL_F;
module, sym);
}
else
- return module_variable (module, sym);
+ return scm_module_variable (module, sym);
}
SCM_DEFINE (scm_standard_eval_closure, "standard-eval-closure", 1, 0, 0,
}
#undef FUNC_NAME
+
SCM_DEFINE (scm_standard_interface_eval_closure,
"standard-interface-eval-closure", 1, 0, 0,
(SCM module),
SCM
scm_module_lookup_closure (SCM module)
{
- if (module == SCM_BOOL_F)
+ if (scm_is_false (module))
return SCM_BOOL_F;
else
return SCM_MODULE_EVAL_CLOSURE (module);
SCM
scm_module_transformer (SCM module)
{
- if (module == SCM_BOOL_F)
+ if (scm_is_false (module))
return SCM_BOOL_F;
else
return SCM_MODULE_TRANSFORMER (module);
return SCM_BOOL_F;
}
+SCM_DEFINE (scm_module_import_interface, "module-import-interface", 2, 0, 0,
+ (SCM module, SCM sym),
+ "Return the module or interface from which @var{sym} is imported "
+ "in @var{module}. If @var{sym} is not imported (i.e., it is not "
+ "defined in @var{module} or it is a module-local binding instead "
+ "of an imported one), then @code{#f} is returned.")
+#define FUNC_NAME s_scm_module_import_interface
+{
+ SCM var, result = SCM_BOOL_F;
+
+ SCM_VALIDATE_MODULE (1, module);
+ SCM_VALIDATE_SYMBOL (2, sym);
+
+ var = scm_module_variable (module, sym);
+ if (scm_is_true (var))
+ {
+ /* Look for the module that provides VAR. */
+ SCM local_var;
+
+ local_var = scm_hashq_ref (SCM_MODULE_OBARRAY (module), sym,
+ SCM_UNDEFINED);
+ if (scm_is_eq (local_var, var))
+ result = module;
+ else
+ {
+ /* Look for VAR among the used modules. */
+ SCM uses, imported_var;
+
+ for (uses = SCM_MODULE_USES (module);
+ scm_is_pair (uses) && scm_is_false (result);
+ uses = SCM_CDR (uses))
+ {
+ imported_var = scm_module_variable (SCM_CAR (uses), sym);
+ if (scm_is_eq (imported_var, var))
+ result = SCM_CAR (uses);
+ }
+ }
+ }
+
+ return result;
+}
+#undef FUNC_NAME
+
/* scm_sym2var
*
* looks up the variable bound to SYM according to PROC. PROC should be
{
SCM handle;
- if (definep == SCM_BOOL_F)
+ if (scm_is_false (definep))
var = scm_hashq_ref (scm_pre_modules_obarray, sym, SCM_BOOL_F);
else
{
handle = scm_hashq_create_handle_x (scm_pre_modules_obarray,
sym, SCM_BOOL_F);
var = SCM_CDR (handle);
- if (var == SCM_BOOL_F)
+ if (scm_is_false (var))
{
var = scm_make_variable (SCM_UNDEFINED);
-#if SCM_ENABLE_VCELLS
- scm_variable_set_name_hint (var, sym);
-#endif
SCM_SETCDR (handle, var);
}
}
}
- if (var != SCM_BOOL_F && !SCM_VARIABLEP (var))
+ if (scm_is_true (var) && !SCM_VARIABLEP (var))
SCM_MISC_ERROR ("~S is not bound to a variable", scm_list_1 (sym));
return var;
SCM
scm_c_module_lookup (SCM module, const char *name)
{
- return scm_module_lookup (module, scm_str2symbol (name));
+ return scm_module_lookup (module, scm_from_locale_symbol (name));
}
SCM
SCM_VALIDATE_MODULE (1, module);
var = scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F);
- if (SCM_FALSEP (var))
+ if (scm_is_false (var))
SCM_MISC_ERROR ("unbound variable: ~S", scm_list_1 (sym));
return var;
}
SCM
scm_c_lookup (const char *name)
{
- return scm_lookup (scm_str2symbol (name));
+ return scm_lookup (scm_from_locale_symbol (name));
}
SCM
{
SCM var =
scm_sym2var (sym, scm_current_module_lookup_closure (), SCM_BOOL_F);
- if (SCM_FALSEP (var))
+ if (scm_is_false (var))
scm_misc_error ("scm_lookup", "unbound variable: ~S", scm_list_1 (sym));
return var;
}
SCM
scm_c_module_define (SCM module, const char *name, SCM value)
{
- return scm_module_define (module, scm_str2symbol (name), value);
+ return scm_module_define (module, scm_from_locale_symbol (name), value);
}
SCM
SCM
scm_c_define (const char *name, SCM value)
{
- return scm_define (scm_str2symbol (name), value);
+ return scm_define (scm_from_locale_symbol (name), value);
}
SCM
return var;
}
-SCM
-scm_module_reverse_lookup (SCM module, SCM variable)
-#define FUNC_NAME "module-reverse-lookup"
+SCM_DEFINE (scm_module_reverse_lookup, "module-reverse-lookup", 2, 0, 0,
+ (SCM module, SCM variable),
+ "Return the symbol under which @var{variable} is bound in "
+ "@var{module} or @var{#f} if @var{variable} is not visible "
+ "from @var{module}. If @var{module} is @code{#f}, then the "
+ "pre-module obarray is used.")
+#define FUNC_NAME s_scm_module_reverse_lookup
{
SCM obarray;
long i, n;
- if (module == SCM_BOOL_F)
+ if (scm_is_false (module))
obarray = scm_pre_modules_obarray;
else
{
obarray = SCM_MODULE_OBARRAY (module);
}
+ if (!SCM_HASHTABLE_P (obarray))
+ return SCM_BOOL_F;
+
/* XXX - We do not use scm_hash_fold here to avoid searching the
whole obarray. We should have a scm_hash_find procedure. */
- n = SCM_VECTOR_LENGTH (obarray);
+ n = SCM_HASHTABLE_N_BUCKETS (obarray);
for (i = 0; i < n; ++i)
{
- SCM ls = SCM_VELTS (obarray)[i], handle;
- while (!SCM_NULLP (ls))
+ SCM ls = SCM_HASHTABLE_BUCKET (obarray, i), handle;
+ while (!scm_is_null (ls))
{
handle = SCM_CAR (ls);
- if (SCM_CDR (handle) == variable)
- return SCM_CAR (handle);
+
+ if (SCM_CAR (handle) == SCM_PACK (NULL))
+ {
+ /* FIXME: We hit a weak pair whose car has become unreachable.
+ We should remove the pair in question or something. */
+ }
+ else
+ {
+ if (SCM_CDR (handle) == variable)
+ return SCM_CAR (handle);
+ }
+
ls = SCM_CDR (ls);
}
}
- /* Try the `uses' list.
- */
+ /* Try the `uses' list. */
{
SCM uses = SCM_MODULE_USES (module);
- while (SCM_CONSP (uses))
+ while (scm_is_pair (uses))
{
SCM sym = scm_module_reverse_lookup (SCM_CAR (uses), variable);
- if (sym != SCM_BOOL_F)
+ if (scm_is_true (sym))
return sym;
uses = SCM_CDR (uses);
}
}
#undef FUNC_NAME
-#if SCM_DEBUG_DEPRECATED == 0
-
-static SCM root_module_lookup_closure;
-SCM_SYMBOL (scm_sym_app, "app");
-SCM_SYMBOL (scm_sym_modules, "modules");
-static SCM module_prefix;
-static SCM make_modules_in_var;
-static SCM beautify_user_module_x_var;
-static SCM try_module_autoload_var;
-
-#endif
-
SCM_SYMBOL (scm_sym_system_module, "system-module");
SCM
scm_system_module_env_p (SCM env)
{
SCM proc = scm_env_top_level (env);
- if (SCM_FALSEP (proc))
+ if (scm_is_false (proc))
return SCM_BOOL_T;
- return ((SCM_NFALSEP (scm_procedure_property (proc,
+ return ((scm_is_true (scm_procedure_property (proc,
scm_sym_system_module)))
? SCM_BOOL_T
: SCM_BOOL_F);
scm_modules_prehistory ()
{
scm_pre_modules_obarray
- = scm_permanent_object (scm_c_make_hash_table (2001));
+ = scm_permanent_object (scm_c_make_hash_table (1533));
}
void
scm_init_modules ()
{
-#ifndef SCM_MAGIC_SNARFER
#include "libguile/modules.x"
-#endif
module_make_local_var_x_var = scm_c_define ("module-make-local-var!",
SCM_UNDEFINED);
scm_tc16_eval_closure = scm_make_smob_type ("eval-closure", 0);
- scm_set_smob_mark (scm_tc16_eval_closure, scm_markcdr);
scm_set_smob_apply (scm_tc16_eval_closure, scm_eval_closure_lookup, 2, 0, 0);
the_module = scm_permanent_object (scm_make_fluid ());
#define PERM(x) scm_permanent_object(x)
SCM module_type = SCM_VARIABLE_REF (scm_c_lookup ("module-type"));
- scm_module_tag = (SCM_CELL_WORD_1 (module_type) + scm_tc3_cons_gloc);
+ scm_module_tag = (SCM_CELL_WORD_1 (module_type) + scm_tc3_struct);
resolve_module_var = PERM (scm_c_lookup ("resolve-module"));
process_define_module_var = PERM (scm_c_lookup ("process-define-module"));
process_use_modules_var = PERM (scm_c_lookup ("process-use-modules"));
module_export_x_var = PERM (scm_c_lookup ("module-export!"));
the_root_module_var = PERM (scm_c_lookup ("the-root-module"));
-
-#if SCM_DEBUG_DEPRECATED == 0
-
- module_prefix = PERM (scm_list_2 (scm_sym_app, scm_sym_modules));
- make_modules_in_var = PERM (scm_c_lookup ("make-modules-in"));
- root_module_lookup_closure =
- PERM (scm_module_lookup_closure (SCM_VARIABLE_REF (the_root_module_var)));
- beautify_user_module_x_var = PERM (scm_c_lookup ("beautify-user-module!"));
- try_module_autoload_var = PERM (scm_c_lookup ("try-module-autoload"));
-
-#endif
+ default_duplicate_binding_procedures_var =
+ PERM (scm_c_lookup ("default-duplicate-binding-procedures"));
scm_module_system_booted_p = 1;
}
-#if SCM_DEBUG_DEPRECATED == 0
-
-SCM
-scm_the_root_module ()
-{
- scm_c_issue_deprecation_warning ("`scm_the_root_module' is deprecated. "
- "Use `scm_c_resolve_module (\"guile\") "
- "instead.");
-
- return the_root_module ();
-}
-
-static SCM
-scm_module_full_name (SCM name)
-{
- if (SCM_EQ_P (SCM_CAR (name), scm_sym_app))
- return name;
- else
- return scm_append (scm_list_2 (module_prefix, name));
-}
-
-SCM
-scm_make_module (SCM name)
-{
- scm_c_issue_deprecation_warning ("`scm_make_module' is deprecated. "
- "Use `scm_c_define_module instead.");
-
- return scm_call_2 (SCM_VARIABLE_REF (make_modules_in_var),
- scm_the_root_module (),
- scm_module_full_name (name));
-}
-
-SCM
-scm_ensure_user_module (SCM module)
-{
- scm_c_issue_deprecation_warning ("`scm_ensure_user_module' is deprecated. "
- "Use `scm_c_define_module instead.");
-
- scm_call_1 (SCM_VARIABLE_REF (beautify_user_module_x_var), module);
- return SCM_UNSPECIFIED;
-}
-
-SCM
-scm_load_scheme_module (SCM name)
-{
- scm_c_issue_deprecation_warning ("`scm_load_scheme_module' is deprecated. "
- "Use `scm_c_resolve_module instead.");
-
- return scm_call_1 (SCM_VARIABLE_REF (try_module_autoload_var), name);
-}
-
-#endif
-
/*
Local Variables:
c-file-style: "gnu"