Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
995:4575a219af58 | 996:25e260cb7994 |
---|---|
601 if (SYMBOL_VALUE_MAGIC_P (val) && | 601 if (SYMBOL_VALUE_MAGIC_P (val) && |
602 XSYMBOL_VALUE_MAGIC_TYPE (val) == SYMVAL_CONST_SPECIFIER_FORWARD) | 602 XSYMBOL_VALUE_MAGIC_TYPE (val) == SYMVAL_CONST_SPECIFIER_FORWARD) |
603 invalid_change ("Use `set-specifier' to change a specifier's value", | 603 invalid_change ("Use `set-specifier' to change a specifier's value", |
604 sym); | 604 sym); |
605 | 605 |
606 if (symbol_is_constant (sym, val) | 606 if ( |
607 || (SYMBOL_IS_KEYWORD (sym) && !EQ (newval, sym))) | 607 #ifdef HAVE_SHLIB |
608 !(unloading_module && UNBOUNDP(newval)) && | |
609 #endif | |
610 (symbol_is_constant (sym, val) | |
611 || (SYMBOL_IS_KEYWORD (sym) && !EQ (newval, sym)))) | |
608 signal_error_1 (Qsetting_constant, | 612 signal_error_1 (Qsetting_constant, |
609 UNBOUNDP (newval) ? list1 (sym) : list2 (sym, newval)); | 613 UNBOUNDP (newval) ? list1 (sym) : list2 (sym, newval)); |
610 } | 614 } |
611 | 615 |
612 /* Verify that it's ok to make SYM buffer-local. This rejects | 616 /* Verify that it's ok to make SYM buffer-local. This rejects |
1805 ? Qmakunbound : Qset); | 1809 ? Qmakunbound : Qset); |
1806 /* presto change-o! */ | 1810 /* presto change-o! */ |
1807 goto retry; | 1811 goto retry; |
1808 | 1812 |
1809 case SYMVAL_FIXNUM_FORWARD: | 1813 case SYMVAL_FIXNUM_FORWARD: |
1814 case SYMVAL_CONST_FIXNUM_FORWARD: | |
1810 case SYMVAL_BOOLEAN_FORWARD: | 1815 case SYMVAL_BOOLEAN_FORWARD: |
1811 case SYMVAL_OBJECT_FORWARD: | 1816 case SYMVAL_CONST_BOOLEAN_FORWARD: |
1812 case SYMVAL_DEFAULT_BUFFER_FORWARD: | 1817 case SYMVAL_DEFAULT_BUFFER_FORWARD: |
1813 case SYMVAL_DEFAULT_CONSOLE_FORWARD: | 1818 case SYMVAL_DEFAULT_CONSOLE_FORWARD: |
1814 if (UNBOUNDP (newval)) | 1819 if (UNBOUNDP (newval)) |
1815 invalid_change ("Cannot makunbound", symbol); | 1820 { |
1821 #ifdef HAVE_SHLIB | |
1822 if (unloading_module) | |
1823 { | |
1824 sym->value = newval; | |
1825 return newval; | |
1826 } | |
1827 else | |
1828 #endif | |
1829 invalid_change ("Cannot makunbound", symbol); | |
1830 } | |
1831 break; | |
1832 | |
1833 case SYMVAL_OBJECT_FORWARD: | |
1834 case SYMVAL_CONST_OBJECT_FORWARD: | |
1835 if (UNBOUNDP (newval)) | |
1836 { | |
1837 #ifdef HAVE_SHLIB | |
1838 if (unloading_module) | |
1839 { | |
1840 unstaticpro_nodump (symbol_value_forward_forward | |
1841 (XSYMBOL_VALUE_FORWARD (valcontents))); | |
1842 sym->value = newval; | |
1843 return newval; | |
1844 } | |
1845 else | |
1846 #endif | |
1847 invalid_change ("Cannot makunbound", symbol); | |
1848 } | |
1816 break; | 1849 break; |
1817 | 1850 |
1818 /* case SYMVAL_UNBOUND_MARKER: break; */ | 1851 /* case SYMVAL_UNBOUND_MARKER: break; */ |
1819 | 1852 |
1820 case SYMVAL_CURRENT_BUFFER_FORWARD: | 1853 case SYMVAL_CURRENT_BUFFER_FORWARD: |
3499 check_sane_subr (subr, sym); | 3532 check_sane_subr (subr, sym); |
3500 check_module_subr (subr); | 3533 check_module_subr (subr); |
3501 | 3534 |
3502 fun = wrap_subr (subr); | 3535 fun = wrap_subr (subr); |
3503 XSYMBOL (sym)->function = fun; | 3536 XSYMBOL (sym)->function = fun; |
3537 | |
3538 #ifdef HAVE_SHLIB | |
3539 /* If it is declared in a module, update the load history */ | |
3540 if (initialized) | |
3541 LOADHIST_ATTACH (sym); | |
3542 #endif | |
3504 } | 3543 } |
3505 | 3544 |
3506 /* Define a lisp macro using a Lisp_Subr. */ | 3545 /* Define a lisp macro using a Lisp_Subr. */ |
3507 void | 3546 void |
3508 defsubr_macro (Lisp_Subr *subr) | 3547 defsubr_macro (Lisp_Subr *subr) |
3513 check_sane_subr (subr, sym); | 3552 check_sane_subr (subr, sym); |
3514 check_module_subr (subr); | 3553 check_module_subr (subr); |
3515 | 3554 |
3516 fun = wrap_subr (subr); | 3555 fun = wrap_subr (subr); |
3517 XSYMBOL (sym)->function = Fcons (Qmacro, fun); | 3556 XSYMBOL (sym)->function = Fcons (Qmacro, fun); |
3557 | |
3558 #ifdef HAVE_SHLIB | |
3559 /* If it is declared in a module, update the load history */ | |
3560 if (initialized) | |
3561 LOADHIST_ATTACH (sym); | |
3562 #endif | |
3518 } | 3563 } |
3519 | 3564 |
3520 static void | 3565 static void |
3521 deferror_1 (Lisp_Object *symbol, const char *name, const char *messuhhj, | 3566 deferror_1 (Lisp_Object *symbol, const char *name, const char *messuhhj, |
3522 Lisp_Object inherits_from, int massage_p) | 3567 Lisp_Object inherits_from, int massage_p) |
3653 void | 3698 void |
3654 defvar_magic (const char *symbol_name, const struct symbol_value_forward *magic) | 3699 defvar_magic (const char *symbol_name, const struct symbol_value_forward *magic) |
3655 { | 3700 { |
3656 Lisp_Object sym; | 3701 Lisp_Object sym; |
3657 | 3702 |
3658 #if defined(HAVE_SHLIB) | 3703 #ifdef HAVE_SHLIB |
3659 /* | 3704 /* |
3660 * As with defsubr(), this will only be called in a dumped Emacs when | 3705 * As with defsubr(), this will only be called in a dumped Emacs when |
3661 * we are adding variables from a dynamically loaded module. That means | 3706 * we are adding variables from a dynamically loaded module. That means |
3662 * we can't use purespace. Take that into account. | 3707 * we can't use purespace. Take that into account. |
3663 */ | 3708 */ |
3664 if (initialized) | 3709 if (initialized) |
3665 sym = Fintern (build_string (symbol_name), Qnil); | 3710 { |
3711 sym = Fintern (build_string (symbol_name), Qnil); | |
3712 LOADHIST_ATTACH (sym); | |
3713 } | |
3666 else | 3714 else |
3667 #endif | 3715 #endif |
3668 sym = Fintern (make_string_nocopy ((const Ibyte *) symbol_name, | 3716 sym = Fintern (make_string_nocopy ((const Ibyte *) symbol_name, |
3669 strlen (symbol_name)), Qnil); | 3717 strlen (symbol_name)), Qnil); |
3670 | 3718 |