Mercurial > hg > xemacs-beta
diff src/symbols.c @ 996:25e260cb7994
[xemacs-hg @ 2002-09-10 15:27:02 by james]
Enable unloading of dynamic modules. Create the first two internal XEmacs
modules: LDAP and postgreSQL. Update the sample directory to contain a
sample internal XEmacs module and a sample external XEmacs module. Improve
support for autoloading modules. Make internal module code compile into the
XEmacs binary if XEmacs is configured without module support. Make the
internal module directories self-contained so that they can be distributed
separately from XEmacs.
author | james |
---|---|
date | Tue, 10 Sep 2002 15:27:39 +0000 |
parents | c925bacdda60 |
children | 184461bc8de4 |
line wrap: on
line diff
--- a/src/symbols.c Mon Sep 09 21:53:43 2002 +0000 +++ b/src/symbols.c Tue Sep 10 15:27:39 2002 +0000 @@ -603,8 +603,12 @@ invalid_change ("Use `set-specifier' to change a specifier's value", sym); - if (symbol_is_constant (sym, val) - || (SYMBOL_IS_KEYWORD (sym) && !EQ (newval, sym))) + if ( +#ifdef HAVE_SHLIB +!(unloading_module && UNBOUNDP(newval)) && +#endif + (symbol_is_constant (sym, val) + || (SYMBOL_IS_KEYWORD (sym) && !EQ (newval, sym)))) signal_error_1 (Qsetting_constant, UNBOUNDP (newval) ? list1 (sym) : list2 (sym, newval)); } @@ -1807,12 +1811,41 @@ goto retry; case SYMVAL_FIXNUM_FORWARD: + case SYMVAL_CONST_FIXNUM_FORWARD: case SYMVAL_BOOLEAN_FORWARD: - case SYMVAL_OBJECT_FORWARD: + case SYMVAL_CONST_BOOLEAN_FORWARD: case SYMVAL_DEFAULT_BUFFER_FORWARD: case SYMVAL_DEFAULT_CONSOLE_FORWARD: if (UNBOUNDP (newval)) - invalid_change ("Cannot makunbound", symbol); + { +#ifdef HAVE_SHLIB + if (unloading_module) + { + sym->value = newval; + return newval; + } + else +#endif + invalid_change ("Cannot makunbound", symbol); + } + break; + + case SYMVAL_OBJECT_FORWARD: + case SYMVAL_CONST_OBJECT_FORWARD: + if (UNBOUNDP (newval)) + { +#ifdef HAVE_SHLIB + if (unloading_module) + { + unstaticpro_nodump (symbol_value_forward_forward + (XSYMBOL_VALUE_FORWARD (valcontents))); + sym->value = newval; + return newval; + } + else +#endif + invalid_change ("Cannot makunbound", symbol); + } break; /* case SYMVAL_UNBOUND_MARKER: break; */ @@ -3501,6 +3534,12 @@ fun = wrap_subr (subr); XSYMBOL (sym)->function = fun; + +#ifdef HAVE_SHLIB + /* If it is declared in a module, update the load history */ + if (initialized) + LOADHIST_ATTACH (sym); +#endif } /* Define a lisp macro using a Lisp_Subr. */ @@ -3515,6 +3554,12 @@ fun = wrap_subr (subr); XSYMBOL (sym)->function = Fcons (Qmacro, fun); + +#ifdef HAVE_SHLIB + /* If it is declared in a module, update the load history */ + if (initialized) + LOADHIST_ATTACH (sym); +#endif } static void @@ -3655,14 +3700,17 @@ { Lisp_Object sym; -#if defined(HAVE_SHLIB) +#ifdef HAVE_SHLIB /* * As with defsubr(), this will only be called in a dumped Emacs when * we are adding variables from a dynamically loaded module. That means * we can't use purespace. Take that into account. */ if (initialized) - sym = Fintern (build_string (symbol_name), Qnil); + { + sym = Fintern (build_string (symbol_name), Qnil); + LOADHIST_ATTACH (sym); + } else #endif sym = Fintern (make_string_nocopy ((const Ibyte *) symbol_name,