comparison src/symbols.c @ 930:eaedf30d9d76

[xemacs-hg @ 2002-07-23 08:34:59 by youngs] 2002-07-15 Jerry James <james@xemacs.org> * make-docfile.c: Change whitespace and organization to reduce the size of the diff against FSF Emacs sources and synch to Emacs 21.2. Remove unused DO_REALLOC. Mark XEmacs changes and additions more clearly. Reintroduce previously deleted Emacs code inside #if 0 ... #endif. * make-docfile.c (next_extra_elc): Replace goto with do-while. * make-docfile.c (main): Put XEmacs-only args in one place. * make-docfile.c (write_c_args): Change buff to buf to match Emacs. Replace pointer arithmetic with simpler array syntax. * make-docfile.c (scan_c_file): Note that DEFSIMPLE and DEFPRED no longer exist. Correct the "name too long" test (off by one). Die with message if a DEFUN has no docstring instead of hanging. * make-docfile.c (scan_lisp_file): Introduce while loops used in Emacs sources to skip consecutive blank lines. 2002-07-21 John Paul Wallington <jpw@xemacs.org> * process.el (substitute-env-vars): New function; sync with GNU Emacs 21.1.50. (setenv): Add optional arg SUBSTITUTE-ENV-VARS; sync with GNU Emacs 21.1.50. 2002-07-20 Mike Sperber <mike@xemacs.org> * eval.c (run_post_gc_hook): Use more correct flags when running post-gc-hook. 2002-07-20 Mike Sperber <mike@xemacs.org> * process-unix.c (child_setup): Don't try to close file descriptors for chid process once again---it's already being done in close_process_descs. (unix_create_process): Call begin_dont_check_for_quit to inhibit unwanted interaction (and thus breaking of X event synchronicity) in the child. 2002-07-15 Jerry James <james@xemacs.org> * lisp.h: Make Qdll_error visible globally. * symbols.c (check_sane_subr): Revert 2002-06-26 change. Check only if !initialized. * symbols.c (check_module_subr): Add parameter. Duplicate check_sane_subr checks, but signal an error instead of asserting. * symbols.c (defsubr): Use check_module_subr parameter. * symbols.c (defsubr_macro): Ditto.
author youngs
date Tue, 23 Jul 2002 08:35:11 +0000
parents 7f5ac0d2a71f
children c925bacdda60
comparison
equal deleted inserted replaced
929:0c272be3414c 930:eaedf30d9d76
3356 defsymbol_massage_name (location, temp); 3356 defsymbol_massage_name (location, temp);
3357 Fset (*location, *location); 3357 Fset (*location, *location);
3358 } 3358 }
3359 3359
3360 #ifdef DEBUG_XEMACS 3360 #ifdef DEBUG_XEMACS
3361 /* Check that nobody spazzed writing a DEFUN. */ 3361 /* Check that nobody spazzed writing a builtin (non-module) DEFUN. */
3362 static void 3362 static void
3363 check_sane_subr (Lisp_Subr *subr, Lisp_Object sym) 3363 check_sane_subr (Lisp_Subr *subr, Lisp_Object sym)
3364 { 3364 {
3365 Lisp_Object f; 3365 if (!initialized) {
3366 3366 assert (subr->min_args >= 0);
3367 assert (subr->min_args >= 0); 3367 assert (subr->min_args <= SUBR_MAX_ARGS);
3368 assert (subr->min_args <= SUBR_MAX_ARGS); 3368
3369 3369 if (subr->max_args != MANY &&
3370 if (subr->max_args != MANY && 3370 subr->max_args != UNEVALLED)
3371 subr->max_args != UNEVALLED) 3371 {
3372 { 3372 /* Need to fix lisp.h and eval.c if SUBR_MAX_ARGS too small */
3373 /* Need to fix lisp.h and eval.c if SUBR_MAX_ARGS too small */ 3373 assert (subr->max_args <= SUBR_MAX_ARGS);
3374 assert (subr->max_args <= SUBR_MAX_ARGS); 3374 assert (subr->min_args <= subr->max_args);
3375 assert (subr->min_args <= subr->max_args); 3375 }
3376 } 3376
3377 3377 assert (UNBOUNDP (XSYMBOL (sym)->function));
3378 f = XSYMBOL (sym)->function; 3378 }
3379 assert (UNBOUNDP (f) || (CONSP (f) && EQ (XCAR (f), Qautoload)));
3380 } 3379 }
3381 #else 3380 #else
3382 #define check_sane_subr(subr, sym) /* nothing */ 3381 #define check_sane_subr(subr, sym) /* nothing */
3383 #endif 3382 #endif
3384 3383
3405 * it if required. 3404 * it if required.
3406 * 3405 *
3407 * FIXME: Should newsubr be staticpro()'ed? I don't think so but I need 3406 * FIXME: Should newsubr be staticpro()'ed? I don't think so but I need
3408 * a guru to check. 3407 * a guru to check.
3409 */ 3408 */
3410 #define check_module_subr() \ 3409 #define check_module_subr(subr) \
3411 do { \ 3410 do { \
3412 if (initialized) { \ 3411 if (initialized) { \
3413 Lisp_Subr *newsubr = (Lisp_Subr *) xmalloc (sizeof (Lisp_Subr)); \ 3412 Lisp_Subr *newsubr; \
3414 memcpy (newsubr, subr, sizeof (Lisp_Subr)); \ 3413 Lisp_Object f; \
3415 subr->doc = (const char *)newsubr; \ 3414 \
3416 subr = newsubr; \ 3415 if (subr->min_args < 0) \
3417 } \ 3416 signal_ferror (Qdll_error, "%s min_args (%hd) too small", \
3417 subr_name (subr), subr->min_args); \
3418 if (subr->min_args > SUBR_MAX_ARGS) \
3419 signal_ferror (Qdll_error, "%s min_args (%hd) too big (max = %d)", \
3420 subr_name (subr), subr->min_args, SUBR_MAX_ARGS); \
3421 \
3422 if (subr->max_args != MANY && \
3423 subr->max_args != UNEVALLED) \
3424 { \
3425 /* Need to fix lisp.h and eval.c if SUBR_MAX_ARGS too small */ \
3426 if (subr->max_args > SUBR_MAX_ARGS) \
3427 signal_ferror (Qdll_error, "%s max_args (%hd) too big (max = %d)", \
3428 subr_name (subr), subr->max_args, SUBR_MAX_ARGS); \
3429 if (subr->min_args > subr->max_args) \
3430 signal_ferror (Qdll_error, "%s min_args (%hd) > max_args (%hd)", \
3431 subr_name (subr), subr->min_args, subr->max_args); \
3432 } \
3433 \
3434 f = XSYMBOL (sym)->function; \
3435 if (!UNBOUNDP (f) && (!CONSP (f) || !EQ (XCAR (f), Qautoload))) \
3436 signal_ferror (Qdll_error, "Attempt to redefine %s", subr_name (subr)); \
3437 \
3438 newsubr = (Lisp_Subr *) xmalloc (sizeof (Lisp_Subr)); \
3439 memcpy (newsubr, subr, sizeof (Lisp_Subr)); \
3440 subr->doc = (const char *)newsubr; \
3441 subr = newsubr; \
3442 } \
3418 } while (0) 3443 } while (0)
3419 #else /* ! HAVE_SHLIB */ 3444 #else /* ! HAVE_SHLIB */
3420 #define check_module_subr() 3445 #define check_module_subr(subr)
3421 #endif 3446 #endif
3422 3447
3423 void 3448 void
3424 defsubr (Lisp_Subr *subr) 3449 defsubr (Lisp_Subr *subr)
3425 { 3450 {
3426 Lisp_Object sym = intern (subr_name (subr)); 3451 Lisp_Object sym = intern (subr_name (subr));
3427 Lisp_Object fun; 3452 Lisp_Object fun;
3428 3453
3429 check_sane_subr (subr, sym); 3454 check_sane_subr (subr, sym);
3430 check_module_subr (); 3455 check_module_subr (subr);
3431 3456
3432 fun = wrap_subr (subr); 3457 fun = wrap_subr (subr);
3433 XSYMBOL (sym)->function = fun; 3458 XSYMBOL (sym)->function = fun;
3434 } 3459 }
3435 3460
3439 { 3464 {
3440 Lisp_Object sym = intern (subr_name (subr)); 3465 Lisp_Object sym = intern (subr_name (subr));
3441 Lisp_Object fun; 3466 Lisp_Object fun;
3442 3467
3443 check_sane_subr (subr, sym); 3468 check_sane_subr (subr, sym);
3444 check_module_subr(); 3469 check_module_subr (subr);
3445 3470
3446 fun = wrap_subr (subr); 3471 fun = wrap_subr (subr);
3447 XSYMBOL (sym)->function = Fcons (Qmacro, fun); 3472 XSYMBOL (sym)->function = Fcons (Qmacro, fun);
3448 } 3473 }
3449 3474