comparison src/symbols.c @ 2963:288869ac83b5

[xemacs-hg @ 2005-09-29 11:41:21 by crestani] Fix new allocator's module support.
author crestani
date Thu, 29 Sep 2005 11:41:22 +0000
parents 05d62157e048
children ec5f23ea6d2e
comparison
equal deleted inserted replaced
2962:62d146e2f3ec 2963:288869ac83b5
3472 #else 3472 #else
3473 #define check_sane_subr(subr, sym) /* nothing */ 3473 #define check_sane_subr(subr, sym) /* nothing */
3474 #endif 3474 #endif
3475 3475
3476 #ifdef HAVE_SHLIB 3476 #ifdef HAVE_SHLIB
3477 #ifndef MC_ALLOC
3477 /* 3478 /*
3478 * If we are not in a pure undumped Emacs, we need to make a duplicate of 3479 * If we are not in a pure undumped Emacs, we need to make a duplicate of
3479 * the subr. This is because the only time this function will be called 3480 * the subr. This is because the only time this function will be called
3480 * in a running Emacs is when a dynamically loaded module is adding a 3481 * in a running Emacs is when a dynamically loaded module is adding a
3481 * subr, and we need to make sure that the subr is in allocated, Lisp- 3482 * subr, and we need to make sure that the subr is in allocated, Lisp-
3531 memcpy (newsubr, subr, sizeof (Lisp_Subr)); \ 3532 memcpy (newsubr, subr, sizeof (Lisp_Subr)); \
3532 subr->doc = (const char *)newsubr; \ 3533 subr->doc = (const char *)newsubr; \
3533 subr = newsubr; \ 3534 subr = newsubr; \
3534 } \ 3535 } \
3535 } while (0) 3536 } while (0)
3537 #else /* MC_ALLOC */
3538 /*
3539 * If we have the new allocator enabled, we do not need to make a
3540 * duplicate of the subr. The new allocator already does allocate all
3541 * subrs in Lisp-accessible memory rather than have it in the static
3542 * subr struct.
3543 *
3544 * NOTE: The DOC pointer is not set here as described above.
3545 */
3546 #define check_module_subr(subr) \
3547 do { \
3548 if (initialized) { \
3549 Lisp_Object f; \
3550 \
3551 if (subr->min_args < 0) \
3552 signal_ferror (Qdll_error, "%s min_args (%hd) too small", \
3553 subr_name (subr), subr->min_args); \
3554 if (subr->min_args > SUBR_MAX_ARGS) \
3555 signal_ferror (Qdll_error, "%s min_args (%hd) too big (max = %d)", \
3556 subr_name (subr), subr->min_args, SUBR_MAX_ARGS); \
3557 \
3558 if (subr->max_args != MANY && \
3559 subr->max_args != UNEVALLED) \
3560 { \
3561 /* Need to fix lisp.h and eval.c if SUBR_MAX_ARGS too small */ \
3562 if (subr->max_args > SUBR_MAX_ARGS) \
3563 signal_ferror (Qdll_error, "%s max_args (%hd) too big (max = %d)", \
3564 subr_name (subr), subr->max_args, SUBR_MAX_ARGS); \
3565 if (subr->min_args > subr->max_args) \
3566 signal_ferror (Qdll_error, "%s min_args (%hd) > max_args (%hd)", \
3567 subr_name (subr), subr->min_args, subr->max_args); \
3568 } \
3569 \
3570 f = XSYMBOL (sym)->function; \
3571 if (!UNBOUNDP (f) && (!CONSP (f) || !EQ (XCAR (f), Qautoload))) \
3572 signal_ferror (Qdll_error, "Attempt to redefine %s", subr_name (subr)); \
3573 } \
3574 } while (0)
3575 #endif /* MC_ALLOC */
3536 #else /* ! HAVE_SHLIB */ 3576 #else /* ! HAVE_SHLIB */
3537 #define check_module_subr(subr) 3577 #define check_module_subr(subr)
3538 #endif 3578 #endif
3539 3579
3540 void 3580 void